提交 72aeea48 编写于 作者: J Joe Perches 提交者: Michael Grzeschik

arcnet: Expand odd BUGLVL macro with if and uses

Don't hide what should be obvious.

Make the macro a simple test instead of using if and test.
Signed-off-by: NJoe Perches <joe@perches.com>
Signed-off-by: NMichael Grzeschik <m.grzeschik@pengutronix.de>
上级 d77510f3
...@@ -117,7 +117,8 @@ static void rx(struct net_device *dev, int bufnum, ...@@ -117,7 +117,8 @@ static void rx(struct net_device *dev, int bufnum,
pkt->soft.raw + sizeof(pkt->soft), pkt->soft.raw + sizeof(pkt->soft),
length - sizeof(pkt->soft)); length - sizeof(pkt->soft));
BUGLVL(D_SKB) arcnet_dump_skb(dev, skb, "rx"); if (BUGLVL(D_SKB))
arcnet_dump_skb(dev, skb, "rx");
skb->protocol = cpu_to_be16(ETH_P_ARCNET); skb->protocol = cpu_to_be16(ETH_P_ARCNET);
netif_rx(skb); netif_rx(skb);
......
...@@ -82,18 +82,21 @@ static void arcrimi_copy_from_card(struct net_device *dev, int bufnum, int offse ...@@ -82,18 +82,21 @@ static void arcrimi_copy_from_card(struct net_device *dev, int bufnum, int offse
*/ */
static int __init arcrimi_probe(struct net_device *dev) static int __init arcrimi_probe(struct net_device *dev)
{ {
BUGLVL(D_NORMAL) printk(VERSION); if (BUGLVL(D_NORMAL)) {
BUGLVL(D_NORMAL) printk("E-mail me if you actually test the RIM I driver, please!\n"); printk(VERSION);
printk("E-mail me if you actually test the RIM I driver, please!\n");
BUGLVL(D_NORMAL) printk("Given: node %02Xh, shmem %lXh, irq %d\n", printk("Given: node %02Xh, shmem %lXh, irq %d\n",
dev->dev_addr[0], dev->mem_start, dev->irq); dev->dev_addr[0], dev->mem_start, dev->irq);
}
if (dev->mem_start <= 0 || dev->irq <= 0) { if (dev->mem_start <= 0 || dev->irq <= 0) {
BUGLVL(D_NORMAL) printk("No autoprobe for RIM I; you must specify the shmem and irq!\n"); if (BUGLVL(D_NORMAL))
printk("No autoprobe for RIM I; you must specify the shmem and irq!\n");
return -ENODEV; return -ENODEV;
} }
if (dev->dev_addr[0] == 0) { if (dev->dev_addr[0] == 0) {
BUGLVL(D_NORMAL) printk("You need to specify your card's station ID!\n"); if (BUGLVL(D_NORMAL))
printk("You need to specify your card's station ID!\n");
return -ENODEV; return -ENODEV;
} }
/* Grab the memory region at mem_start for MIRROR_SIZE bytes. /* Grab the memory region at mem_start for MIRROR_SIZE bytes.
...@@ -102,7 +105,8 @@ static int __init arcrimi_probe(struct net_device *dev) ...@@ -102,7 +105,8 @@ static int __init arcrimi_probe(struct net_device *dev)
* will be taken. * will be taken.
*/ */
if (!request_mem_region(dev->mem_start, MIRROR_SIZE, "arcnet (90xx)")) { if (!request_mem_region(dev->mem_start, MIRROR_SIZE, "arcnet (90xx)")) {
BUGLVL(D_NORMAL) printk("Card memory already allocated\n"); if (BUGLVL(D_NORMAL))
printk("Card memory already allocated\n");
return -ENODEV; return -ENODEV;
} }
return arcrimi_found(dev); return arcrimi_found(dev);
......
...@@ -117,7 +117,7 @@ static int __init arcnet_init(void) ...@@ -117,7 +117,7 @@ static int __init arcnet_init(void)
printk("arcnet loaded.\n"); printk("arcnet loaded.\n");
#ifdef ALPHA_WARNING #ifdef ALPHA_WARNING
BUGLVL(D_EXTRA) { if (BUGLVL(D_EXTRA)) {
printk("arcnet: ***\n" printk("arcnet: ***\n"
"arcnet: * Read arcnet.txt for important release notes!\n" "arcnet: * Read arcnet.txt for important release notes!\n"
"arcnet: *\n" "arcnet: *\n"
...@@ -132,11 +132,11 @@ static int __init arcnet_init(void) ...@@ -132,11 +132,11 @@ static int __init arcnet_init(void)
for (count = 0; count < 256; count++) for (count = 0; count < 256; count++)
arc_proto_map[count] = arc_proto_default; arc_proto_map[count] = arc_proto_default;
BUGLVL(D_DURING) if (BUGLVL(D_DURING))
printk("arcnet: struct sizes: %Zd %Zd %Zd %Zd %Zd\n", printk("arcnet: struct sizes: %Zd %Zd %Zd %Zd %Zd\n",
sizeof(struct arc_hardware), sizeof(struct arc_rfc1201), sizeof(struct arc_hardware), sizeof(struct arc_rfc1201),
sizeof(struct arc_rfc1051), sizeof(struct arc_eth_encap), sizeof(struct arc_rfc1051), sizeof(struct arc_eth_encap),
sizeof(struct archdr)); sizeof(struct archdr));
return 0; return 0;
} }
...@@ -235,7 +235,7 @@ static void release_arcbuf(struct net_device *dev, int bufnum) ...@@ -235,7 +235,7 @@ static void release_arcbuf(struct net_device *dev, int bufnum)
lp->buf_queue[lp->first_free_buf++] = bufnum; lp->buf_queue[lp->first_free_buf++] = bufnum;
lp->first_free_buf %= 5; lp->first_free_buf %= 5;
BUGLVL(D_DURING) { if (BUGLVL(D_DURING)) {
BUGMSG(D_DURING, "release_arcbuf: freed #%d; buffer queue is now: ", BUGMSG(D_DURING, "release_arcbuf: freed #%d; buffer queue is now: ",
bufnum); bufnum);
for (i = lp->next_buf; i != lp->first_free_buf; i = (i + 1) % 5) for (i = lp->next_buf; i != lp->first_free_buf; i = (i + 1) % 5)
...@@ -268,7 +268,7 @@ static int get_arcbuf(struct net_device *dev) ...@@ -268,7 +268,7 @@ static int get_arcbuf(struct net_device *dev)
} }
} }
BUGLVL(D_DURING) { if (BUGLVL(D_DURING)) {
BUGMSG(D_DURING, "get_arcbuf: got #%d; buffer queue is now: ", buf); BUGMSG(D_DURING, "get_arcbuf: got #%d; buffer queue is now: ", buf);
for (i = lp->next_buf; i != lp->first_free_buf; i = (i + 1) % 5) for (i = lp->next_buf; i != lp->first_free_buf; i = (i + 1) % 5)
BUGMSG2(D_DURING, "#%d ", lp->buf_queue[i]); BUGMSG2(D_DURING, "#%d ", lp->buf_queue[i]);
...@@ -356,7 +356,7 @@ int arcnet_open(struct net_device *dev) ...@@ -356,7 +356,7 @@ int arcnet_open(struct net_device *dev)
if (!try_module_get(lp->hw.owner)) if (!try_module_get(lp->hw.owner))
return -ENODEV; return -ENODEV;
BUGLVL(D_PROTO) { if (BUGLVL(D_PROTO)) {
BUGMSG(D_PROTO, "protocol map (default is '%c'): ", BUGMSG(D_PROTO, "protocol map (default is '%c'): ",
arc_proto_default->suffix); arc_proto_default->suffix);
for (count = 0; count < 256; count++) for (count = 0; count < 256; count++)
...@@ -531,7 +531,8 @@ netdev_tx_t arcnet_send_packet(struct sk_buff *skb, ...@@ -531,7 +531,8 @@ netdev_tx_t arcnet_send_packet(struct sk_buff *skb,
BUGMSG(D_SKB_SIZE, "skb: transmitting %d bytes to %02X\n", BUGMSG(D_SKB_SIZE, "skb: transmitting %d bytes to %02X\n",
skb->len, pkt->hard.dest); skb->len, pkt->hard.dest);
BUGLVL(D_SKB) arcnet_dump_skb(dev, skb, "tx"); if (BUGLVL(D_SKB))
arcnet_dump_skb(dev, skb, "tx");
/* fits in one packet? */ /* fits in one packet? */
if (skb->len - ARC_HDR_SIZE > XMTU && !proto->continue_tx) { if (skb->len - ARC_HDR_SIZE > XMTU && !proto->continue_tx) {
...@@ -609,7 +610,8 @@ static int go_tx(struct net_device *dev) ...@@ -609,7 +610,8 @@ static int go_tx(struct net_device *dev)
if (lp->cur_tx != -1 || lp->next_tx == -1) if (lp->cur_tx != -1 || lp->next_tx == -1)
return 0; return 0;
BUGLVL(D_TX) arcnet_dump_packet(dev, lp->next_tx, "go_tx", 0); if (BUGLVL(D_TX))
arcnet_dump_packet(dev, lp->next_tx, "go_tx", 0);
lp->cur_tx = lp->next_tx; lp->cur_tx = lp->next_tx;
lp->next_tx = -1; lp->next_tx = -1;
...@@ -822,7 +824,8 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id) ...@@ -822,7 +824,8 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
} }
/* now process the received packet, if any */ /* now process the received packet, if any */
if (recbuf != -1) { if (recbuf != -1) {
BUGLVL(D_RX) arcnet_dump_packet(dev, recbuf, "rx irq", 0); if (BUGLVL(D_RX))
arcnet_dump_packet(dev, recbuf, "rx irq", 0);
arcnet_rx(dev, recbuf); arcnet_rx(dev, recbuf);
release_arcbuf(dev, recbuf); release_arcbuf(dev, recbuf);
...@@ -938,7 +941,7 @@ static void arcnet_rx(struct net_device *dev, int bufnum) ...@@ -938,7 +941,7 @@ static void arcnet_rx(struct net_device *dev, int bufnum)
/* call the right receiver for the protocol */ /* call the right receiver for the protocol */
if (arc_proto_map[soft->proto]->is_ip) { if (arc_proto_map[soft->proto]->is_ip) {
BUGLVL(D_PROTO) { if (BUGLVL(D_PROTO)) {
struct ArcProto struct ArcProto
*oldp = arc_proto_map[lp->default_proto[pkt.hard.source]], *oldp = arc_proto_map[lp->default_proto[pkt.hard.source]],
*newp = arc_proto_map[soft->proto]; *newp = arc_proto_map[soft->proto];
......
...@@ -84,7 +84,8 @@ static void rx(struct net_device *dev, int bufnum, ...@@ -84,7 +84,8 @@ static void rx(struct net_device *dev, int bufnum,
+ sizeof(int), + sizeof(int),
length - sizeof(pkt->soft)); length - sizeof(pkt->soft));
BUGLVL(D_SKB) arcnet_dump_skb(dev, skb, "rx"); if (BUGLVL(D_SKB))
arcnet_dump_skb(dev, skb, "rx");
skb->protocol = cpu_to_be16(ETH_P_ARCNET); skb->protocol = cpu_to_be16(ETH_P_ARCNET);
netif_rx(skb); netif_rx(skb);
...@@ -190,7 +191,8 @@ static int ack_tx(struct net_device *dev, int acked) ...@@ -190,7 +191,8 @@ static int ack_tx(struct net_device *dev, int acked)
BUGMSG(D_DURING, "capmode: ack_tx: protocol: %x: result: %d\n", BUGMSG(D_DURING, "capmode: ack_tx: protocol: %x: result: %d\n",
lp->outgoing.skb->protocol, acked); lp->outgoing.skb->protocol, acked);
BUGLVL(D_SKB) arcnet_dump_skb(dev, lp->outgoing.skb, "ack_tx"); if (BUGLVL(D_SKB))
arcnet_dump_skb(dev, lp->outgoing.skb, "ack_tx");
/* Now alloc a skb to send back up through the layers: */ /* Now alloc a skb to send back up through the layers: */
ackskb = alloc_skb(length + ARC_HDR_SIZE, GFP_ATOMIC); ackskb = alloc_skb(length + ARC_HDR_SIZE, GFP_ATOMIC);
...@@ -216,7 +218,8 @@ static int ack_tx(struct net_device *dev, int acked) ...@@ -216,7 +218,8 @@ static int ack_tx(struct net_device *dev, int acked)
ackskb->protocol = cpu_to_be16(ETH_P_ARCNET); ackskb->protocol = cpu_to_be16(ETH_P_ARCNET);
BUGLVL(D_SKB) arcnet_dump_skb(dev, ackskb, "ack_tx_recv"); if (BUGLVL(D_SKB))
arcnet_dump_skb(dev, ackskb, "ack_tx_recv");
netif_rx(ackskb); netif_rx(ackskb);
free_outskb: free_outskb:
......
...@@ -53,7 +53,8 @@ static int __init com20020isa_probe(struct net_device *dev) ...@@ -53,7 +53,8 @@ static int __init com20020isa_probe(struct net_device *dev)
struct arcnet_local *lp = netdev_priv(dev); struct arcnet_local *lp = netdev_priv(dev);
int err; int err;
BUGLVL(D_NORMAL) printk(VERSION); if (BUGLVL(D_NORMAL))
printk(VERSION);
ioaddr = dev->base_addr; ioaddr = dev->base_addr;
if (!ioaddr) { if (!ioaddr) {
......
...@@ -402,7 +402,8 @@ static struct pci_driver com20020pci_driver = { ...@@ -402,7 +402,8 @@ static struct pci_driver com20020pci_driver = {
static int __init com20020pci_init(void) static int __init com20020pci_init(void)
{ {
BUGLVL(D_NORMAL) printk(VERSION); if (BUGLVL(D_NORMAL))
printk(VERSION);
return pci_register_driver(&com20020pci_driver); return pci_register_driver(&com20020pci_driver);
} }
......
...@@ -365,7 +365,8 @@ MODULE_LICENSE("GPL"); ...@@ -365,7 +365,8 @@ MODULE_LICENSE("GPL");
static int __init com20020_module_init(void) static int __init com20020_module_init(void)
{ {
BUGLVL(D_NORMAL) printk(VERSION); if (BUGLVL(D_NORMAL))
printk(VERSION);
return 0; return 0;
} }
......
...@@ -145,8 +145,10 @@ static int __init com90io_probe(struct net_device *dev) ...@@ -145,8 +145,10 @@ static int __init com90io_probe(struct net_device *dev)
int ioaddr = dev->base_addr, status; int ioaddr = dev->base_addr, status;
unsigned long airqmask; unsigned long airqmask;
BUGLVL(D_NORMAL) printk(VERSION); if (BUGLVL(D_NORMAL)) {
BUGLVL(D_NORMAL) printk("E-mail me if you actually test this driver, please!\n"); printk(VERSION);
printk("E-mail me if you actually test this driver, please!\n");
}
if (!ioaddr) { if (!ioaddr) {
BUGMSG(D_NORMAL, "No autoprobe for IO mapped cards; you must specify the base address!\n"); BUGMSG(D_NORMAL, "No autoprobe for IO mapped cards; you must specify the base address!\n");
......
...@@ -133,7 +133,8 @@ static void __init com90xx_probe(void) ...@@ -133,7 +133,8 @@ static void __init com90xx_probe(void)
return; return;
} }
BUGLVL(D_NORMAL) printk(VERSION); if (BUGLVL(D_NORMAL))
printk(VERSION);
/* set up the arrays where we'll store the possible probe addresses */ /* set up the arrays where we'll store the possible probe addresses */
numports = numshmems = 0; numports = numshmems = 0;
...@@ -166,14 +167,16 @@ static void __init com90xx_probe(void) ...@@ -166,14 +167,16 @@ static void __init com90xx_probe(void)
if (!request_region(*port, ARCNET_TOTAL_SIZE, "arcnet (90xx)")) { if (!request_region(*port, ARCNET_TOTAL_SIZE, "arcnet (90xx)")) {
BUGMSG2(D_INIT_REASONS, "(request_region)\n"); BUGMSG2(D_INIT_REASONS, "(request_region)\n");
BUGMSG2(D_INIT_REASONS, "S1: "); BUGMSG2(D_INIT_REASONS, "S1: ");
BUGLVL(D_INIT_REASONS) numprint = 0; if (BUGLVL(D_INIT_REASONS))
numprint = 0;
*port-- = ports[--numports]; *port-- = ports[--numports];
continue; continue;
} }
if (ASTATUS() == 0xFF) { if (ASTATUS() == 0xFF) {
BUGMSG2(D_INIT_REASONS, "(empty)\n"); BUGMSG2(D_INIT_REASONS, "(empty)\n");
BUGMSG2(D_INIT_REASONS, "S1: "); BUGMSG2(D_INIT_REASONS, "S1: ");
BUGLVL(D_INIT_REASONS) numprint = 0; if (BUGLVL(D_INIT_REASONS))
numprint = 0;
release_region(*port, ARCNET_TOTAL_SIZE); release_region(*port, ARCNET_TOTAL_SIZE);
*port-- = ports[--numports]; *port-- = ports[--numports];
continue; continue;
...@@ -182,7 +185,8 @@ static void __init com90xx_probe(void) ...@@ -182,7 +185,8 @@ static void __init com90xx_probe(void)
BUGMSG2(D_INIT_REASONS, "\n"); BUGMSG2(D_INIT_REASONS, "\n");
BUGMSG2(D_INIT_REASONS, "S1: "); BUGMSG2(D_INIT_REASONS, "S1: ");
BUGLVL(D_INIT_REASONS) numprint = 0; if (BUGLVL(D_INIT_REASONS))
numprint = 0;
} }
BUGMSG2(D_INIT, "\n"); BUGMSG2(D_INIT, "\n");
...@@ -227,21 +231,24 @@ static void __init com90xx_probe(void) ...@@ -227,21 +231,24 @@ static void __init com90xx_probe(void)
if (!request_mem_region(*p, MIRROR_SIZE, "arcnet (90xx)")) { if (!request_mem_region(*p, MIRROR_SIZE, "arcnet (90xx)")) {
BUGMSG2(D_INIT_REASONS, "(request_mem_region)\n"); BUGMSG2(D_INIT_REASONS, "(request_mem_region)\n");
BUGMSG2(D_INIT_REASONS, "Stage 3: "); BUGMSG2(D_INIT_REASONS, "Stage 3: ");
BUGLVL(D_INIT_REASONS) numprint = 0; if (BUGLVL(D_INIT_REASONS))
numprint = 0;
goto out; goto out;
} }
base = ioremap(*p, MIRROR_SIZE); base = ioremap(*p, MIRROR_SIZE);
if (!base) { if (!base) {
BUGMSG2(D_INIT_REASONS, "(ioremap)\n"); BUGMSG2(D_INIT_REASONS, "(ioremap)\n");
BUGMSG2(D_INIT_REASONS, "Stage 3: "); BUGMSG2(D_INIT_REASONS, "Stage 3: ");
BUGLVL(D_INIT_REASONS) numprint = 0; if (BUGLVL(D_INIT_REASONS))
numprint = 0;
goto out1; goto out1;
} }
if (readb(base) != TESTvalue) { if (readb(base) != TESTvalue) {
BUGMSG2(D_INIT_REASONS, "(%02Xh != %02Xh)\n", BUGMSG2(D_INIT_REASONS, "(%02Xh != %02Xh)\n",
readb(base), TESTvalue); readb(base), TESTvalue);
BUGMSG2(D_INIT_REASONS, "S3: "); BUGMSG2(D_INIT_REASONS, "S3: ");
BUGLVL(D_INIT_REASONS) numprint = 0; if (BUGLVL(D_INIT_REASONS))
numprint = 0;
goto out2; goto out2;
} }
/* By writing 0x42 to the TESTvalue location, we also make /* By writing 0x42 to the TESTvalue location, we also make
...@@ -257,7 +264,8 @@ static void __init com90xx_probe(void) ...@@ -257,7 +264,8 @@ static void __init com90xx_probe(void)
} }
BUGMSG2(D_INIT_REASONS, "\n"); BUGMSG2(D_INIT_REASONS, "\n");
BUGMSG2(D_INIT_REASONS, "S3: "); BUGMSG2(D_INIT_REASONS, "S3: ");
BUGLVL(D_INIT_REASONS) numprint = 0; if (BUGLVL(D_INIT_REASONS))
numprint = 0;
iomem[index] = base; iomem[index] = base;
continue; continue;
out2: out2:
...@@ -319,7 +327,8 @@ static void __init com90xx_probe(void) ...@@ -319,7 +327,8 @@ static void __init com90xx_probe(void)
!= (NORXflag | RECONflag | TXFREEflag | RESETflag)) { != (NORXflag | RECONflag | TXFREEflag | RESETflag)) {
BUGMSG2(D_INIT_REASONS, "(status=%Xh)\n", status); BUGMSG2(D_INIT_REASONS, "(status=%Xh)\n", status);
BUGMSG2(D_INIT_REASONS, "S5: "); BUGMSG2(D_INIT_REASONS, "S5: ");
BUGLVL(D_INIT_REASONS) numprint = 0; if (BUGLVL(D_INIT_REASONS))
numprint = 0;
release_region(*port, ARCNET_TOTAL_SIZE); release_region(*port, ARCNET_TOTAL_SIZE);
*port-- = ports[--numports]; *port-- = ports[--numports];
continue; continue;
...@@ -330,7 +339,8 @@ static void __init com90xx_probe(void) ...@@ -330,7 +339,8 @@ static void __init com90xx_probe(void)
BUGMSG2(D_INIT_REASONS, " (eternal reset, status=%Xh)\n", BUGMSG2(D_INIT_REASONS, " (eternal reset, status=%Xh)\n",
status); status);
BUGMSG2(D_INIT_REASONS, "S5: "); BUGMSG2(D_INIT_REASONS, "S5: ");
BUGLVL(D_INIT_REASONS) numprint = 0; if (BUGLVL(D_INIT_REASONS))
numprint = 0;
release_region(*port, ARCNET_TOTAL_SIZE); release_region(*port, ARCNET_TOTAL_SIZE);
*port-- = ports[--numports]; *port-- = ports[--numports];
continue; continue;
...@@ -352,7 +362,8 @@ static void __init com90xx_probe(void) ...@@ -352,7 +362,8 @@ static void __init com90xx_probe(void)
if (airq <= 0) { if (airq <= 0) {
BUGMSG2(D_INIT_REASONS, "(airq=%d)\n", airq); BUGMSG2(D_INIT_REASONS, "(airq=%d)\n", airq);
BUGMSG2(D_INIT_REASONS, "S5: "); BUGMSG2(D_INIT_REASONS, "S5: ");
BUGLVL(D_INIT_REASONS) numprint = 0; if (BUGLVL(D_INIT_REASONS))
numprint = 0;
release_region(*port, ARCNET_TOTAL_SIZE); release_region(*port, ARCNET_TOTAL_SIZE);
*port-- = ports[--numports]; *port-- = ports[--numports];
continue; continue;
...@@ -406,16 +417,20 @@ static void __init com90xx_probe(void) ...@@ -406,16 +417,20 @@ static void __init com90xx_probe(void)
} }
if (openparen) { if (openparen) {
BUGLVL(D_INIT) printk("no matching shmem)\n"); if (BUGLVL(D_INIT))
BUGLVL(D_INIT_REASONS) printk("S5: "); printk("no matching shmem)\n");
BUGLVL(D_INIT_REASONS) numprint = 0; if (BUGLVL(D_INIT_REASONS)) {
printk("S5: ");
numprint = 0;
}
} }
if (!found) if (!found)
release_region(*port, ARCNET_TOTAL_SIZE); release_region(*port, ARCNET_TOTAL_SIZE);
*port-- = ports[--numports]; *port-- = ports[--numports];
} }
BUGLVL(D_INIT_REASONS) printk("\n"); if (BUGLVL(D_INIT_REASONS))
printk("\n");
/* Now put back TESTvalue on all leftover shmems. */ /* Now put back TESTvalue on all leftover shmems. */
for (index = 0; index < numshmems; index++) { for (index = 0; index < numshmems; index++) {
...@@ -603,8 +618,8 @@ static int com90xx_reset(struct net_device *dev, int really_reset) ...@@ -603,8 +618,8 @@ static int com90xx_reset(struct net_device *dev, int really_reset)
ACOMMAND(CONFIGcmd | EXTconf); ACOMMAND(CONFIGcmd | EXTconf);
/* clean out all the memory to make debugging make more sense :) */ /* clean out all the memory to make debugging make more sense :) */
BUGLVL(D_DURING) if (BUGLVL(D_DURING))
memset_io(lp->mem_start, 0x42, 2048); memset_io(lp->mem_start, 0x42, 2048);
/* done! return success. */ /* done! return success. */
return 0; return 0;
......
...@@ -149,7 +149,8 @@ static void rx(struct net_device *dev, int bufnum, ...@@ -149,7 +149,8 @@ static void rx(struct net_device *dev, int bufnum,
pkt->soft.raw + sizeof(pkt->soft), pkt->soft.raw + sizeof(pkt->soft),
length - sizeof(pkt->soft)); length - sizeof(pkt->soft));
BUGLVL(D_SKB) arcnet_dump_skb(dev, skb, "rx"); if (BUGLVL(D_SKB))
arcnet_dump_skb(dev, skb, "rx");
skb->protocol = type_trans(skb, dev); skb->protocol = type_trans(skb, dev);
netif_rx(skb); netif_rx(skb);
......
...@@ -221,7 +221,8 @@ static void rx(struct net_device *dev, int bufnum, ...@@ -221,7 +221,8 @@ static void rx(struct net_device *dev, int bufnum,
dev->stats.rx_crc_errors++; dev->stats.rx_crc_errors++;
} }
} }
BUGLVL(D_SKB) arcnet_dump_skb(dev, skb, "rx"); if (BUGLVL(D_SKB))
arcnet_dump_skb(dev, skb, "rx");
skb->protocol = type_trans(skb, dev); skb->protocol = type_trans(skb, dev);
netif_rx(skb); netif_rx(skb);
...@@ -353,7 +354,8 @@ static void rx(struct net_device *dev, int bufnum, ...@@ -353,7 +354,8 @@ static void rx(struct net_device *dev, int bufnum,
skb->len, pkt->hard.source); skb->len, pkt->hard.source);
BUGMSG(D_SKB_SIZE, "skb: received %d bytes from %02X (split)\n", BUGMSG(D_SKB_SIZE, "skb: received %d bytes from %02X (split)\n",
skb->len, pkt->hard.source); skb->len, pkt->hard.source);
BUGLVL(D_SKB) arcnet_dump_skb(dev, skb, "rx"); if (BUGLVL(D_SKB))
arcnet_dump_skb(dev, skb, "rx");
skb->protocol = type_trans(skb, dev); skb->protocol = type_trans(skb, dev);
netif_rx(skb); netif_rx(skb);
......
...@@ -78,13 +78,12 @@ ...@@ -78,13 +78,12 @@
#endif #endif
extern int arcnet_debug; extern int arcnet_debug;
#define BUGLVL_TEST(x) ((x) & ARCNET_DEBUG_MAX & arcnet_debug) #define BUGLVL(x) ((x) & ARCNET_DEBUG_MAX & arcnet_debug)
#define BUGLVL(x) if (BUGLVL_TEST(x))
/* macros to simplify debug checking */ /* macros to simplify debug checking */
#define BUGMSG(x, fmt, ...) \ #define BUGMSG(x, fmt, ...) \
do { \ do { \
if (BUGLVL_TEST(x)) \ if (BUGLVL(x)) \
printk("%s%6s: " fmt, \ printk("%s%6s: " fmt, \
(x) == D_NORMAL ? KERN_WARNING : \ (x) == D_NORMAL ? KERN_WARNING : \
(x) < D_DURING ? KERN_INFO : KERN_DEBUG, \ (x) < D_DURING ? KERN_INFO : KERN_DEBUG, \
...@@ -93,12 +92,14 @@ do { \ ...@@ -93,12 +92,14 @@ do { \
#define BUGMSG2(x, fmt, ...) \ #define BUGMSG2(x, fmt, ...) \
do { \ do { \
if (BUGLVL_TEST(x)) \ if (BUGLVL(x)) \
printk(fmt, ##__VA_ARGS__); \ printk(fmt, ##__VA_ARGS__); \
} while (0) } while (0)
/* see how long a function call takes to run, expressed in CPU cycles */ /* see how long a function call takes to run, expressed in CPU cycles */
#define TIME(name, bytes, call) BUGLVL(D_TIMING) { \ #define TIME(name, bytes, call) \
do { \
if (BUGLVL(D_TIMING)) { \
unsigned long _x, _y; \ unsigned long _x, _y; \
_x = get_cycles(); \ _x = get_cycles(); \
call; \ call; \
...@@ -108,10 +109,10 @@ do { \ ...@@ -108,10 +109,10 @@ do { \
"%lu Kbytes/100Mcycle\n", \ "%lu Kbytes/100Mcycle\n", \
name, bytes, _y - _x, \ name, bytes, _y - _x, \
100000000 / 1024 * bytes / (_y - _x + 1)); \ 100000000 / 1024 * bytes / (_y - _x + 1)); \
} \ } else { \
else { \
call; \ call; \
} } \
} while (0)
/* /*
* Time needed to reset the card - in ms (milliseconds). This works on my * Time needed to reset the card - in ms (milliseconds). This works on my
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册