diff options
author | Joe Perches <joe@perches.com> | 2012-05-18 08:56:30 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-18 23:48:07 -0400 |
commit | 808e9a77358995612c250ad5319f4bfe12c8416d (patch) | |
tree | f45c87fff9ec62a9a92f748c2f74490e9f4f5c05 | |
parent | ca034bcdb1786b0bfbe949c1575f8175d05325ce (diff) |
cirrus: cs89x0: Neaten debugging and logging
Introduce and use a debug macro to test and print.
Convert printks to pr_<level>.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/cirrus/cs89x0.c | 187 |
1 files changed, 82 insertions, 105 deletions
diff --git a/drivers/net/ethernet/cirrus/cs89x0.c b/drivers/net/ethernet/cirrus/cs89x0.c index 6e5b2c79340f..859f8bec292b 100644 --- a/drivers/net/ethernet/cirrus/cs89x0.c +++ b/drivers/net/ethernet/cirrus/cs89x0.c | |||
@@ -77,8 +77,14 @@ | |||
77 | 77 | ||
78 | #include "cs89x0.h" | 78 | #include "cs89x0.h" |
79 | 79 | ||
80 | #define cs89_dbg(val, level, fmt, ...) \ | ||
81 | do { \ | ||
82 | if (val <= net_debug) \ | ||
83 | pr_##level(fmt, ##__VA_ARGS__); \ | ||
84 | } while (0) | ||
85 | |||
80 | static char version[] __initdata = | 86 | static char version[] __initdata = |
81 | "v2.4.3-pre1 Russell Nelson <nelson@crynwr.com>, Andrew Morton\n"; | 87 | "v2.4.3-pre1 Russell Nelson <nelson@crynwr.com>, Andrew Morton"; |
82 | 88 | ||
83 | #define DRV_NAME "cs89x0" | 89 | #define DRV_NAME "cs89x0" |
84 | 90 | ||
@@ -315,8 +321,7 @@ get_eeprom_data(struct net_device *dev, int off, int len, int *buffer) | |||
315 | { | 321 | { |
316 | int i; | 322 | int i; |
317 | 323 | ||
318 | if (net_debug > 3) | 324 | cs89_dbg(3, info, "EEPROM data from %x for %x:\n", off, len); |
319 | printk("EEPROM data from %x for %x:\n", off, len); | ||
320 | for (i = 0; i < len; i++) { | 325 | for (i = 0; i < len; i++) { |
321 | if (wait_eeprom_ready(dev) < 0) | 326 | if (wait_eeprom_ready(dev) < 0) |
322 | return -1; | 327 | return -1; |
@@ -325,11 +330,9 @@ get_eeprom_data(struct net_device *dev, int off, int len, int *buffer) | |||
325 | if (wait_eeprom_ready(dev) < 0) | 330 | if (wait_eeprom_ready(dev) < 0) |
326 | return -1; | 331 | return -1; |
327 | buffer[i] = readreg(dev, PP_EEData); | 332 | buffer[i] = readreg(dev, PP_EEData); |
328 | if (net_debug > 3) | 333 | cs89_dbg(3, cont, "%04x ", buffer[i]); |
329 | printk("%04x ", buffer[i]); | ||
330 | } | 334 | } |
331 | if (net_debug > 3) | 335 | cs89_dbg(3, cont, "\n"); |
332 | printk("\n"); | ||
333 | return 0; | 336 | return 0; |
334 | } | 337 | } |
335 | 338 | ||
@@ -435,8 +438,7 @@ cs89x0_probe1(struct net_device *dev, void __iomem *ioaddr, int modular) | |||
435 | if (lp->chip_type != CS8900 && lp->chip_revision >= 'C') | 438 | if (lp->chip_type != CS8900 && lp->chip_revision >= 'C') |
436 | lp->send_cmd = TX_NOW; | 439 | lp->send_cmd = TX_NOW; |
437 | 440 | ||
438 | if (net_debug) | 441 | pr_info_once("%s\n", version); |
439 | printk_once(version); | ||
440 | 442 | ||
441 | pr_info("%s: cs89%c0%s rev %c found at %p ", | 443 | pr_info("%s: cs89%c0%s rev %c found at %p ", |
442 | dev->name, | 444 | dev->name, |
@@ -495,18 +497,17 @@ cs89x0_probe1(struct net_device *dev, void __iomem *ioaddr, int modular) | |||
495 | lp->adapter_cnf |= A_CNF_AUI | A_CNF_10B_T | | 497 | lp->adapter_cnf |= A_CNF_AUI | A_CNF_10B_T | |
496 | A_CNF_MEDIA_AUI | A_CNF_MEDIA_10B_T | A_CNF_MEDIA_AUTO; | 498 | A_CNF_MEDIA_AUI | A_CNF_MEDIA_10B_T | A_CNF_MEDIA_AUTO; |
497 | 499 | ||
498 | if (net_debug > 1) | 500 | cs89_dbg(1, info, "%s: PP_LineCTL=0x%x, adapter_cnf=0x%x\n", |
499 | pr_info("%s: PP_LineCTL=0x%x, adapter_cnf=0x%x\n", | 501 | dev->name, i, lp->adapter_cnf); |
500 | dev->name, i, lp->adapter_cnf); | ||
501 | 502 | ||
502 | /* IRQ. Other chips already probe, see below. */ | 503 | /* IRQ. Other chips already probe, see below. */ |
503 | if (lp->chip_type == CS8900) | 504 | if (lp->chip_type == CS8900) |
504 | lp->isa_config = readreg(dev, PP_CS8900_ISAINT) & INT_NO_MASK; | 505 | lp->isa_config = readreg(dev, PP_CS8900_ISAINT) & INT_NO_MASK; |
505 | 506 | ||
506 | printk("[Cirrus EEPROM] "); | 507 | pr_cont("[Cirrus EEPROM] "); |
507 | } | 508 | } |
508 | 509 | ||
509 | printk("\n"); | 510 | pr_cont("\n"); |
510 | 511 | ||
511 | /* First check to see if an EEPROM is attached. */ | 512 | /* First check to see if an EEPROM is attached. */ |
512 | 513 | ||
@@ -542,9 +543,8 @@ cs89x0_probe1(struct net_device *dev, void __iomem *ioaddr, int modular) | |||
542 | dev->dev_addr[i * 2] = eeprom_buff[i]; | 543 | dev->dev_addr[i * 2] = eeprom_buff[i]; |
543 | dev->dev_addr[i * 2 + 1] = eeprom_buff[i] >> 8; | 544 | dev->dev_addr[i * 2 + 1] = eeprom_buff[i] >> 8; |
544 | } | 545 | } |
545 | if (net_debug > 1) | 546 | cs89_dbg(1, debug, "%s: new adapter_cnf: 0x%x\n", |
546 | pr_debug("%s: new adapter_cnf: 0x%x\n", | 547 | dev->name, lp->adapter_cnf); |
547 | dev->name, lp->adapter_cnf); | ||
548 | } | 548 | } |
549 | 549 | ||
550 | /* allow them to force multiple transceivers. If they force multiple, autosense */ | 550 | /* allow them to force multiple transceivers. If they force multiple, autosense */ |
@@ -572,9 +572,8 @@ cs89x0_probe1(struct net_device *dev, void __iomem *ioaddr, int modular) | |||
572 | lp->adapter_cnf |= A_CNF_MEDIA_10B_2; | 572 | lp->adapter_cnf |= A_CNF_MEDIA_10B_2; |
573 | } | 573 | } |
574 | 574 | ||
575 | if (net_debug > 1) | 575 | cs89_dbg(1, debug, "%s: after force 0x%x, adapter_cnf=0x%x\n", |
576 | pr_debug("%s: after force 0x%x, adapter_cnf=0x%x\n", | 576 | dev->name, lp->force, lp->adapter_cnf); |
577 | dev->name, lp->force, lp->adapter_cnf); | ||
578 | 577 | ||
579 | /* FIXME: We don't let you set dc-dc polarity or low RX squelch from the command line: add it here */ | 578 | /* FIXME: We don't let you set dc-dc polarity or low RX squelch from the command line: add it here */ |
580 | 579 | ||
@@ -629,24 +628,23 @@ cs89x0_probe1(struct net_device *dev, void __iomem *ioaddr, int modular) | |||
629 | dev->irq = i; | 628 | dev->irq = i; |
630 | } | 629 | } |
631 | 630 | ||
632 | printk(" IRQ %d", dev->irq); | 631 | pr_cont(" IRQ %d", dev->irq); |
633 | 632 | ||
634 | #if ALLOW_DMA | 633 | #if ALLOW_DMA |
635 | if (lp->use_dma) { | 634 | if (lp->use_dma) { |
636 | get_dma_channel(dev); | 635 | get_dma_channel(dev); |
637 | printk(", DMA %d", dev->dma); | 636 | pr_cont(", DMA %d", dev->dma); |
638 | } else | 637 | } else |
639 | #endif | 638 | #endif |
640 | printk(", programmed I/O"); | 639 | pr_cont(", programmed I/O"); |
641 | 640 | ||
642 | /* print the ethernet address. */ | 641 | /* print the ethernet address. */ |
643 | printk(", MAC %pM\n", dev->dev_addr); | 642 | pr_cont(", MAC %pM\n", dev->dev_addr); |
644 | 643 | ||
645 | dev->netdev_ops = &net_ops; | 644 | dev->netdev_ops = &net_ops; |
646 | dev->watchdog_timeo = HZ; | 645 | dev->watchdog_timeo = HZ; |
647 | 646 | ||
648 | if (net_debug) | 647 | cs89_dbg(0, info, "cs89x0_probe1() successful\n"); |
649 | printk("cs89x0_probe1() successful\n"); | ||
650 | 648 | ||
651 | retval = register_netdev(dev); | 649 | retval = register_netdev(dev); |
652 | if (retval) | 650 | if (retval) |
@@ -693,8 +691,7 @@ cs89x0_ioport_probe(struct net_device *dev, unsigned long ioport, int modular) | |||
693 | * will skip the test for the ADD_PORT. | 691 | * will skip the test for the ADD_PORT. |
694 | */ | 692 | */ |
695 | if (ioport & 1) { | 693 | if (ioport & 1) { |
696 | if (net_debug > 1) | 694 | cs89_dbg(1, info, "%s: odd ioaddr 0x%lx\n", dev->name, ioport); |
697 | pr_info("%s: odd ioaddr 0x%lx\n", dev->name, ioport); | ||
698 | if ((ioport & 2) != 2) { | 695 | if ((ioport & 2) != 2) { |
699 | if ((ioread16(io_mem + ADD_PORT) & ADD_MASK) != | 696 | if ((ioread16(io_mem + ADD_PORT) & ADD_MASK) != |
700 | ADD_SIG) { | 697 | ADD_SIG) { |
@@ -742,8 +739,7 @@ struct net_device * __init cs89x0_probe(int unit) | |||
742 | io = dev->base_addr; | 739 | io = dev->base_addr; |
743 | irq = dev->irq; | 740 | irq = dev->irq; |
744 | 741 | ||
745 | if (net_debug) | 742 | cs89_dbg(0, info, "cs89x0_probe(0x%x)\n", io); |
746 | pr_info("cs89x0_probe(0x%x)\n", io); | ||
747 | 743 | ||
748 | if (io > 0x1ff) { /* Check a single specified location. */ | 744 | if (io > 0x1ff) { /* Check a single specified location. */ |
749 | err = cs89x0_ioport_probe(dev, io, 0); | 745 | err = cs89x0_ioport_probe(dev, io, 0); |
@@ -817,18 +813,15 @@ set_dma_cfg(struct net_device *dev) | |||
817 | 813 | ||
818 | if (lp->use_dma) { | 814 | if (lp->use_dma) { |
819 | if ((lp->isa_config & ANY_ISA_DMA) == 0) { | 815 | if ((lp->isa_config & ANY_ISA_DMA) == 0) { |
820 | if (net_debug > 3) | 816 | cs89_dbg(3, err, "set_dma_cfg(): no DMA\n"); |
821 | printk("set_dma_cfg(): no DMA\n"); | ||
822 | return; | 817 | return; |
823 | } | 818 | } |
824 | if (lp->isa_config & ISA_RxDMA) { | 819 | if (lp->isa_config & ISA_RxDMA) { |
825 | lp->curr_rx_cfg |= RX_DMA_ONLY; | 820 | lp->curr_rx_cfg |= RX_DMA_ONLY; |
826 | if (net_debug > 3) | 821 | cs89_dbg(3, info, "set_dma_cfg(): RX_DMA_ONLY\n"); |
827 | printk("set_dma_cfg(): RX_DMA_ONLY\n"); | ||
828 | } else { | 822 | } else { |
829 | lp->curr_rx_cfg |= AUTO_RX_DMA; /* not that we support it... */ | 823 | lp->curr_rx_cfg |= AUTO_RX_DMA; /* not that we support it... */ |
830 | if (net_debug > 3) | 824 | cs89_dbg(3, info, "set_dma_cfg(): AUTO_RX_DMA\n"); |
831 | printk("set_dma_cfg(): AUTO_RX_DMA\n"); | ||
832 | } | 825 | } |
833 | } | 826 | } |
834 | } | 827 | } |
@@ -871,10 +864,10 @@ dma_rx(struct net_device *dev) | |||
871 | status = bp[0] + (bp[1] << 8); | 864 | status = bp[0] + (bp[1] << 8); |
872 | length = bp[2] + (bp[3] << 8); | 865 | length = bp[2] + (bp[3] << 8); |
873 | bp += 4; | 866 | bp += 4; |
874 | if (net_debug > 5) { | 867 | |
875 | printk("%s: receiving DMA packet at %lx, status %x, length %x\n", | 868 | cs89_dbg(5, debug, "%s: receiving DMA packet at %lx, status %x, length %x\n", |
876 | dev->name, (unsigned long)bp, status, length); | 869 | dev->name, (unsigned long)bp, status, length); |
877 | } | 870 | |
878 | if ((status & RX_OK) == 0) { | 871 | if ((status & RX_OK) == 0) { |
879 | count_rx_errors(status, dev); | 872 | count_rx_errors(status, dev); |
880 | goto skip_this_frame; | 873 | goto skip_this_frame; |
@@ -883,9 +876,9 @@ dma_rx(struct net_device *dev) | |||
883 | /* Malloc up new buffer. */ | 876 | /* Malloc up new buffer. */ |
884 | skb = netdev_alloc_skb(dev, length + 2); | 877 | skb = netdev_alloc_skb(dev, length + 2); |
885 | if (skb == NULL) { | 878 | if (skb == NULL) { |
886 | if (net_debug) /* I don't think we want to do this to a stressed system */ | 879 | /* I don't think we want to do this to a stressed system */ |
887 | printk("%s: Memory squeeze, dropping packet\n", | 880 | cs89_dbg(0, err, "%s: Memory squeeze, dropping packet\n", |
888 | dev->name); | 881 | dev->name); |
889 | dev->stats.rx_dropped++; | 882 | dev->stats.rx_dropped++; |
890 | 883 | ||
891 | /* AKPM: advance bp to the next frame */ | 884 | /* AKPM: advance bp to the next frame */ |
@@ -911,12 +904,11 @@ skip_this_frame: | |||
911 | bp -= lp->dmasize*1024; | 904 | bp -= lp->dmasize*1024; |
912 | lp->rx_dma_ptr = bp; | 905 | lp->rx_dma_ptr = bp; |
913 | 906 | ||
914 | if (net_debug > 3) { | 907 | cs89_dbg(3, info, "%s: received %d byte DMA packet of type %x\n", |
915 | printk("%s: received %d byte DMA packet of type %x\n", | 908 | dev->name, length, |
916 | dev->name, length, | 909 | ((skb->data[ETH_ALEN + ETH_ALEN] << 8) | |
917 | ((skb->data[ETH_ALEN + ETH_ALEN] << 8) | | 910 | skb->data[ETH_ALEN + ETH_ALEN + 1])); |
918 | skb->data[ETH_ALEN + ETH_ALEN + 1])); | 911 | |
919 | } | ||
920 | skb->protocol = eth_type_trans(skb, dev); | 912 | skb->protocol = eth_type_trans(skb, dev); |
921 | netif_rx(skb); | 913 | netif_rx(skb); |
922 | dev->stats.rx_packets++; | 914 | dev->stats.rx_packets++; |
@@ -998,8 +990,7 @@ detect_tp(struct net_device *dev) | |||
998 | int timenow = jiffies; | 990 | int timenow = jiffies; |
999 | int fdx; | 991 | int fdx; |
1000 | 992 | ||
1001 | if (net_debug > 1) | 993 | cs89_dbg(1, debug, "%s: Attempting TP\n", dev->name); |
1002 | printk("%s: Attempting TP\n", dev->name); | ||
1003 | 994 | ||
1004 | /* If connected to another full duplex capable 10-Base-T card | 995 | /* If connected to another full duplex capable 10-Base-T card |
1005 | * the link pulses seem to be lost when the auto detect bit in | 996 | * the link pulses seem to be lost when the auto detect bit in |
@@ -1023,7 +1014,8 @@ detect_tp(struct net_device *dev) | |||
1023 | switch (lp->force & 0xf0) { | 1014 | switch (lp->force & 0xf0) { |
1024 | #if 0 | 1015 | #if 0 |
1025 | case FORCE_AUTO: | 1016 | case FORCE_AUTO: |
1026 | printk("%s: cs8900 doesn't autonegotiate\n", dev->name); | 1017 | pr_info("%s: cs8900 doesn't autonegotiate\n", |
1018 | dev->name); | ||
1027 | return DETECTED_NONE; | 1019 | return DETECTED_NONE; |
1028 | #endif | 1020 | #endif |
1029 | /* CS8900 doesn't support AUTO, change to HALF*/ | 1021 | /* CS8900 doesn't support AUTO, change to HALF*/ |
@@ -1102,18 +1094,15 @@ send_test_pkt(struct net_device *dev) | |||
1102 | /* Write the contents of the packet */ | 1094 | /* Write the contents of the packet */ |
1103 | writewords(lp, TX_FRAME_PORT, test_packet, (ETH_ZLEN + 1) >> 1); | 1095 | writewords(lp, TX_FRAME_PORT, test_packet, (ETH_ZLEN + 1) >> 1); |
1104 | 1096 | ||
1105 | if (net_debug > 1) | 1097 | cs89_dbg(1, debug, "Sending test packet "); |
1106 | printk("Sending test packet "); | ||
1107 | /* wait a couple of jiffies for packet to be received */ | 1098 | /* wait a couple of jiffies for packet to be received */ |
1108 | for (timenow = jiffies; jiffies - timenow < 3;) | 1099 | for (timenow = jiffies; jiffies - timenow < 3;) |
1109 | ; | 1100 | ; |
1110 | if ((readreg(dev, PP_TxEvent) & TX_SEND_OK_BITS) == TX_OK) { | 1101 | if ((readreg(dev, PP_TxEvent) & TX_SEND_OK_BITS) == TX_OK) { |
1111 | if (net_debug > 1) | 1102 | cs89_dbg(1, cont, "succeeded\n"); |
1112 | printk("succeeded\n"); | ||
1113 | return 1; | 1103 | return 1; |
1114 | } | 1104 | } |
1115 | if (net_debug > 1) | 1105 | cs89_dbg(1, cont, "failed\n"); |
1116 | printk("failed\n"); | ||
1117 | return 0; | 1106 | return 0; |
1118 | } | 1107 | } |
1119 | 1108 | ||
@@ -1123,8 +1112,7 @@ detect_aui(struct net_device *dev) | |||
1123 | { | 1112 | { |
1124 | struct net_local *lp = netdev_priv(dev); | 1113 | struct net_local *lp = netdev_priv(dev); |
1125 | 1114 | ||
1126 | if (net_debug > 1) | 1115 | cs89_dbg(1, debug, "%s: Attempting AUI\n", dev->name); |
1127 | printk("%s: Attempting AUI\n", dev->name); | ||
1128 | control_dc_dc(dev, 0); | 1116 | control_dc_dc(dev, 0); |
1129 | 1117 | ||
1130 | writereg(dev, PP_LineCTL, (lp->linectl & ~AUTO_AUI_10BASET) | AUI_ONLY); | 1118 | writereg(dev, PP_LineCTL, (lp->linectl & ~AUTO_AUI_10BASET) | AUI_ONLY); |
@@ -1140,8 +1128,7 @@ detect_bnc(struct net_device *dev) | |||
1140 | { | 1128 | { |
1141 | struct net_local *lp = netdev_priv(dev); | 1129 | struct net_local *lp = netdev_priv(dev); |
1142 | 1130 | ||
1143 | if (net_debug > 1) | 1131 | cs89_dbg(1, debug, "%s: Attempting BNC\n", dev->name); |
1144 | printk("%s: Attempting BNC\n", dev->name); | ||
1145 | control_dc_dc(dev, 1); | 1132 | control_dc_dc(dev, 1); |
1146 | 1133 | ||
1147 | writereg(dev, PP_LineCTL, (lp->linectl & ~AUTO_AUI_10BASET) | AUI_ONLY); | 1134 | writereg(dev, PP_LineCTL, (lp->linectl & ~AUTO_AUI_10BASET) | AUI_ONLY); |
@@ -1255,12 +1242,10 @@ net_open(struct net_device *dev) | |||
1255 | dev->name, lp->dmasize); | 1242 | dev->name, lp->dmasize); |
1256 | goto release_irq; | 1243 | goto release_irq; |
1257 | } | 1244 | } |
1258 | if (net_debug > 1) { | 1245 | cs89_dbg(1, debug, "%s: dma %lx %lx\n", |
1259 | printk("%s: dma %lx %lx\n", | 1246 | dev->name, |
1260 | dev->name, | 1247 | (unsigned long)lp->dma_buff, |
1261 | (unsigned long)lp->dma_buff, | 1248 | (unsigned long)isa_virt_to_bus(lp->dma_buff)); |
1262 | (unsigned long)isa_virt_to_bus(lp->dma_buff)); | ||
1263 | } | ||
1264 | if ((unsigned long)lp->dma_buff >= MAX_DMA_ADDRESS || | 1249 | if ((unsigned long)lp->dma_buff >= MAX_DMA_ADDRESS || |
1265 | !dma_page_eq(lp->dma_buff, | 1250 | !dma_page_eq(lp->dma_buff, |
1266 | lp->dma_buff + lp->dmasize * 1024 - 1)) { | 1251 | lp->dma_buff + lp->dmasize * 1024 - 1)) { |
@@ -1442,8 +1427,7 @@ release_irq: | |||
1442 | #endif | 1427 | #endif |
1443 | )); | 1428 | )); |
1444 | netif_start_queue(dev); | 1429 | netif_start_queue(dev); |
1445 | if (net_debug > 1) | 1430 | cs89_dbg(1, debug, "net_open() succeeded\n"); |
1446 | printk("cs89x0: net_open() succeeded\n"); | ||
1447 | return 0; | 1431 | return 0; |
1448 | bad_out: | 1432 | bad_out: |
1449 | return ret; | 1433 | return ret; |
@@ -1453,10 +1437,9 @@ static void net_timeout(struct net_device *dev) | |||
1453 | { | 1437 | { |
1454 | /* If we get here, some higher level has decided we are broken. | 1438 | /* If we get here, some higher level has decided we are broken. |
1455 | There should really be a "kick me" function call instead. */ | 1439 | There should really be a "kick me" function call instead. */ |
1456 | if (net_debug > 0) | 1440 | cs89_dbg(0, err, "%s: transmit timed out, %s?\n", |
1457 | printk("%s: transmit timed out, %s?\n", | 1441 | dev->name, |
1458 | dev->name, | 1442 | tx_done(dev) ? "IRQ conflict" : "network cable problem"); |
1459 | tx_done(dev) ? "IRQ conflict" : "network cable problem"); | ||
1460 | /* Try to restart the adaptor. */ | 1443 | /* Try to restart the adaptor. */ |
1461 | netif_wake_queue(dev); | 1444 | netif_wake_queue(dev); |
1462 | } | 1445 | } |
@@ -1466,12 +1449,10 @@ static netdev_tx_t net_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
1466 | struct net_local *lp = netdev_priv(dev); | 1449 | struct net_local *lp = netdev_priv(dev); |
1467 | unsigned long flags; | 1450 | unsigned long flags; |
1468 | 1451 | ||
1469 | if (net_debug > 3) { | 1452 | cs89_dbg(3, debug, "%s: sent %d byte packet of type %x\n", |
1470 | printk("%s: sent %d byte packet of type %x\n", | 1453 | dev->name, skb->len, |
1471 | dev->name, skb->len, | 1454 | ((skb->data[ETH_ALEN + ETH_ALEN] << 8) | |
1472 | ((skb->data[ETH_ALEN + ETH_ALEN] << 8) | | 1455 | skb->data[ETH_ALEN + ETH_ALEN + 1])); |
1473 | skb->data[ETH_ALEN + ETH_ALEN + 1])); | ||
1474 | } | ||
1475 | 1456 | ||
1476 | /* keep the upload from being interrupted, since we | 1457 | /* keep the upload from being interrupted, since we |
1477 | * ask the chip to start transmitting before the | 1458 | * ask the chip to start transmitting before the |
@@ -1492,8 +1473,7 @@ static netdev_tx_t net_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
1492 | */ | 1473 | */ |
1493 | 1474 | ||
1494 | spin_unlock_irqrestore(&lp->lock, flags); | 1475 | spin_unlock_irqrestore(&lp->lock, flags); |
1495 | if (net_debug) | 1476 | cs89_dbg(0, err, "Tx buffer not free!\n"); |
1496 | printk("cs89x0: Tx buffer not free!\n"); | ||
1497 | return NETDEV_TX_BUSY; | 1477 | return NETDEV_TX_BUSY; |
1498 | } | 1478 | } |
1499 | /* Write the contents of the packet */ | 1479 | /* Write the contents of the packet */ |
@@ -1537,8 +1517,7 @@ static irqreturn_t net_interrupt(int irq, void *dev_id) | |||
1537 | * vista, baby! | 1517 | * vista, baby! |
1538 | */ | 1518 | */ |
1539 | while ((status = ioread16(lp->virt_addr + ISQ_PORT))) { | 1519 | while ((status = ioread16(lp->virt_addr + ISQ_PORT))) { |
1540 | if (net_debug > 4) | 1520 | cs89_dbg(4, debug, "%s: event=%04x\n", dev->name, status); |
1541 | printk("%s: event=%04x\n", dev->name, status); | ||
1542 | handled = 1; | 1521 | handled = 1; |
1543 | switch (status & ISQ_EVENT_MASK) { | 1522 | switch (status & ISQ_EVENT_MASK) { |
1544 | case ISQ_RECEIVER_EVENT: | 1523 | case ISQ_RECEIVER_EVENT: |
@@ -1576,9 +1555,8 @@ static irqreturn_t net_interrupt(int irq, void *dev_id) | |||
1576 | netif_wake_queue(dev); /* Inform upper layers. */ | 1555 | netif_wake_queue(dev); /* Inform upper layers. */ |
1577 | } | 1556 | } |
1578 | if (status & TX_UNDERRUN) { | 1557 | if (status & TX_UNDERRUN) { |
1579 | if (net_debug > 0) | 1558 | cs89_dbg(0, err, "%s: transmit underrun\n", |
1580 | printk("%s: transmit underrun\n", | 1559 | dev->name); |
1581 | dev->name); | ||
1582 | lp->send_underrun++; | 1560 | lp->send_underrun++; |
1583 | if (lp->send_underrun == 3) | 1561 | if (lp->send_underrun == 3) |
1584 | lp->send_cmd = TX_AFTER_381; | 1562 | lp->send_cmd = TX_AFTER_381; |
@@ -1596,18 +1574,20 @@ static irqreturn_t net_interrupt(int irq, void *dev_id) | |||
1596 | if (lp->use_dma && (status & RX_DMA)) { | 1574 | if (lp->use_dma && (status & RX_DMA)) { |
1597 | int count = readreg(dev, PP_DmaFrameCnt); | 1575 | int count = readreg(dev, PP_DmaFrameCnt); |
1598 | while (count) { | 1576 | while (count) { |
1599 | if (net_debug > 5) | 1577 | cs89_dbg(5, debug, |
1600 | printk("%s: receiving %d DMA frames\n", | 1578 | "%s: receiving %d DMA frames\n", |
1601 | dev->name, count); | 1579 | dev->name, count); |
1602 | if (net_debug > 2 && count > 1) | 1580 | if (count > 1) |
1603 | printk("%s: receiving %d DMA frames\n", | 1581 | cs89_dbg(2, debug, |
1604 | dev->name, count); | 1582 | "%s: receiving %d DMA frames\n", |
1583 | dev->name, count); | ||
1605 | dma_rx(dev); | 1584 | dma_rx(dev); |
1606 | if (--count == 0) | 1585 | if (--count == 0) |
1607 | count = readreg(dev, PP_DmaFrameCnt); | 1586 | count = readreg(dev, PP_DmaFrameCnt); |
1608 | if (net_debug > 2 && count > 0) | 1587 | if (count > 0) |
1609 | printk("%s: continuing with %d DMA frames\n", | 1588 | cs89_dbg(2, debug, |
1610 | dev->name, count); | 1589 | "%s: continuing with %d DMA frames\n", |
1590 | dev->name, count); | ||
1611 | } | 1591 | } |
1612 | } | 1592 | } |
1613 | #endif | 1593 | #endif |
@@ -1669,12 +1649,10 @@ net_rx(struct net_device *dev) | |||
1669 | if (length & 1) | 1649 | if (length & 1) |
1670 | skb->data[length-1] = ioread16(lp->virt_addr + RX_FRAME_PORT); | 1650 | skb->data[length-1] = ioread16(lp->virt_addr + RX_FRAME_PORT); |
1671 | 1651 | ||
1672 | if (net_debug > 3) { | 1652 | cs89_dbg(3, debug, "%s: received %d byte packet of type %x\n", |
1673 | printk("%s: received %d byte packet of type %x\n", | 1653 | dev->name, length, |
1674 | dev->name, length, | 1654 | (skb->data[ETH_ALEN + ETH_ALEN] << 8) | |
1675 | (skb->data[ETH_ALEN + ETH_ALEN] << 8) | | 1655 | skb->data[ETH_ALEN + ETH_ALEN + 1]); |
1676 | skb->data[ETH_ALEN + ETH_ALEN + 1]); | ||
1677 | } | ||
1678 | 1656 | ||
1679 | skb->protocol = eth_type_trans(skb, dev); | 1657 | skb->protocol = eth_type_trans(skb, dev); |
1680 | netif_rx(skb); | 1658 | netif_rx(skb); |
@@ -1778,9 +1756,8 @@ static int set_mac_address(struct net_device *dev, void *p) | |||
1778 | 1756 | ||
1779 | memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); | 1757 | memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); |
1780 | 1758 | ||
1781 | if (net_debug) | 1759 | cs89_dbg(0, debug, "%s: Setting MAC address to %pM\n", |
1782 | printk("%s: Setting MAC address to %pM\n", | 1760 | dev->name, dev->dev_addr); |
1783 | dev->name, dev->dev_addr); | ||
1784 | 1761 | ||
1785 | /* set the Ethernet address */ | 1762 | /* set the Ethernet address */ |
1786 | for (i = 0; i < ETH_ALEN / 2; i++) | 1763 | for (i = 0; i < ETH_ALEN / 2; i++) |