aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb/smsc95xx.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2010-02-17 05:30:24 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-17 16:35:41 -0500
commita475f603d23392f386e45cf377b17c30ed3bbb80 (patch)
tree47e3377f1a1bf402f33dbddc4e14768e2a9881ec /drivers/net/usb/smsc95xx.c
parent60b86755929e1a7e9038c8d860a8491cfdf8d93a (diff)
drivers/net/usb: Use netif_<level> logging facilities
Convert from: if (netif_msg_<foo>(priv)) dev_<level>(dev... to netif_<level>(priv, foo, dev... Also convert a few: if (i < REG_TIMEOUT) { etc... return ret; } to if (i >= REG_TIMEOUT) goto fail; etc... return ret; Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb/smsc95xx.c')
-rw-r--r--drivers/net/usb/smsc95xx.c99
1 files changed, 40 insertions, 59 deletions
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index d4cbcefbff38..1ada51eb71f7 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -376,13 +376,11 @@ static void smsc95xx_set_multicast(struct net_device *netdev)
376 spin_lock_irqsave(&pdata->mac_cr_lock, flags); 376 spin_lock_irqsave(&pdata->mac_cr_lock, flags);
377 377
378 if (dev->net->flags & IFF_PROMISC) { 378 if (dev->net->flags & IFF_PROMISC) {
379 if (netif_msg_drv(dev)) 379 netif_dbg(dev, drv, dev->net, "promiscuous mode enabled\n");
380 netdev_dbg(dev->net, "promiscuous mode enabled\n");
381 pdata->mac_cr |= MAC_CR_PRMS_; 380 pdata->mac_cr |= MAC_CR_PRMS_;
382 pdata->mac_cr &= ~(MAC_CR_MCPAS_ | MAC_CR_HPFILT_); 381 pdata->mac_cr &= ~(MAC_CR_MCPAS_ | MAC_CR_HPFILT_);
383 } else if (dev->net->flags & IFF_ALLMULTI) { 382 } else if (dev->net->flags & IFF_ALLMULTI) {
384 if (netif_msg_drv(dev)) 383 netif_dbg(dev, drv, dev->net, "receive all multicast enabled\n");
385 netdev_dbg(dev->net, "receive all multicast enabled\n");
386 pdata->mac_cr |= MAC_CR_MCPAS_; 384 pdata->mac_cr |= MAC_CR_MCPAS_;
387 pdata->mac_cr &= ~(MAC_CR_PRMS_ | MAC_CR_HPFILT_); 385 pdata->mac_cr &= ~(MAC_CR_PRMS_ | MAC_CR_HPFILT_);
388 } else if (!netdev_mc_empty(dev->net)) { 386 } else if (!netdev_mc_empty(dev->net)) {
@@ -410,12 +408,10 @@ static void smsc95xx_set_multicast(struct net_device *netdev)
410 if (count != ((u32) netdev_mc_count(dev->net))) 408 if (count != ((u32) netdev_mc_count(dev->net)))
411 netdev_warn(dev->net, "mc_count != dev->mc_count\n"); 409 netdev_warn(dev->net, "mc_count != dev->mc_count\n");
412 410
413 if (netif_msg_drv(dev)) 411 netif_dbg(dev, drv, dev->net, "HASHH=0x%08X, HASHL=0x%08X\n",
414 netdev_dbg(dev->net, "HASHH=0x%08X, HASHL=0x%08X\n",
415 hash_hi, hash_lo); 412 hash_hi, hash_lo);
416 } else { 413 } else {
417 if (netif_msg_drv(dev)) 414 netif_dbg(dev, drv, dev->net, "receive own packets only\n");
418 netdev_dbg(dev->net, "receive own packets only\n");
419 pdata->mac_cr &= 415 pdata->mac_cr &=
420 ~(MAC_CR_PRMS_ | MAC_CR_MCPAS_ | MAC_CR_HPFILT_); 416 ~(MAC_CR_PRMS_ | MAC_CR_MCPAS_ | MAC_CR_HPFILT_);
421 } 417 }
@@ -452,13 +448,11 @@ static void smsc95xx_phy_update_flowcontrol(struct usbnet *dev, u8 duplex,
452 else 448 else
453 afc_cfg &= ~0xF; 449 afc_cfg &= ~0xF;
454 450
455 if (netif_msg_link(dev)) 451 netif_dbg(dev, link, dev->net, "rx pause %s, tx pause %s\n",
456 netdev_dbg(dev->net, "rx pause %s, tx pause %s\n",
457 cap & FLOW_CTRL_RX ? "enabled" : "disabled", 452 cap & FLOW_CTRL_RX ? "enabled" : "disabled",
458 cap & FLOW_CTRL_TX ? "enabled" : "disabled"); 453 cap & FLOW_CTRL_TX ? "enabled" : "disabled");
459 } else { 454 } else {
460 if (netif_msg_link(dev)) 455 netif_dbg(dev, link, dev->net, "half duplex\n");
461 netdev_dbg(dev->net, "half duplex\n");
462 flow = 0; 456 flow = 0;
463 afc_cfg |= 0xF; 457 afc_cfg |= 0xF;
464 } 458 }
@@ -486,9 +480,8 @@ static int smsc95xx_link_reset(struct usbnet *dev)
486 lcladv = smsc95xx_mdio_read(dev->net, mii->phy_id, MII_ADVERTISE); 480 lcladv = smsc95xx_mdio_read(dev->net, mii->phy_id, MII_ADVERTISE);
487 rmtadv = smsc95xx_mdio_read(dev->net, mii->phy_id, MII_LPA); 481 rmtadv = smsc95xx_mdio_read(dev->net, mii->phy_id, MII_LPA);
488 482
489 if (netif_msg_link(dev)) 483 netif_dbg(dev, link, dev->net, "speed: %d duplex: %d lcladv: %04x rmtadv: %04x\n",
490 netdev_dbg(dev->net, "speed: %d duplex: %d lcladv: %04x rmtadv: %04x\n", 484 ecmd.speed, ecmd.duplex, lcladv, rmtadv);
491 ecmd.speed, ecmd.duplex, lcladv, rmtadv);
492 485
493 spin_lock_irqsave(&pdata->mac_cr_lock, flags); 486 spin_lock_irqsave(&pdata->mac_cr_lock, flags);
494 if (ecmd.duplex != DUPLEX_FULL) { 487 if (ecmd.duplex != DUPLEX_FULL) {
@@ -520,8 +513,7 @@ static void smsc95xx_status(struct usbnet *dev, struct urb *urb)
520 memcpy(&intdata, urb->transfer_buffer, 4); 513 memcpy(&intdata, urb->transfer_buffer, 4);
521 le32_to_cpus(&intdata); 514 le32_to_cpus(&intdata);
522 515
523 if (netif_msg_link(dev)) 516 netif_dbg(dev, link, dev->net, "intdata: 0x%08X\n", intdata);
524 netdev_dbg(dev->net, "intdata: 0x%08X\n", intdata);
525 517
526 if (intdata & INT_ENP_PHY_INT_) 518 if (intdata & INT_ENP_PHY_INT_)
527 usbnet_defer_kevent(dev, EVENT_LINK_RESET); 519 usbnet_defer_kevent(dev, EVENT_LINK_RESET);
@@ -557,8 +549,7 @@ static int smsc95xx_set_csums(struct usbnet *dev)
557 return ret; 549 return ret;
558 } 550 }
559 551
560 if (netif_msg_hw(dev)) 552 netif_dbg(dev, hw, dev->net, "COE_CR = 0x%08x\n", read_buf);
561 netdev_dbg(dev->net, "COE_CR = 0x%08x\n", read_buf);
562 return 0; 553 return 0;
563} 554}
564 555
@@ -662,16 +653,14 @@ static void smsc95xx_init_mac_address(struct usbnet *dev)
662 dev->net->dev_addr) == 0) { 653 dev->net->dev_addr) == 0) {
663 if (is_valid_ether_addr(dev->net->dev_addr)) { 654 if (is_valid_ether_addr(dev->net->dev_addr)) {
664 /* eeprom values are valid so use them */ 655 /* eeprom values are valid so use them */
665 if (netif_msg_ifup(dev)) 656 netif_dbg(dev, ifup, dev->net, "MAC address read from EEPROM\n");
666 netdev_dbg(dev->net, "MAC address read from EEPROM\n");
667 return; 657 return;
668 } 658 }
669 } 659 }
670 660
671 /* no eeprom, or eeprom values are invalid. generate random MAC */ 661 /* no eeprom, or eeprom values are invalid. generate random MAC */
672 random_ether_addr(dev->net->dev_addr); 662 random_ether_addr(dev->net->dev_addr);
673 if (netif_msg_ifup(dev)) 663 netif_dbg(dev, ifup, dev->net, "MAC address set to random_ether_addr\n");
674 netdev_dbg(dev->net, "MAC address set to random_ether_addr\n");
675} 664}
676 665
677static int smsc95xx_set_mac_address(struct usbnet *dev) 666static int smsc95xx_set_mac_address(struct usbnet *dev)
@@ -750,8 +739,7 @@ static int smsc95xx_phy_initialize(struct usbnet *dev)
750 PHY_INT_MASK_DEFAULT_); 739 PHY_INT_MASK_DEFAULT_);
751 mii_nway_restart(&dev->mii); 740 mii_nway_restart(&dev->mii);
752 741
753 if (netif_msg_ifup(dev)) 742 netif_dbg(dev, ifup, dev->net, "phy initialised successfully\n");
754 netdev_dbg(dev->net, "phy initialised successfully\n");
755 return 0; 743 return 0;
756} 744}
757 745
@@ -762,8 +750,7 @@ static int smsc95xx_reset(struct usbnet *dev)
762 u32 read_buf, write_buf, burst_cap; 750 u32 read_buf, write_buf, burst_cap;
763 int ret = 0, timeout; 751 int ret = 0, timeout;
764 752
765 if (netif_msg_ifup(dev)) 753 netif_dbg(dev, ifup, dev->net, "entering smsc95xx_reset\n");
766 netdev_dbg(dev->net, "entering smsc95xx_reset\n");
767 754
768 write_buf = HW_CFG_LRST_; 755 write_buf = HW_CFG_LRST_;
769 ret = smsc95xx_write_reg(dev, HW_CFG, write_buf); 756 ret = smsc95xx_write_reg(dev, HW_CFG, write_buf);
@@ -818,8 +805,8 @@ static int smsc95xx_reset(struct usbnet *dev)
818 if (ret < 0) 805 if (ret < 0)
819 return ret; 806 return ret;
820 807
821 if (netif_msg_ifup(dev)) 808 netif_dbg(dev, ifup, dev->net,
822 netdev_dbg(dev->net, "MAC Address: %pM\n", dev->net->dev_addr); 809 "MAC Address: %pM\n", dev->net->dev_addr);
823 810
824 ret = smsc95xx_read_reg(dev, HW_CFG, &read_buf); 811 ret = smsc95xx_read_reg(dev, HW_CFG, &read_buf);
825 if (ret < 0) { 812 if (ret < 0) {
@@ -827,8 +814,8 @@ static int smsc95xx_reset(struct usbnet *dev)
827 return ret; 814 return ret;
828 } 815 }
829 816
830 if (netif_msg_ifup(dev)) 817 netif_dbg(dev, ifup, dev->net,
831 netdev_dbg(dev->net, "Read Value from HW_CFG : 0x%08x\n", read_buf); 818 "Read Value from HW_CFG : 0x%08x\n", read_buf);
832 819
833 read_buf |= HW_CFG_BIR_; 820 read_buf |= HW_CFG_BIR_;
834 821
@@ -844,9 +831,9 @@ static int smsc95xx_reset(struct usbnet *dev)
844 netdev_warn(dev->net, "Failed to read HW_CFG: %d\n", ret); 831 netdev_warn(dev->net, "Failed to read HW_CFG: %d\n", ret);
845 return ret; 832 return ret;
846 } 833 }
847 if (netif_msg_ifup(dev)) 834 netif_dbg(dev, ifup, dev->net,
848 netdev_dbg(dev->net, "Read Value from HW_CFG after writing HW_CFG_BIR_: 0x%08x\n", 835 "Read Value from HW_CFG after writing HW_CFG_BIR_: 0x%08x\n",
849 read_buf); 836 read_buf);
850 837
851 if (!turbo_mode) { 838 if (!turbo_mode) {
852 burst_cap = 0; 839 burst_cap = 0;
@@ -859,8 +846,8 @@ static int smsc95xx_reset(struct usbnet *dev)
859 dev->rx_urb_size = DEFAULT_FS_BURST_CAP_SIZE; 846 dev->rx_urb_size = DEFAULT_FS_BURST_CAP_SIZE;
860 } 847 }
861 848
862 if (netif_msg_ifup(dev)) 849 netif_dbg(dev, ifup, dev->net,
863 netdev_dbg(dev->net, "rx_urb_size=%ld\n", (ulong)dev->rx_urb_size); 850 "rx_urb_size=%ld\n", (ulong)dev->rx_urb_size);
864 851
865 ret = smsc95xx_write_reg(dev, BURST_CAP, burst_cap); 852 ret = smsc95xx_write_reg(dev, BURST_CAP, burst_cap);
866 if (ret < 0) { 853 if (ret < 0) {
@@ -873,9 +860,9 @@ static int smsc95xx_reset(struct usbnet *dev)
873 netdev_warn(dev->net, "Failed to read BURST_CAP: %d\n", ret); 860 netdev_warn(dev->net, "Failed to read BURST_CAP: %d\n", ret);
874 return ret; 861 return ret;
875 } 862 }
876 if (netif_msg_ifup(dev)) 863 netif_dbg(dev, ifup, dev->net,
877 netdev_dbg(dev->net, "Read Value from BURST_CAP after writing: 0x%08x\n", 864 "Read Value from BURST_CAP after writing: 0x%08x\n",
878 read_buf); 865 read_buf);
879 866
880 read_buf = DEFAULT_BULK_IN_DELAY; 867 read_buf = DEFAULT_BULK_IN_DELAY;
881 ret = smsc95xx_write_reg(dev, BULK_IN_DLY, read_buf); 868 ret = smsc95xx_write_reg(dev, BULK_IN_DLY, read_buf);
@@ -889,17 +876,17 @@ static int smsc95xx_reset(struct usbnet *dev)
889 netdev_warn(dev->net, "Failed to read BULK_IN_DLY: %d\n", ret); 876 netdev_warn(dev->net, "Failed to read BULK_IN_DLY: %d\n", ret);
890 return ret; 877 return ret;
891 } 878 }
892 if (netif_msg_ifup(dev)) 879 netif_dbg(dev, ifup, dev->net,
893 netdev_dbg(dev->net, "Read Value from BULK_IN_DLY after writing: 0x%08x\n", 880 "Read Value from BULK_IN_DLY after writing: 0x%08x\n",
894 read_buf); 881 read_buf);
895 882
896 ret = smsc95xx_read_reg(dev, HW_CFG, &read_buf); 883 ret = smsc95xx_read_reg(dev, HW_CFG, &read_buf);
897 if (ret < 0) { 884 if (ret < 0) {
898 netdev_warn(dev->net, "Failed to read HW_CFG: %d\n", ret); 885 netdev_warn(dev->net, "Failed to read HW_CFG: %d\n", ret);
899 return ret; 886 return ret;
900 } 887 }
901 if (netif_msg_ifup(dev)) 888 netif_dbg(dev, ifup, dev->net,
902 netdev_dbg(dev->net, "Read Value from HW_CFG: 0x%08x\n", read_buf); 889 "Read Value from HW_CFG: 0x%08x\n", read_buf);
903 890
904 if (turbo_mode) 891 if (turbo_mode)
905 read_buf |= (HW_CFG_MEF_ | HW_CFG_BCE_); 892 read_buf |= (HW_CFG_MEF_ | HW_CFG_BCE_);
@@ -921,9 +908,8 @@ static int smsc95xx_reset(struct usbnet *dev)
921 netdev_warn(dev->net, "Failed to read HW_CFG: %d\n", ret); 908 netdev_warn(dev->net, "Failed to read HW_CFG: %d\n", ret);
922 return ret; 909 return ret;
923 } 910 }
924 if (netif_msg_ifup(dev)) 911 netif_dbg(dev, ifup, dev->net,
925 netdev_dbg(dev->net, "Read Value from HW_CFG after writing: 0x%08x\n", 912 "Read Value from HW_CFG after writing: 0x%08x\n", read_buf);
926 read_buf);
927 913
928 write_buf = 0xFFFFFFFF; 914 write_buf = 0xFFFFFFFF;
929 ret = smsc95xx_write_reg(dev, INT_STS, write_buf); 915 ret = smsc95xx_write_reg(dev, INT_STS, write_buf);
@@ -938,8 +924,7 @@ static int smsc95xx_reset(struct usbnet *dev)
938 netdev_warn(dev->net, "Failed to read ID_REV: %d\n", ret); 924 netdev_warn(dev->net, "Failed to read ID_REV: %d\n", ret);
939 return ret; 925 return ret;
940 } 926 }
941 if (netif_msg_ifup(dev)) 927 netif_dbg(dev, ifup, dev->net, "ID_REV = 0x%08x\n", read_buf);
942 netdev_dbg(dev->net, "ID_REV = 0x%08x\n", read_buf);
943 928
944 /* Configure GPIO pins as LED outputs */ 929 /* Configure GPIO pins as LED outputs */
945 write_buf = LED_GPIO_CFG_SPD_LED | LED_GPIO_CFG_LNK_LED | 930 write_buf = LED_GPIO_CFG_SPD_LED | LED_GPIO_CFG_LNK_LED |
@@ -1013,8 +998,7 @@ static int smsc95xx_reset(struct usbnet *dev)
1013 smsc95xx_start_tx_path(dev); 998 smsc95xx_start_tx_path(dev);
1014 smsc95xx_start_rx_path(dev); 999 smsc95xx_start_rx_path(dev);
1015 1000
1016 if (netif_msg_ifup(dev)) 1001 netif_dbg(dev, ifup, dev->net, "smsc95xx_reset, return 0\n");
1017 netdev_dbg(dev->net, "smsc95xx_reset, return 0\n");
1018 return 0; 1002 return 0;
1019} 1003}
1020 1004
@@ -1071,8 +1055,7 @@ static void smsc95xx_unbind(struct usbnet *dev, struct usb_interface *intf)
1071{ 1055{
1072 struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]); 1056 struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
1073 if (pdata) { 1057 if (pdata) {
1074 if (netif_msg_ifdown(dev)) 1058 netif_dbg(dev, ifdown, dev->net, "free pdata\n");
1075 netdev_dbg(dev->net, "free pdata\n");
1076 kfree(pdata); 1059 kfree(pdata);
1077 pdata = NULL; 1060 pdata = NULL;
1078 dev->data[0] = 0; 1061 dev->data[0] = 0;
@@ -1106,9 +1089,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
1106 align_count = (4 - ((size + NET_IP_ALIGN) % 4)) % 4; 1089 align_count = (4 - ((size + NET_IP_ALIGN) % 4)) % 4;
1107 1090
1108 if (unlikely(header & RX_STS_ES_)) { 1091 if (unlikely(header & RX_STS_ES_)) {
1109 if (netif_msg_rx_err(dev)) 1092 netif_dbg(dev, rx_err, dev->net,
1110 netdev_dbg(dev->net, "Error header=0x%08x\n", 1093 "Error header=0x%08x\n", header);
1111 header);
1112 dev->net->stats.rx_errors++; 1094 dev->net->stats.rx_errors++;
1113 dev->net->stats.rx_dropped++; 1095 dev->net->stats.rx_dropped++;
1114 1096
@@ -1125,9 +1107,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
1125 } else { 1107 } else {
1126 /* ETH_FRAME_LEN + 4(CRC) + 2(COE) + 4(Vlan) */ 1108 /* ETH_FRAME_LEN + 4(CRC) + 2(COE) + 4(Vlan) */
1127 if (unlikely(size > (ETH_FRAME_LEN + 12))) { 1109 if (unlikely(size > (ETH_FRAME_LEN + 12))) {
1128 if (netif_msg_rx_err(dev)) 1110 netif_dbg(dev, rx_err, dev->net,
1129 netdev_dbg(dev->net, "size err header=0x%08x\n", 1111 "size err header=0x%08x\n", header);
1130 header);
1131 return 0; 1112 return 0;
1132 } 1113 }
1133 1114