diff options
author | Ben Boeckel <mathstuf@gmail.com> | 2013-11-01 08:53:30 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-11-02 01:19:24 -0400 |
commit | 3ee307dee23ec8aa103f76fc80aba6b6904f3add (patch) | |
tree | e79e702453641208b43babe19fbecf25867e790b | |
parent | 90df06b8a224b79965d67cf049bb07d7e2c46745 (diff) |
epic100: replace printk with netdev_ calls
Also snipes some whitespace errors.
Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/smsc/epic100.c | 125 |
1 files changed, 58 insertions, 67 deletions
diff --git a/drivers/net/ethernet/smsc/epic100.c b/drivers/net/ethernet/smsc/epic100.c index 8c5c24a16f8a..8ae1f8a7bf38 100644 --- a/drivers/net/ethernet/smsc/epic100.c +++ b/drivers/net/ethernet/smsc/epic100.c | |||
@@ -91,9 +91,9 @@ static int rx_copybreak; | |||
91 | 91 | ||
92 | /* These identify the driver base version and may not be removed. */ | 92 | /* These identify the driver base version and may not be removed. */ |
93 | static char version[] = | 93 | static char version[] = |
94 | DRV_NAME ".c:v1.11 1/7/2001 Written by Donald Becker <becker@scyld.com>\n"; | 94 | DRV_NAME ".c:v1.11 1/7/2001 Written by Donald Becker <becker@scyld.com>"; |
95 | static char version2[] = | 95 | static char version2[] = |
96 | " (unofficial 2.4.x kernel port, version " DRV_VERSION ", " DRV_RELDATE ")\n"; | 96 | " (unofficial 2.4.x kernel port, version " DRV_VERSION ", " DRV_RELDATE ")"; |
97 | 97 | ||
98 | MODULE_AUTHOR("Donald Becker <becker@scyld.com>"); | 98 | MODULE_AUTHOR("Donald Becker <becker@scyld.com>"); |
99 | MODULE_DESCRIPTION("SMC 83c170 EPIC series Ethernet driver"); | 99 | MODULE_DESCRIPTION("SMC 83c170 EPIC series Ethernet driver"); |
@@ -332,9 +332,7 @@ static int epic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
332 | 332 | ||
333 | /* when built into the kernel, we only print version if device is found */ | 333 | /* when built into the kernel, we only print version if device is found */ |
334 | #ifndef MODULE | 334 | #ifndef MODULE |
335 | static int printed_version; | 335 | pr_info_once("%s%s\n", version, version2); |
336 | if (!printed_version++) | ||
337 | printk(KERN_INFO "%s%s", version, version2); | ||
338 | #endif | 336 | #endif |
339 | 337 | ||
340 | card_idx++; | 338 | card_idx++; |
@@ -423,9 +421,9 @@ static int epic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
423 | ((__le16 *)dev->dev_addr)[i] = cpu_to_le16(er16(LAN0 + i*4)); | 421 | ((__le16 *)dev->dev_addr)[i] = cpu_to_le16(er16(LAN0 + i*4)); |
424 | 422 | ||
425 | if (debug > 2) { | 423 | if (debug > 2) { |
426 | dev_printk(KERN_DEBUG, &pdev->dev, "EEPROM contents:\n"); | 424 | dev_dbg(&pdev->dev, "EEPROM contents:\n"); |
427 | for (i = 0; i < 64; i++) | 425 | for (i = 0; i < 64; i++) |
428 | printk(" %4.4x%s", read_eeprom(ep, i), | 426 | pr_cont(" %4.4x%s", read_eeprom(ep, i), |
429 | i % 16 == 15 ? "\n" : ""); | 427 | i % 16 == 15 ? "\n" : ""); |
430 | } | 428 | } |
431 | 429 | ||
@@ -490,10 +488,10 @@ static int epic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
490 | if (ret < 0) | 488 | if (ret < 0) |
491 | goto err_out_unmap_rx; | 489 | goto err_out_unmap_rx; |
492 | 490 | ||
493 | printk(KERN_INFO "%s: %s at %lx, IRQ %d, %pM\n", | 491 | netdev_info(dev, "%s at %lx, IRQ %d, %pM\n", |
494 | dev->name, pci_id_tbl[chip_idx].name, | 492 | pci_id_tbl[chip_idx].name, |
495 | (long)pci_resource_start(pdev, EPIC_BAR), pdev->irq, | 493 | (long)pci_resource_start(pdev, EPIC_BAR), pdev->irq, |
496 | dev->dev_addr); | 494 | dev->dev_addr); |
497 | 495 | ||
498 | out: | 496 | out: |
499 | return ret; | 497 | return ret; |
@@ -703,9 +701,8 @@ static int epic_open(struct net_device *dev) | |||
703 | mdio_write(dev, ep->phys[0], MII_BMCR, media2miictl[dev->if_port&15]); | 701 | mdio_write(dev, ep->phys[0], MII_BMCR, media2miictl[dev->if_port&15]); |
704 | if (dev->if_port == 1) { | 702 | if (dev->if_port == 1) { |
705 | if (debug > 1) | 703 | if (debug > 1) |
706 | printk(KERN_INFO "%s: Using the 10base2 transceiver, MII " | 704 | netdev_info(dev, "Using the 10base2 transceiver, MII status %4.4x.\n", |
707 | "status %4.4x.\n", | 705 | mdio_read(dev, ep->phys[0], MII_BMSR)); |
708 | dev->name, mdio_read(dev, ep->phys[0], MII_BMSR)); | ||
709 | } | 706 | } |
710 | } else { | 707 | } else { |
711 | int mii_lpa = mdio_read(dev, ep->phys[0], MII_LPA); | 708 | int mii_lpa = mdio_read(dev, ep->phys[0], MII_LPA); |
@@ -715,10 +712,10 @@ static int epic_open(struct net_device *dev) | |||
715 | else if (! (mii_lpa & LPA_LPACK)) | 712 | else if (! (mii_lpa & LPA_LPACK)) |
716 | mdio_write(dev, ep->phys[0], MII_BMCR, BMCR_ANENABLE|BMCR_ANRESTART); | 713 | mdio_write(dev, ep->phys[0], MII_BMCR, BMCR_ANENABLE|BMCR_ANRESTART); |
717 | if (debug > 1) | 714 | if (debug > 1) |
718 | printk(KERN_INFO "%s: Setting %s-duplex based on MII xcvr %d" | 715 | netdev_info(dev, "Setting %s-duplex based on MII xcvr %d register read of %4.4x.\n", |
719 | " register read of %4.4x.\n", dev->name, | 716 | ep->mii.full_duplex ? "full" |
720 | ep->mii.full_duplex ? "full" : "half", | 717 | : "half", |
721 | ep->phys[0], mii_lpa); | 718 | ep->phys[0], mii_lpa); |
722 | } | 719 | } |
723 | } | 720 | } |
724 | 721 | ||
@@ -738,10 +735,9 @@ static int epic_open(struct net_device *dev) | |||
738 | TxUnderrun); | 735 | TxUnderrun); |
739 | 736 | ||
740 | if (debug > 1) { | 737 | if (debug > 1) { |
741 | printk(KERN_DEBUG "%s: epic_open() ioaddr %p IRQ %d " | 738 | netdev_dbg(dev, "epic_open() ioaddr %p IRQ %d status %4.4x %s-duplex.\n", |
742 | "status %4.4x %s-duplex.\n", | 739 | ioaddr, irq, er32(GENCTL), |
743 | dev->name, ioaddr, irq, er32(GENCTL), | 740 | ep->mii.full_duplex ? "full" : "half"); |
744 | ep->mii.full_duplex ? "full" : "half"); | ||
745 | } | 741 | } |
746 | 742 | ||
747 | /* Set the timer to switch to check for link beat and perhaps switch | 743 | /* Set the timer to switch to check for link beat and perhaps switch |
@@ -790,8 +786,8 @@ static void epic_restart(struct net_device *dev) | |||
790 | /* Soft reset the chip. */ | 786 | /* Soft reset the chip. */ |
791 | ew32(GENCTL, 0x4001); | 787 | ew32(GENCTL, 0x4001); |
792 | 788 | ||
793 | printk(KERN_DEBUG "%s: Restarting the EPIC chip, Rx %d/%d Tx %d/%d.\n", | 789 | netdev_dbg(dev, "Restarting the EPIC chip, Rx %d/%d Tx %d/%d.\n", |
794 | dev->name, ep->cur_rx, ep->dirty_rx, ep->dirty_tx, ep->cur_tx); | 790 | ep->cur_rx, ep->dirty_rx, ep->dirty_tx, ep->cur_tx); |
795 | udelay(1); | 791 | udelay(1); |
796 | 792 | ||
797 | /* This magic is documented in SMSC app note 7.15 */ | 793 | /* This magic is documented in SMSC app note 7.15 */ |
@@ -827,9 +823,8 @@ static void epic_restart(struct net_device *dev) | |||
827 | ((ep->chip_flags & TYPE2_INTR) ? PCIBusErr175 : PCIBusErr170) | | 823 | ((ep->chip_flags & TYPE2_INTR) ? PCIBusErr175 : PCIBusErr170) | |
828 | TxUnderrun); | 824 | TxUnderrun); |
829 | 825 | ||
830 | printk(KERN_DEBUG "%s: epic_restart() done, cmd status %4.4x, ctl %4.4x" | 826 | netdev_dbg(dev, "epic_restart() done, cmd status %4.4x, ctl %4.4x interrupt %4.4x.\n", |
831 | " interrupt %4.4x.\n", | 827 | er32(COMMAND), er32(GENCTL), er32(INTSTAT)); |
832 | dev->name, er32(COMMAND), er32(GENCTL), er32(INTSTAT)); | ||
833 | } | 828 | } |
834 | 829 | ||
835 | static void check_media(struct net_device *dev) | 830 | static void check_media(struct net_device *dev) |
@@ -846,9 +841,9 @@ static void check_media(struct net_device *dev) | |||
846 | return; | 841 | return; |
847 | if (ep->mii.full_duplex != duplex) { | 842 | if (ep->mii.full_duplex != duplex) { |
848 | ep->mii.full_duplex = duplex; | 843 | ep->mii.full_duplex = duplex; |
849 | printk(KERN_INFO "%s: Setting %s-duplex based on MII #%d link" | 844 | netdev_info(dev, "Setting %s-duplex based on MII #%d link partner capability of %4.4x.\n", |
850 | " partner capability of %4.4x.\n", dev->name, | 845 | ep->mii.full_duplex ? "full" : "half", |
851 | ep->mii.full_duplex ? "full" : "half", ep->phys[0], mii_lpa); | 846 | ep->phys[0], mii_lpa); |
852 | ew32(TxCtrl, ep->mii.full_duplex ? 0x7F : 0x79); | 847 | ew32(TxCtrl, ep->mii.full_duplex ? 0x7F : 0x79); |
853 | } | 848 | } |
854 | } | 849 | } |
@@ -861,11 +856,10 @@ static void epic_timer(unsigned long data) | |||
861 | int next_tick = 5*HZ; | 856 | int next_tick = 5*HZ; |
862 | 857 | ||
863 | if (debug > 3) { | 858 | if (debug > 3) { |
864 | printk(KERN_DEBUG "%s: Media monitor tick, Tx status %8.8x.\n", | 859 | netdev_dbg(dev, "Media monitor tick, Tx status %8.8x.\n", |
865 | dev->name, er32(TxSTAT)); | 860 | er32(TxSTAT)); |
866 | printk(KERN_DEBUG "%s: Other registers are IntMask %4.4x " | 861 | netdev_dbg(dev, "Other registers are IntMask %4.4x IntStatus %4.4x RxStatus %4.4x.\n", |
867 | "IntStatus %4.4x RxStatus %4.4x.\n", dev->name, | 862 | er32(INTMASK), er32(INTSTAT), er32(RxSTAT)); |
868 | er32(INTMASK), er32(INTSTAT), er32(RxSTAT)); | ||
869 | } | 863 | } |
870 | 864 | ||
871 | check_media(dev); | 865 | check_media(dev); |
@@ -880,11 +874,11 @@ static void epic_tx_timeout(struct net_device *dev) | |||
880 | void __iomem *ioaddr = ep->ioaddr; | 874 | void __iomem *ioaddr = ep->ioaddr; |
881 | 875 | ||
882 | if (debug > 0) { | 876 | if (debug > 0) { |
883 | printk(KERN_WARNING "%s: Transmit timeout using MII device, " | 877 | netdev_warn(dev, "Transmit timeout using MII device, Tx status %4.4x.\n", |
884 | "Tx status %4.4x.\n", dev->name, er16(TxSTAT)); | 878 | er16(TxSTAT)); |
885 | if (debug > 1) { | 879 | if (debug > 1) { |
886 | printk(KERN_DEBUG "%s: Tx indices: dirty_tx %d, cur_tx %d.\n", | 880 | netdev_dbg(dev, "Tx indices: dirty_tx %d, cur_tx %d.\n", |
887 | dev->name, ep->dirty_tx, ep->cur_tx); | 881 | ep->dirty_tx, ep->cur_tx); |
888 | } | 882 | } |
889 | } | 883 | } |
890 | if (er16(TxSTAT) & 0x10) { /* Tx FIFO underflow. */ | 884 | if (er16(TxSTAT) & 0x10) { /* Tx FIFO underflow. */ |
@@ -994,9 +988,8 @@ static netdev_tx_t epic_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
994 | ew32(COMMAND, TxQueued); | 988 | ew32(COMMAND, TxQueued); |
995 | 989 | ||
996 | if (debug > 4) | 990 | if (debug > 4) |
997 | printk(KERN_DEBUG "%s: Queued Tx packet size %d to slot %d, " | 991 | netdev_dbg(dev, "Queued Tx packet size %d to slot %d, flag %2.2x Tx status %8.8x.\n", |
998 | "flag %2.2x Tx status %8.8x.\n", dev->name, skb->len, | 992 | skb->len, entry, ctrl_word, er32(TxSTAT)); |
999 | entry, ctrl_word, er32(TxSTAT)); | ||
1000 | 993 | ||
1001 | return NETDEV_TX_OK; | 994 | return NETDEV_TX_OK; |
1002 | } | 995 | } |
@@ -1009,8 +1002,8 @@ static void epic_tx_error(struct net_device *dev, struct epic_private *ep, | |||
1009 | #ifndef final_version | 1002 | #ifndef final_version |
1010 | /* There was an major error, log it. */ | 1003 | /* There was an major error, log it. */ |
1011 | if (debug > 1) | 1004 | if (debug > 1) |
1012 | printk(KERN_DEBUG "%s: Transmit error, Tx status %8.8x.\n", | 1005 | netdev_dbg(dev, "Transmit error, Tx status %8.8x.\n", |
1013 | dev->name, status); | 1006 | status); |
1014 | #endif | 1007 | #endif |
1015 | stats->tx_errors++; | 1008 | stats->tx_errors++; |
1016 | if (status & 0x1050) | 1009 | if (status & 0x1050) |
@@ -1057,9 +1050,8 @@ static void epic_tx(struct net_device *dev, struct epic_private *ep) | |||
1057 | 1050 | ||
1058 | #ifndef final_version | 1051 | #ifndef final_version |
1059 | if (cur_tx - dirty_tx > TX_RING_SIZE) { | 1052 | if (cur_tx - dirty_tx > TX_RING_SIZE) { |
1060 | printk(KERN_WARNING | 1053 | netdev_warn(dev, "Out-of-sync dirty pointer, %d vs. %d, full=%d.\n", |
1061 | "%s: Out-of-sync dirty pointer, %d vs. %d, full=%d.\n", | 1054 | dirty_tx, cur_tx, ep->tx_full); |
1062 | dev->name, dirty_tx, cur_tx, ep->tx_full); | ||
1063 | dirty_tx += TX_RING_SIZE; | 1055 | dirty_tx += TX_RING_SIZE; |
1064 | } | 1056 | } |
1065 | #endif | 1057 | #endif |
@@ -1086,8 +1078,8 @@ static irqreturn_t epic_interrupt(int irq, void *dev_instance) | |||
1086 | ew32(INTSTAT, status & EpicNormalEvent); | 1078 | ew32(INTSTAT, status & EpicNormalEvent); |
1087 | 1079 | ||
1088 | if (debug > 4) { | 1080 | if (debug > 4) { |
1089 | printk(KERN_DEBUG "%s: Interrupt, status=%#8.8x new " | 1081 | netdev_dbg(dev, "Interrupt, status=%#8.8x new intstat=%#8.8x.\n", |
1090 | "intstat=%#8.8x.\n", dev->name, status, er32(INTSTAT)); | 1082 | status, er32(INTSTAT)); |
1091 | } | 1083 | } |
1092 | 1084 | ||
1093 | if ((status & IntrSummary) == 0) | 1085 | if ((status & IntrSummary) == 0) |
@@ -1125,8 +1117,8 @@ static irqreturn_t epic_interrupt(int irq, void *dev_instance) | |||
1125 | ew32(COMMAND, RestartTx); | 1117 | ew32(COMMAND, RestartTx); |
1126 | } | 1118 | } |
1127 | if (status & PCIBusErr170) { | 1119 | if (status & PCIBusErr170) { |
1128 | printk(KERN_ERR "%s: PCI Bus Error! status %4.4x.\n", | 1120 | netdev_err(dev, "PCI Bus Error! status %4.4x.\n", |
1129 | dev->name, status); | 1121 | status); |
1130 | epic_pause(dev); | 1122 | epic_pause(dev); |
1131 | epic_restart(dev); | 1123 | epic_restart(dev); |
1132 | } | 1124 | } |
@@ -1136,8 +1128,8 @@ static irqreturn_t epic_interrupt(int irq, void *dev_instance) | |||
1136 | 1128 | ||
1137 | out: | 1129 | out: |
1138 | if (debug > 3) { | 1130 | if (debug > 3) { |
1139 | printk(KERN_DEBUG "%s: exit interrupt, intr_status=%#4.4x.\n", | 1131 | netdev_dbg(dev, "exit interrupt, intr_status=%#4.4x.\n", |
1140 | dev->name, status); | 1132 | status); |
1141 | } | 1133 | } |
1142 | 1134 | ||
1143 | return IRQ_RETVAL(handled); | 1135 | return IRQ_RETVAL(handled); |
@@ -1151,7 +1143,7 @@ static int epic_rx(struct net_device *dev, int budget) | |||
1151 | int work_done = 0; | 1143 | int work_done = 0; |
1152 | 1144 | ||
1153 | if (debug > 4) | 1145 | if (debug > 4) |
1154 | printk(KERN_DEBUG " In epic_rx(), entry %d %8.8x.\n", entry, | 1146 | netdev_dbg(dev, " In epic_rx(), entry %d %8.8x.\n", entry, |
1155 | ep->rx_ring[entry].rxstatus); | 1147 | ep->rx_ring[entry].rxstatus); |
1156 | 1148 | ||
1157 | if (rx_work_limit > budget) | 1149 | if (rx_work_limit > budget) |
@@ -1162,16 +1154,17 @@ static int epic_rx(struct net_device *dev, int budget) | |||
1162 | int status = ep->rx_ring[entry].rxstatus; | 1154 | int status = ep->rx_ring[entry].rxstatus; |
1163 | 1155 | ||
1164 | if (debug > 4) | 1156 | if (debug > 4) |
1165 | printk(KERN_DEBUG " epic_rx() status was %8.8x.\n", status); | 1157 | netdev_dbg(dev, " epic_rx() status was %8.8x.\n", |
1158 | status); | ||
1166 | if (--rx_work_limit < 0) | 1159 | if (--rx_work_limit < 0) |
1167 | break; | 1160 | break; |
1168 | if (status & 0x2006) { | 1161 | if (status & 0x2006) { |
1169 | if (debug > 2) | 1162 | if (debug > 2) |
1170 | printk(KERN_DEBUG "%s: epic_rx() error status was %8.8x.\n", | 1163 | netdev_dbg(dev, "epic_rx() error status was %8.8x.\n", |
1171 | dev->name, status); | 1164 | status); |
1172 | if (status & 0x2000) { | 1165 | if (status & 0x2000) { |
1173 | printk(KERN_WARNING "%s: Oversized Ethernet frame spanned " | 1166 | netdev_warn(dev, "Oversized Ethernet frame spanned multiple buffers, status %4.4x!\n", |
1174 | "multiple buffers, status %4.4x!\n", dev->name, status); | 1167 | status); |
1175 | dev->stats.rx_length_errors++; | 1168 | dev->stats.rx_length_errors++; |
1176 | } else if (status & 0x0006) | 1169 | } else if (status & 0x0006) |
1177 | /* Rx Frame errors are counted in hardware. */ | 1170 | /* Rx Frame errors are counted in hardware. */ |
@@ -1183,9 +1176,8 @@ static int epic_rx(struct net_device *dev, int budget) | |||
1183 | struct sk_buff *skb; | 1176 | struct sk_buff *skb; |
1184 | 1177 | ||
1185 | if (pkt_len > PKT_BUF_SZ - 4) { | 1178 | if (pkt_len > PKT_BUF_SZ - 4) { |
1186 | printk(KERN_ERR "%s: Oversized Ethernet frame, status %x " | 1179 | netdev_err(dev, "Oversized Ethernet frame, status %x %d bytes.\n", |
1187 | "%d bytes.\n", | 1180 | status, pkt_len); |
1188 | dev->name, status, pkt_len); | ||
1189 | pkt_len = 1514; | 1181 | pkt_len = 1514; |
1190 | } | 1182 | } |
1191 | /* Check if the packet is long enough to accept without copying | 1183 | /* Check if the packet is long enough to accept without copying |
@@ -1305,8 +1297,8 @@ static int epic_close(struct net_device *dev) | |||
1305 | napi_disable(&ep->napi); | 1297 | napi_disable(&ep->napi); |
1306 | 1298 | ||
1307 | if (debug > 1) | 1299 | if (debug > 1) |
1308 | printk(KERN_DEBUG "%s: Shutting down ethercard, status was %2.2x.\n", | 1300 | netdev_dbg(dev, "Shutting down ethercard, status was %2.2x.\n", |
1309 | dev->name, er32(INTSTAT)); | 1301 | er32(INTSTAT)); |
1310 | 1302 | ||
1311 | del_timer_sync(&ep->timer); | 1303 | del_timer_sync(&ep->timer); |
1312 | 1304 | ||
@@ -1324,7 +1316,7 @@ static int epic_close(struct net_device *dev) | |||
1324 | ep->rx_ring[i].buflength = 0; | 1316 | ep->rx_ring[i].buflength = 0; |
1325 | if (skb) { | 1317 | if (skb) { |
1326 | pci_unmap_single(pdev, ep->rx_ring[i].bufaddr, | 1318 | pci_unmap_single(pdev, ep->rx_ring[i].bufaddr, |
1327 | ep->rx_buf_sz, PCI_DMA_FROMDEVICE); | 1319 | ep->rx_buf_sz, PCI_DMA_FROMDEVICE); |
1328 | dev_kfree_skb(skb); | 1320 | dev_kfree_skb(skb); |
1329 | } | 1321 | } |
1330 | ep->rx_ring[i].bufaddr = 0xBADF00D0; /* An invalid address. */ | 1322 | ep->rx_ring[i].bufaddr = 0xBADF00D0; /* An invalid address. */ |
@@ -1587,8 +1579,7 @@ static int __init epic_init (void) | |||
1587 | { | 1579 | { |
1588 | /* when a module, this is printed whether or not devices are found in probe */ | 1580 | /* when a module, this is printed whether or not devices are found in probe */ |
1589 | #ifdef MODULE | 1581 | #ifdef MODULE |
1590 | printk (KERN_INFO "%s%s", | 1582 | pr_info("%s%s\n", version, version2); |
1591 | version, version2); | ||
1592 | #endif | 1583 | #endif |
1593 | 1584 | ||
1594 | return pci_register_driver(&epic_driver); | 1585 | return pci_register_driver(&epic_driver); |