提交 5a3b7504 编写于 作者: F Finn Thain 提交者: David S. Miller

net/mac89x0: Replace custom debug logging with netif_* calls

Adopt the conventional style of debug logging because it is both
shorter and more flexible.
Remove the 'version_printed' flag as the version will be printed
only once anyway (when the module loads).
Signed-off-by: NFinn Thain <fthain@telegraphics.com.au>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 86c2666e
...@@ -61,18 +61,6 @@ ...@@ -61,18 +61,6 @@
static const char version[] = static const char version[] =
"cs89x0.c:v1.02 11/26/96 Russell Nelson <nelson@crynwr.com>\n"; "cs89x0.c:v1.02 11/26/96 Russell Nelson <nelson@crynwr.com>\n";
/* ======================= configure the driver here ======================= */
/* use 0 for production, 1 for verification, >2 for debug */
#ifndef NET_DEBUG
#define NET_DEBUG 0
#endif
/* ======================= end of configuration ======================= */
/* Always include 'config.h' first in case the user wants to turn on
or override something. */
#include <linux/module.h> #include <linux/module.h>
/* /*
...@@ -108,14 +96,13 @@ static const char version[] = ...@@ -108,14 +96,13 @@ static const char version[] =
#include "cs89x0.h" #include "cs89x0.h"
static int debug; static int debug = -1;
module_param(debug, int, 0); module_param(debug, int, 0);
MODULE_PARM_DESC(debug, "CS89[02]0 debug level (0-5)"); MODULE_PARM_DESC(debug, "debug message level");
static unsigned int net_debug = NET_DEBUG;
/* Information that need to be kept for each board. */ /* Information that need to be kept for each board. */
struct net_local { struct net_local {
int msg_enable;
int chip_type; /* one of: CS8900, CS8920, CS8920M */ int chip_type; /* one of: CS8900, CS8920, CS8920M */
char chip_revision; /* revision letter of the chip ('A'...) */ char chip_revision; /* revision letter of the chip ('A'...) */
int send_cmd; /* the propercommand used to send a packet. */ int send_cmd; /* the propercommand used to send a packet. */
...@@ -178,7 +165,6 @@ static int mac89x0_device_probe(struct platform_device *pdev) ...@@ -178,7 +165,6 @@ static int mac89x0_device_probe(struct platform_device *pdev)
{ {
struct net_device *dev; struct net_device *dev;
struct net_local *lp; struct net_local *lp;
static unsigned version_printed;
int i, slot; int i, slot;
unsigned rev_type = 0; unsigned rev_type = 0;
unsigned long ioaddr; unsigned long ioaddr;
...@@ -186,8 +172,6 @@ static int mac89x0_device_probe(struct platform_device *pdev) ...@@ -186,8 +172,6 @@ static int mac89x0_device_probe(struct platform_device *pdev)
int err = -ENODEV; int err = -ENODEV;
struct nubus_rsrc *fres; struct nubus_rsrc *fres;
net_debug = debug;
dev = alloc_etherdev(sizeof(struct net_local)); dev = alloc_etherdev(sizeof(struct net_local));
if (!dev) if (!dev)
return -ENOMEM; return -ENOMEM;
...@@ -222,6 +206,8 @@ static int mac89x0_device_probe(struct platform_device *pdev) ...@@ -222,6 +206,8 @@ static int mac89x0_device_probe(struct platform_device *pdev)
/* Initialize the net_device structure. */ /* Initialize the net_device structure. */
lp = netdev_priv(dev); lp = netdev_priv(dev);
lp->msg_enable = netif_msg_init(debug, 0);
/* Fill in the 'dev' fields. */ /* Fill in the 'dev' fields. */
dev->base_addr = ioaddr; dev->base_addr = ioaddr;
dev->mem_start = (unsigned long) dev->mem_start = (unsigned long)
...@@ -244,8 +230,7 @@ static int mac89x0_device_probe(struct platform_device *pdev) ...@@ -244,8 +230,7 @@ static int mac89x0_device_probe(struct platform_device *pdev)
if (lp->chip_type != CS8900 && lp->chip_revision >= 'C') if (lp->chip_type != CS8900 && lp->chip_revision >= 'C')
lp->send_cmd = TX_NOW; lp->send_cmd = TX_NOW;
if (net_debug && version_printed++ == 0) netif_dbg(lp, drv, dev, "%s", version);
printk(version);
pr_info("cs89%c0%s rev %c found at %#8lx\n", pr_info("cs89%c0%s rev %c found at %#8lx\n",
lp->chip_type == CS8900 ? '0' : '2', lp->chip_type == CS8900 ? '0' : '2',
...@@ -345,11 +330,9 @@ net_send_packet(struct sk_buff *skb, struct net_device *dev) ...@@ -345,11 +330,9 @@ net_send_packet(struct sk_buff *skb, struct net_device *dev)
struct net_local *lp = netdev_priv(dev); struct net_local *lp = netdev_priv(dev);
unsigned long flags; unsigned long flags;
if (net_debug > 3) netif_dbg(lp, tx_queued, dev, "sent %d byte packet of type %x\n",
printk("%s: sent %d byte packet of type %x\n", skb->len, skb->data[ETH_ALEN + ETH_ALEN] << 8 |
dev->name, skb->len, skb->data[ETH_ALEN + ETH_ALEN + 1]);
(skb->data[ETH_ALEN+ETH_ALEN] << 8)
| skb->data[ETH_ALEN+ETH_ALEN+1]);
/* keep the upload from being interrupted, since we /* keep the upload from being interrupted, since we
ask the chip to start transmitting before the ask the chip to start transmitting before the
...@@ -398,7 +381,7 @@ static irqreturn_t net_interrupt(int irq, void *dev_id) ...@@ -398,7 +381,7 @@ static irqreturn_t net_interrupt(int irq, void *dev_id)
faster than you can read them off, you're screwed. Hasta la faster than you can read them off, you're screwed. Hasta la
vista, baby! */ vista, baby! */
while ((status = swab16(nubus_readw(dev->base_addr + ISQ_PORT)))) { while ((status = swab16(nubus_readw(dev->base_addr + ISQ_PORT)))) {
if (net_debug > 4)printk("%s: event=%04x\n", dev->name, status); netif_dbg(lp, intr, dev, "status=%04x\n", status);
switch(status & ISQ_EVENT_MASK) { switch(status & ISQ_EVENT_MASK) {
case ISQ_RECEIVER_EVENT: case ISQ_RECEIVER_EVENT:
/* Got a packet(s). */ /* Got a packet(s). */
...@@ -428,7 +411,7 @@ static irqreturn_t net_interrupt(int irq, void *dev_id) ...@@ -428,7 +411,7 @@ static irqreturn_t net_interrupt(int irq, void *dev_id)
netif_wake_queue(dev); netif_wake_queue(dev);
} }
if (status & TX_UNDERRUN) { if (status & TX_UNDERRUN) {
if (net_debug > 0) printk("%s: transmit underrun\n", dev->name); netif_dbg(lp, tx_err, dev, "transmit underrun\n");
lp->send_underrun++; lp->send_underrun++;
if (lp->send_underrun == 3) lp->send_cmd = TX_AFTER_381; if (lp->send_underrun == 3) lp->send_cmd = TX_AFTER_381;
else if (lp->send_underrun == 6) lp->send_cmd = TX_AFTER_ALL; else if (lp->send_underrun == 6) lp->send_cmd = TX_AFTER_ALL;
...@@ -449,6 +432,7 @@ static irqreturn_t net_interrupt(int irq, void *dev_id) ...@@ -449,6 +432,7 @@ static irqreturn_t net_interrupt(int irq, void *dev_id)
static void static void
net_rx(struct net_device *dev) net_rx(struct net_device *dev)
{ {
struct net_local *lp = netdev_priv(dev);
struct sk_buff *skb; struct sk_buff *skb;
int status, length; int status, length;
...@@ -480,10 +464,9 @@ net_rx(struct net_device *dev) ...@@ -480,10 +464,9 @@ net_rx(struct net_device *dev)
skb_copy_to_linear_data(skb, (void *)(dev->mem_start + PP_RxFrame), skb_copy_to_linear_data(skb, (void *)(dev->mem_start + PP_RxFrame),
length); length);
if (net_debug > 3)printk("%s: received %d byte packet of type %x\n", netif_dbg(lp, rx_status, dev, "received %d byte packet of type %x\n",
dev->name, length, length, skb->data[ETH_ALEN + ETH_ALEN] << 8 |
(skb->data[ETH_ALEN+ETH_ALEN] << 8) skb->data[ETH_ALEN + ETH_ALEN + 1]);
| skb->data[ETH_ALEN+ETH_ALEN+1]);
skb->protocol=eth_type_trans(skb,dev); skb->protocol=eth_type_trans(skb,dev);
netif_rx(skb); netif_rx(skb);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册