aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tulip/de2104x.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2011-05-09 05:45:21 -0400
committerDavid S. Miller <davem@davemloft.net>2011-05-09 15:51:15 -0400
commit163ef0b5922b14751e93218bdf2c9fe8f74b9c9d (patch)
tree9a4179070e26d63170ec005e1f9ffff48b0e541b /drivers/net/tulip/de2104x.c
parent54668b84bd2ee808e6b43ed9bd7aa3338fa95857 (diff)
tulip: Convert printks to netdev_<level>
Use the current more descriptive logging styles. Add pr_fmt and remove PFX where appropriate. Use netif_<level>, netdev_<level> Indent a few blocks in xircom_cb where appropriate. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tulip/de2104x.c')
-rw-r--r--drivers/net/tulip/de2104x.c139
1 files changed, 63 insertions, 76 deletions
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c
index 46d5a1b15036..62883a0b0618 100644
--- a/drivers/net/tulip/de2104x.c
+++ b/drivers/net/tulip/de2104x.c
@@ -27,6 +27,8 @@
27 27
28 */ 28 */
29 29
30#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
31
30#define DRV_NAME "de2104x" 32#define DRV_NAME "de2104x"
31#define DRV_VERSION "0.7" 33#define DRV_VERSION "0.7"
32#define DRV_RELDATE "Mar 17, 2004" 34#define DRV_RELDATE "Mar 17, 2004"
@@ -73,8 +75,6 @@ static int rx_copybreak = 100;
73module_param (rx_copybreak, int, 0); 75module_param (rx_copybreak, int, 0);
74MODULE_PARM_DESC (rx_copybreak, "de2104x Breakpoint at which Rx packets are copied"); 76MODULE_PARM_DESC (rx_copybreak, "de2104x Breakpoint at which Rx packets are copied");
75 77
76#define PFX DRV_NAME ": "
77
78#define DE_DEF_MSG_ENABLE (NETIF_MSG_DRV | \ 78#define DE_DEF_MSG_ENABLE (NETIF_MSG_DRV | \
79 NETIF_MSG_PROBE | \ 79 NETIF_MSG_PROBE | \
80 NETIF_MSG_LINK | \ 80 NETIF_MSG_LINK | \
@@ -377,18 +377,16 @@ static u16 t21041_csr15[] = { 0x0008, 0x0006, 0x000E, 0x0008, 0x0008, };
377static void de_rx_err_acct (struct de_private *de, unsigned rx_tail, 377static void de_rx_err_acct (struct de_private *de, unsigned rx_tail,
378 u32 status, u32 len) 378 u32 status, u32 len)
379{ 379{
380 if (netif_msg_rx_err (de)) 380 netif_printk(de, rx_err, KERN_DEBUG, de->dev,
381 printk (KERN_DEBUG 381 "rx err, slot %d status 0x%x len %d\n",
382 "%s: rx err, slot %d status 0x%x len %d\n", 382 rx_tail, status, len);
383 de->dev->name, rx_tail, status, len);
384 383
385 if ((status & 0x38000300) != 0x0300) { 384 if ((status & 0x38000300) != 0x0300) {
386 /* Ingore earlier buffers. */ 385 /* Ingore earlier buffers. */
387 if ((status & 0xffff) != 0x7fff) { 386 if ((status & 0xffff) != 0x7fff) {
388 if (netif_msg_rx_err(de)) 387 netif_warn(de, rx_err, de->dev,
389 dev_warn(&de->dev->dev, 388 "Oversized Ethernet frame spanned multiple buffers, status %08x!\n",
390 "Oversized Ethernet frame spanned multiple buffers, status %08x!\n", 389 status);
391 status);
392 de->net_stats.rx_length_errors++; 390 de->net_stats.rx_length_errors++;
393 } 391 }
394 } else if (status & RxError) { 392 } else if (status & RxError) {
@@ -491,7 +489,7 @@ rx_next:
491 } 489 }
492 490
493 if (!rx_work) 491 if (!rx_work)
494 dev_warn(&de->dev->dev, "rx work limit reached\n"); 492 netdev_warn(de->dev, "rx work limit reached\n");
495 493
496 de->rx_tail = rx_tail; 494 de->rx_tail = rx_tail;
497} 495}
@@ -534,9 +532,9 @@ static irqreturn_t de_interrupt (int irq, void *dev_instance)
534 532
535 pci_read_config_word(de->pdev, PCI_STATUS, &pci_status); 533 pci_read_config_word(de->pdev, PCI_STATUS, &pci_status);
536 pci_write_config_word(de->pdev, PCI_STATUS, pci_status); 534 pci_write_config_word(de->pdev, PCI_STATUS, pci_status);
537 dev_err(&de->dev->dev, 535 netdev_err(de->dev,
538 "PCI bus error, status=%08x, PCI status=%04x\n", 536 "PCI bus error, status=%08x, PCI status=%04x\n",
539 status, pci_status); 537 status, pci_status);
540 } 538 }
541 539
542 return IRQ_HANDLED; 540 return IRQ_HANDLED;
@@ -873,7 +871,7 @@ static void de_stop_rxtx (struct de_private *de)
873 udelay(100); 871 udelay(100);
874 } 872 }
875 873
876 dev_warn(&de->dev->dev, "timeout expired stopping DMA\n"); 874 netdev_warn(de->dev, "timeout expired, stopping DMA\n");
877} 875}
878 876
879static inline void de_start_rxtx (struct de_private *de) 877static inline void de_start_rxtx (struct de_private *de)
@@ -907,9 +905,8 @@ static void de_link_up(struct de_private *de)
907{ 905{
908 if (!netif_carrier_ok(de->dev)) { 906 if (!netif_carrier_ok(de->dev)) {
909 netif_carrier_on(de->dev); 907 netif_carrier_on(de->dev);
910 if (netif_msg_link(de)) 908 netif_info(de, link, de->dev, "link up, media %s\n",
911 dev_info(&de->dev->dev, "link up, media %s\n", 909 media_name[de->media_type]);
912 media_name[de->media_type]);
913 } 910 }
914} 911}
915 912
@@ -917,8 +914,7 @@ static void de_link_down(struct de_private *de)
917{ 914{
918 if (netif_carrier_ok(de->dev)) { 915 if (netif_carrier_ok(de->dev)) {
919 netif_carrier_off(de->dev); 916 netif_carrier_off(de->dev);
920 if (netif_msg_link(de)) 917 netif_info(de, link, de->dev, "link down\n");
921 dev_info(&de->dev->dev, "link down\n");
922 } 918 }
923} 919}
924 920
@@ -928,8 +924,7 @@ static void de_set_media (struct de_private *de)
928 u32 macmode = dr32(MacMode); 924 u32 macmode = dr32(MacMode);
929 925
930 if (de_is_running(de)) 926 if (de_is_running(de))
931 dev_warn(&de->dev->dev, 927 netdev_warn(de->dev, "chip is running while changing media!\n");
932 "chip is running while changing media!\n");
933 928
934 if (de->de21040) 929 if (de->de21040)
935 dw32(CSR11, FULL_DUPLEX_MAGIC); 930 dw32(CSR11, FULL_DUPLEX_MAGIC);
@@ -948,18 +943,13 @@ static void de_set_media (struct de_private *de)
948 else 943 else
949 macmode &= ~FullDuplex; 944 macmode &= ~FullDuplex;
950 945
951 if (netif_msg_link(de)) 946 netif_info(de, link, de->dev, "set link %s\n", media_name[media]);
952 dev_info(&de->dev->dev, "set link %s\n", media_name[media]); 947 netif_info(de, hw, de->dev, "mode 0x%x, sia 0x%x,0x%x,0x%x,0x%x\n",
953 if (netif_msg_hw(de)) { 948 dr32(MacMode), dr32(SIAStatus),
954 dev_info(&de->dev->dev, "mode 0x%x, sia 0x%x,0x%x,0x%x,0x%x\n", 949 dr32(CSR13), dr32(CSR14), dr32(CSR15));
955 dr32(MacMode), dr32(SIAStatus), 950 netif_info(de, hw, de->dev, "set mode 0x%x, set sia 0x%x,0x%x,0x%x\n",
956 dr32(CSR13), dr32(CSR14), dr32(CSR15)); 951 macmode, de->media[media].csr13,
957 952 de->media[media].csr14, de->media[media].csr15);
958 dev_info(&de->dev->dev,
959 "set mode 0x%x, set sia 0x%x,0x%x,0x%x\n",
960 macmode, de->media[media].csr13,
961 de->media[media].csr14, de->media[media].csr15);
962 }
963 if (macmode != dr32(MacMode)) 953 if (macmode != dr32(MacMode))
964 dw32(MacMode, macmode); 954 dw32(MacMode, macmode);
965} 955}
@@ -996,9 +986,8 @@ static void de21040_media_timer (unsigned long data)
996 if (!netif_carrier_ok(dev)) 986 if (!netif_carrier_ok(dev))
997 de_link_up(de); 987 de_link_up(de);
998 else 988 else
999 if (netif_msg_timer(de)) 989 netif_info(de, timer, dev, "%s link ok, status %x\n",
1000 dev_info(&dev->dev, "%s link ok, status %x\n", 990 media_name[de->media_type], status);
1001 media_name[de->media_type], status);
1002 return; 991 return;
1003 } 992 }
1004 993
@@ -1025,9 +1014,8 @@ no_link_yet:
1025 de->media_timer.expires = jiffies + DE_TIMER_NO_LINK; 1014 de->media_timer.expires = jiffies + DE_TIMER_NO_LINK;
1026 add_timer(&de->media_timer); 1015 add_timer(&de->media_timer);
1027 1016
1028 if (netif_msg_timer(de)) 1017 netif_info(de, timer, dev, "no link, trying media %s, status %x\n",
1029 dev_info(&dev->dev, "no link, trying media %s, status %x\n", 1018 media_name[de->media_type], status);
1030 media_name[de->media_type], status);
1031} 1019}
1032 1020
1033static unsigned int de_ok_to_advertise (struct de_private *de, u32 new_media) 1021static unsigned int de_ok_to_advertise (struct de_private *de, u32 new_media)
@@ -1085,11 +1073,10 @@ static void de21041_media_timer (unsigned long data)
1085 if (!netif_carrier_ok(dev)) 1073 if (!netif_carrier_ok(dev))
1086 de_link_up(de); 1074 de_link_up(de);
1087 else 1075 else
1088 if (netif_msg_timer(de)) 1076 netif_info(de, timer, dev,
1089 dev_info(&dev->dev, 1077 "%s link ok, mode %x status %x\n",
1090 "%s link ok, mode %x status %x\n", 1078 media_name[de->media_type],
1091 media_name[de->media_type], 1079 dr32(MacMode), status);
1092 dr32(MacMode), status);
1093 return; 1080 return;
1094 } 1081 }
1095 1082
@@ -1163,9 +1150,8 @@ no_link_yet:
1163 de->media_timer.expires = jiffies + DE_TIMER_NO_LINK; 1150 de->media_timer.expires = jiffies + DE_TIMER_NO_LINK;
1164 add_timer(&de->media_timer); 1151 add_timer(&de->media_timer);
1165 1152
1166 if (netif_msg_timer(de)) 1153 netif_info(de, timer, dev, "no link, trying media %s, status %x\n",
1167 dev_info(&dev->dev, "no link, trying media %s, status %x\n", 1154 media_name[de->media_type], status);
1168 media_name[de->media_type], status);
1169} 1155}
1170 1156
1171static void de_media_interrupt (struct de_private *de, u32 status) 1157static void de_media_interrupt (struct de_private *de, u32 status)
@@ -1401,14 +1387,13 @@ static int de_open (struct net_device *dev)
1401 struct de_private *de = netdev_priv(dev); 1387 struct de_private *de = netdev_priv(dev);
1402 int rc; 1388 int rc;
1403 1389
1404 if (netif_msg_ifup(de)) 1390 netif_printk(de, ifup, KERN_DEBUG, dev, "enabling interface\n");
1405 printk(KERN_DEBUG "%s: enabling interface\n", dev->name);
1406 1391
1407 de->rx_buf_sz = (dev->mtu <= 1500 ? PKT_BUF_SZ : dev->mtu + 32); 1392 de->rx_buf_sz = (dev->mtu <= 1500 ? PKT_BUF_SZ : dev->mtu + 32);
1408 1393
1409 rc = de_alloc_rings(de); 1394 rc = de_alloc_rings(de);
1410 if (rc) { 1395 if (rc) {
1411 dev_err(&dev->dev, "ring allocation failure, err=%d\n", rc); 1396 netdev_err(dev, "ring allocation failure, err=%d\n", rc);
1412 return rc; 1397 return rc;
1413 } 1398 }
1414 1399
@@ -1416,14 +1401,14 @@ static int de_open (struct net_device *dev)
1416 1401
1417 rc = request_irq(dev->irq, de_interrupt, IRQF_SHARED, dev->name, dev); 1402 rc = request_irq(dev->irq, de_interrupt, IRQF_SHARED, dev->name, dev);
1418 if (rc) { 1403 if (rc) {
1419 dev_err(&dev->dev, "IRQ %d request failure, err=%d\n", 1404 netdev_err(dev, "IRQ %d request failure, err=%d\n",
1420 dev->irq, rc); 1405 dev->irq, rc);
1421 goto err_out_free; 1406 goto err_out_free;
1422 } 1407 }
1423 1408
1424 rc = de_init_hw(de); 1409 rc = de_init_hw(de);
1425 if (rc) { 1410 if (rc) {
1426 dev_err(&dev->dev, "h/w init failure, err=%d\n", rc); 1411 netdev_err(dev, "h/w init failure, err=%d\n", rc);
1427 goto err_out_free_irq; 1412 goto err_out_free_irq;
1428 } 1413 }
1429 1414
@@ -1444,8 +1429,7 @@ static int de_close (struct net_device *dev)
1444 struct de_private *de = netdev_priv(dev); 1429 struct de_private *de = netdev_priv(dev);
1445 unsigned long flags; 1430 unsigned long flags;
1446 1431
1447 if (netif_msg_ifdown(de)) 1432 netif_printk(de, ifdown, KERN_DEBUG, dev, "disabling interface\n");
1448 printk(KERN_DEBUG "%s: disabling interface\n", dev->name);
1449 1433
1450 del_timer_sync(&de->media_timer); 1434 del_timer_sync(&de->media_timer);
1451 1435
@@ -1466,9 +1450,10 @@ static void de_tx_timeout (struct net_device *dev)
1466{ 1450{
1467 struct de_private *de = netdev_priv(dev); 1451 struct de_private *de = netdev_priv(dev);
1468 1452
1469 printk(KERN_DEBUG "%s: NIC status %08x mode %08x sia %08x desc %u/%u/%u\n", 1453 netdev_printk(KERN_DEBUG, dev,
1470 dev->name, dr32(MacStatus), dr32(MacMode), dr32(SIAStatus), 1454 "NIC status %08x mode %08x sia %08x desc %u/%u/%u\n",
1471 de->rx_tail, de->tx_head, de->tx_tail); 1455 dr32(MacStatus), dr32(MacMode), dr32(SIAStatus),
1456 de->rx_tail, de->tx_head, de->tx_tail);
1472 1457
1473 del_timer_sync(&de->media_timer); 1458 del_timer_sync(&de->media_timer);
1474 1459
@@ -1693,9 +1678,8 @@ static int de_nway_reset(struct net_device *dev)
1693 1678
1694 status = dr32(SIAStatus); 1679 status = dr32(SIAStatus);
1695 dw32(SIAStatus, (status & ~NWayState) | NWayRestart); 1680 dw32(SIAStatus, (status & ~NWayState) | NWayRestart);
1696 if (netif_msg_link(de)) 1681 netif_info(de, link, dev, "link nway restart, status %x,%x\n",
1697 dev_info(&de->dev->dev, "link nway restart, status %x,%x\n", 1682 status, dr32(SIAStatus));
1698 status, dr32(SIAStatus));
1699 return 0; 1683 return 0;
1700} 1684}
1701 1685
@@ -1740,7 +1724,8 @@ static void __devinit de21040_get_mac_address (struct de_private *de)
1740 de->dev->dev_addr[i] = value; 1724 de->dev->dev_addr[i] = value;
1741 udelay(1); 1725 udelay(1);
1742 if (boguscnt <= 0) 1726 if (boguscnt <= 0)
1743 pr_warning(PFX "timeout reading 21040 MAC address byte %u\n", i); 1727 pr_warn("timeout reading 21040 MAC address byte %u\n",
1728 i);
1744 } 1729 }
1745} 1730}
1746 1731
@@ -1926,8 +1911,10 @@ static void __devinit de21041_get_srom_info (struct de_private *de)
1926 de->media[idx].csr14, 1911 de->media[idx].csr14,
1927 de->media[idx].csr15); 1912 de->media[idx].csr15);
1928 1913
1929 } else if (netif_msg_probe(de)) 1914 } else {
1930 pr_cont("\n"); 1915 if (netif_msg_probe(de))
1916 pr_cont("\n");
1917 }
1931 1918
1932 if (bufp > ((void *)&ee_data[DE_EEPROM_SIZE - 3])) 1919 if (bufp > ((void *)&ee_data[DE_EEPROM_SIZE - 3]))
1933 break; 1920 break;
@@ -2038,7 +2025,7 @@ static int __devinit de_init_one (struct pci_dev *pdev,
2038 /* check for invalid IRQ value */ 2025 /* check for invalid IRQ value */
2039 if (pdev->irq < 2) { 2026 if (pdev->irq < 2) {
2040 rc = -EIO; 2027 rc = -EIO;
2041 pr_err(PFX "invalid irq (%d) for pci dev %s\n", 2028 pr_err("invalid irq (%d) for pci dev %s\n",
2042 pdev->irq, pci_name(pdev)); 2029 pdev->irq, pci_name(pdev));
2043 goto err_out_res; 2030 goto err_out_res;
2044 } 2031 }
@@ -2049,12 +2036,12 @@ static int __devinit de_init_one (struct pci_dev *pdev,
2049 pciaddr = pci_resource_start(pdev, 1); 2036 pciaddr = pci_resource_start(pdev, 1);
2050 if (!pciaddr) { 2037 if (!pciaddr) {
2051 rc = -EIO; 2038 rc = -EIO;
2052 pr_err(PFX "no MMIO resource for pci dev %s\n", pci_name(pdev)); 2039 pr_err("no MMIO resource for pci dev %s\n", pci_name(pdev));
2053 goto err_out_res; 2040 goto err_out_res;
2054 } 2041 }
2055 if (pci_resource_len(pdev, 1) < DE_REGS_SIZE) { 2042 if (pci_resource_len(pdev, 1) < DE_REGS_SIZE) {
2056 rc = -EIO; 2043 rc = -EIO;
2057 pr_err(PFX "MMIO resource (%llx) too small on pci dev %s\n", 2044 pr_err("MMIO resource (%llx) too small on pci dev %s\n",
2058 (unsigned long long)pci_resource_len(pdev, 1), 2045 (unsigned long long)pci_resource_len(pdev, 1),
2059 pci_name(pdev)); 2046 pci_name(pdev));
2060 goto err_out_res; 2047 goto err_out_res;
@@ -2064,7 +2051,7 @@ static int __devinit de_init_one (struct pci_dev *pdev,
2064 regs = ioremap_nocache(pciaddr, DE_REGS_SIZE); 2051 regs = ioremap_nocache(pciaddr, DE_REGS_SIZE);
2065 if (!regs) { 2052 if (!regs) {
2066 rc = -EIO; 2053 rc = -EIO;
2067 pr_err(PFX "Cannot map PCI MMIO (%llx@%lx) on pci dev %s\n", 2054 pr_err("Cannot map PCI MMIO (%llx@%lx) on pci dev %s\n",
2068 (unsigned long long)pci_resource_len(pdev, 1), 2055 (unsigned long long)pci_resource_len(pdev, 1),
2069 pciaddr, pci_name(pdev)); 2056 pciaddr, pci_name(pdev));
2070 goto err_out_res; 2057 goto err_out_res;
@@ -2077,7 +2064,7 @@ static int __devinit de_init_one (struct pci_dev *pdev,
2077 /* make sure hardware is not running */ 2064 /* make sure hardware is not running */
2078 rc = de_reset_mac(de); 2065 rc = de_reset_mac(de);
2079 if (rc) { 2066 if (rc) {
2080 pr_err(PFX "Cannot reset MAC, pci dev %s\n", pci_name(pdev)); 2067 pr_err("Cannot reset MAC, pci dev %s\n", pci_name(pdev));
2081 goto err_out_iomap; 2068 goto err_out_iomap;
2082 } 2069 }
2083 2070
@@ -2097,11 +2084,11 @@ static int __devinit de_init_one (struct pci_dev *pdev,
2097 goto err_out_iomap; 2084 goto err_out_iomap;
2098 2085
2099 /* print info about board and interface just registered */ 2086 /* print info about board and interface just registered */
2100 dev_info(&dev->dev, "%s at 0x%lx, %pM, IRQ %d\n", 2087 netdev_info(dev, "%s at 0x%lx, %pM, IRQ %d\n",
2101 de->de21040 ? "21040" : "21041", 2088 de->de21040 ? "21040" : "21041",
2102 dev->base_addr, 2089 dev->base_addr,
2103 dev->dev_addr, 2090 dev->dev_addr,
2104 dev->irq); 2091 dev->irq);
2105 2092
2106 pci_set_drvdata(pdev, dev); 2093 pci_set_drvdata(pdev, dev);
2107 2094
@@ -2189,7 +2176,7 @@ static int de_resume (struct pci_dev *pdev)
2189 if (!netif_running(dev)) 2176 if (!netif_running(dev))
2190 goto out_attach; 2177 goto out_attach;
2191 if ((retval = pci_enable_device(pdev))) { 2178 if ((retval = pci_enable_device(pdev))) {
2192 dev_err(&dev->dev, "pci_enable_device failed in resume\n"); 2179 netdev_err(dev, "pci_enable_device failed in resume\n");
2193 goto out; 2180 goto out;
2194 } 2181 }
2195 pci_set_master(pdev); 2182 pci_set_master(pdev);