aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2011-03-25 10:21:22 -0400
committerDavid S. Miller <davem@davemloft.net>2011-03-31 00:39:22 -0400
commitdffc6b2432ea89af24a36e8100b3eeea09db67e5 (patch)
tree26220b0d647ca01af227397419732e2e7eb337e5
parente8c37c80006c99a00aa70a783023d616c166a04b (diff)
smsc911x: Use pr_fmt, netdev_<level>, and netif_<level>
Use the more common/verbose logging styles. Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt Remove smsc911x prefixes from format strings. Rename SMSC_WARNING to SMSC_WARN. Remove DPRINTK macro. Use netif_<level> in SMSC_<level> macros. Convert NETIF_MSG_<foo> uses to lower case. Add no_printk verification in non-debug uses. Add pdata to SMSC_<level> uses to avoid hidden variable uses. Convert printks to netdev_<level> as appropriate. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/smsc911x.c292
-rw-r--r--drivers/net/smsc911x.h22
2 files changed, 155 insertions, 159 deletions
diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c
index 1566259c1f27..8b501d53063f 100644
--- a/drivers/net/smsc911x.c
+++ b/drivers/net/smsc911x.c
@@ -29,6 +29,8 @@
29 * 29 *
30 */ 30 */
31 31
32#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
33
32#include <linux/crc32.h> 34#include <linux/crc32.h>
33#include <linux/delay.h> 35#include <linux/delay.h>
34#include <linux/errno.h> 36#include <linux/errno.h>
@@ -248,8 +250,8 @@ static int smsc911x_mac_complete(struct smsc911x_data *pdata)
248 if (!(val & MAC_CSR_CMD_CSR_BUSY_)) 250 if (!(val & MAC_CSR_CMD_CSR_BUSY_))
249 return 0; 251 return 0;
250 } 252 }
251 SMSC_WARNING(HW, "Timed out waiting for MAC not BUSY. " 253 SMSC_WARN(pdata, hw, "Timed out waiting for MAC not BUSY. "
252 "MAC_CSR_CMD: 0x%08X", val); 254 "MAC_CSR_CMD: 0x%08X", val);
253 return -EIO; 255 return -EIO;
254} 256}
255 257
@@ -262,7 +264,7 @@ static u32 smsc911x_mac_read(struct smsc911x_data *pdata, unsigned int offset)
262 264
263 temp = smsc911x_reg_read(pdata, MAC_CSR_CMD); 265 temp = smsc911x_reg_read(pdata, MAC_CSR_CMD);
264 if (unlikely(temp & MAC_CSR_CMD_CSR_BUSY_)) { 266 if (unlikely(temp & MAC_CSR_CMD_CSR_BUSY_)) {
265 SMSC_WARNING(HW, "MAC busy at entry"); 267 SMSC_WARN(pdata, hw, "MAC busy at entry");
266 return 0xFFFFFFFF; 268 return 0xFFFFFFFF;
267 } 269 }
268 270
@@ -277,7 +279,7 @@ static u32 smsc911x_mac_read(struct smsc911x_data *pdata, unsigned int offset)
277 if (likely(smsc911x_mac_complete(pdata) == 0)) 279 if (likely(smsc911x_mac_complete(pdata) == 0))
278 return smsc911x_reg_read(pdata, MAC_CSR_DATA); 280 return smsc911x_reg_read(pdata, MAC_CSR_DATA);
279 281
280 SMSC_WARNING(HW, "MAC busy after read"); 282 SMSC_WARN(pdata, hw, "MAC busy after read");
281 return 0xFFFFFFFF; 283 return 0xFFFFFFFF;
282} 284}
283 285
@@ -291,8 +293,8 @@ static void smsc911x_mac_write(struct smsc911x_data *pdata,
291 293
292 temp = smsc911x_reg_read(pdata, MAC_CSR_CMD); 294 temp = smsc911x_reg_read(pdata, MAC_CSR_CMD);
293 if (unlikely(temp & MAC_CSR_CMD_CSR_BUSY_)) { 295 if (unlikely(temp & MAC_CSR_CMD_CSR_BUSY_)) {
294 SMSC_WARNING(HW, 296 SMSC_WARN(pdata, hw,
295 "smsc911x_mac_write failed, MAC busy at entry"); 297 "smsc911x_mac_write failed, MAC busy at entry");
296 return; 298 return;
297 } 299 }
298 300
@@ -310,8 +312,7 @@ static void smsc911x_mac_write(struct smsc911x_data *pdata,
310 if (likely(smsc911x_mac_complete(pdata) == 0)) 312 if (likely(smsc911x_mac_complete(pdata) == 0))
311 return; 313 return;
312 314
313 SMSC_WARNING(HW, 315 SMSC_WARN(pdata, hw, "smsc911x_mac_write failed, MAC busy after write");
314 "smsc911x_mac_write failed, MAC busy after write");
315} 316}
316 317
317/* Get a phy register */ 318/* Get a phy register */
@@ -326,8 +327,7 @@ static int smsc911x_mii_read(struct mii_bus *bus, int phyaddr, int regidx)
326 327
327 /* Confirm MII not busy */ 328 /* Confirm MII not busy */
328 if (unlikely(smsc911x_mac_read(pdata, MII_ACC) & MII_ACC_MII_BUSY_)) { 329 if (unlikely(smsc911x_mac_read(pdata, MII_ACC) & MII_ACC_MII_BUSY_)) {
329 SMSC_WARNING(HW, 330 SMSC_WARN(pdata, hw, "MII is busy in smsc911x_mii_read???");
330 "MII is busy in smsc911x_mii_read???");
331 reg = -EIO; 331 reg = -EIO;
332 goto out; 332 goto out;
333 } 333 }
@@ -343,7 +343,7 @@ static int smsc911x_mii_read(struct mii_bus *bus, int phyaddr, int regidx)
343 goto out; 343 goto out;
344 } 344 }
345 345
346 SMSC_WARNING(HW, "Timed out waiting for MII read to finish"); 346 SMSC_WARN(pdata, hw, "Timed out waiting for MII read to finish");
347 reg = -EIO; 347 reg = -EIO;
348 348
349out: 349out:
@@ -364,8 +364,7 @@ static int smsc911x_mii_write(struct mii_bus *bus, int phyaddr, int regidx,
364 364
365 /* Confirm MII not busy */ 365 /* Confirm MII not busy */
366 if (unlikely(smsc911x_mac_read(pdata, MII_ACC) & MII_ACC_MII_BUSY_)) { 366 if (unlikely(smsc911x_mac_read(pdata, MII_ACC) & MII_ACC_MII_BUSY_)) {
367 SMSC_WARNING(HW, 367 SMSC_WARN(pdata, hw, "MII is busy in smsc911x_mii_write???");
368 "MII is busy in smsc911x_mii_write???");
369 reg = -EIO; 368 reg = -EIO;
370 goto out; 369 goto out;
371 } 370 }
@@ -385,7 +384,7 @@ static int smsc911x_mii_write(struct mii_bus *bus, int phyaddr, int regidx,
385 goto out; 384 goto out;
386 } 385 }
387 386
388 SMSC_WARNING(HW, "Timed out waiting for MII write to finish"); 387 SMSC_WARN(pdata, hw, "Timed out waiting for MII write to finish");
389 reg = -EIO; 388 reg = -EIO;
390 389
391out: 390out:
@@ -426,18 +425,20 @@ static void smsc911x_phy_initialise_external(struct smsc911x_data *pdata)
426 unsigned int hwcfg = smsc911x_reg_read(pdata, HW_CFG); 425 unsigned int hwcfg = smsc911x_reg_read(pdata, HW_CFG);
427 426
428 if (pdata->config.flags & SMSC911X_FORCE_INTERNAL_PHY) { 427 if (pdata->config.flags & SMSC911X_FORCE_INTERNAL_PHY) {
429 SMSC_TRACE(HW, "Forcing internal PHY"); 428 SMSC_TRACE(pdata, hw, "Forcing internal PHY");
430 pdata->using_extphy = 0; 429 pdata->using_extphy = 0;
431 } else if (pdata->config.flags & SMSC911X_FORCE_EXTERNAL_PHY) { 430 } else if (pdata->config.flags & SMSC911X_FORCE_EXTERNAL_PHY) {
432 SMSC_TRACE(HW, "Forcing external PHY"); 431 SMSC_TRACE(pdata, hw, "Forcing external PHY");
433 smsc911x_phy_enable_external(pdata); 432 smsc911x_phy_enable_external(pdata);
434 pdata->using_extphy = 1; 433 pdata->using_extphy = 1;
435 } else if (hwcfg & HW_CFG_EXT_PHY_DET_) { 434 } else if (hwcfg & HW_CFG_EXT_PHY_DET_) {
436 SMSC_TRACE(HW, "HW_CFG EXT_PHY_DET set, using external PHY"); 435 SMSC_TRACE(pdata, hw,
436 "HW_CFG EXT_PHY_DET set, using external PHY");
437 smsc911x_phy_enable_external(pdata); 437 smsc911x_phy_enable_external(pdata);
438 pdata->using_extphy = 1; 438 pdata->using_extphy = 1;
439 } else { 439 } else {
440 SMSC_TRACE(HW, "HW_CFG EXT_PHY_DET clear, using internal PHY"); 440 SMSC_TRACE(pdata, hw,
441 "HW_CFG EXT_PHY_DET clear, using internal PHY");
441 pdata->using_extphy = 0; 442 pdata->using_extphy = 0;
442 } 443 }
443} 444}
@@ -509,13 +510,13 @@ static int smsc911x_phy_check_loopbackpkt(struct smsc911x_data *pdata)
509 } while ((i--) && (!status)); 510 } while ((i--) && (!status));
510 511
511 if (!status) { 512 if (!status) {
512 SMSC_WARNING(HW, "Failed to transmit " 513 SMSC_WARN(pdata, hw,
513 "during loopback test"); 514 "Failed to transmit during loopback test");
514 continue; 515 continue;
515 } 516 }
516 if (status & TX_STS_ES_) { 517 if (status & TX_STS_ES_) {
517 SMSC_WARNING(HW, "Transmit encountered " 518 SMSC_WARN(pdata, hw,
518 "errors during loopback test"); 519 "Transmit encountered errors during loopback test");
519 continue; 520 continue;
520 } 521 }
521 522
@@ -527,13 +528,13 @@ static int smsc911x_phy_check_loopbackpkt(struct smsc911x_data *pdata)
527 } while ((i--) && (!status)); 528 } while ((i--) && (!status));
528 529
529 if (!status) { 530 if (!status) {
530 SMSC_WARNING(HW, 531 SMSC_WARN(pdata, hw,
531 "Failed to receive during loopback test"); 532 "Failed to receive during loopback test");
532 continue; 533 continue;
533 } 534 }
534 if (status & RX_STS_ES_) { 535 if (status & RX_STS_ES_) {
535 SMSC_WARNING(HW, "Receive encountered " 536 SMSC_WARN(pdata, hw,
536 "errors during loopback test"); 537 "Receive encountered errors during loopback test");
537 continue; 538 continue;
538 } 539 }
539 540
@@ -546,9 +547,9 @@ static int smsc911x_phy_check_loopbackpkt(struct smsc911x_data *pdata)
546 smsc911x_rx_readfifo(pdata, (unsigned int *)bufp, rdsz); 547 smsc911x_rx_readfifo(pdata, (unsigned int *)bufp, rdsz);
547 548
548 if (pktlength != (MIN_PACKET_SIZE + 4)) { 549 if (pktlength != (MIN_PACKET_SIZE + 4)) {
549 SMSC_WARNING(HW, "Unexpected packet size " 550 SMSC_WARN(pdata, hw, "Unexpected packet size "
550 "during loop back test, size=%d, will retry", 551 "during loop back test, size=%d, will retry",
551 pktlength); 552 pktlength);
552 } else { 553 } else {
553 unsigned int j; 554 unsigned int j;
554 int mismatch = 0; 555 int mismatch = 0;
@@ -560,12 +561,12 @@ static int smsc911x_phy_check_loopbackpkt(struct smsc911x_data *pdata)
560 } 561 }
561 } 562 }
562 if (!mismatch) { 563 if (!mismatch) {
563 SMSC_TRACE(HW, "Successfully verified " 564 SMSC_TRACE(pdata, hw, "Successfully verified "
564 "loopback packet"); 565 "loopback packet");
565 return 0; 566 return 0;
566 } else { 567 } else {
567 SMSC_WARNING(HW, "Data mismatch " 568 SMSC_WARN(pdata, hw, "Data mismatch "
568 "during loop back test, will retry"); 569 "during loop back test, will retry");
569 } 570 }
570 } 571 }
571 } 572 }
@@ -582,7 +583,7 @@ static int smsc911x_phy_reset(struct smsc911x_data *pdata)
582 BUG_ON(!phy_dev); 583 BUG_ON(!phy_dev);
583 BUG_ON(!phy_dev->bus); 584 BUG_ON(!phy_dev->bus);
584 585
585 SMSC_TRACE(HW, "Performing PHY BCR Reset"); 586 SMSC_TRACE(pdata, hw, "Performing PHY BCR Reset");
586 smsc911x_mii_write(phy_dev->bus, phy_dev->addr, MII_BMCR, BMCR_RESET); 587 smsc911x_mii_write(phy_dev->bus, phy_dev->addr, MII_BMCR, BMCR_RESET);
587 do { 588 do {
588 msleep(1); 589 msleep(1);
@@ -591,7 +592,7 @@ static int smsc911x_phy_reset(struct smsc911x_data *pdata)
591 } while ((i--) && (temp & BMCR_RESET)); 592 } while ((i--) && (temp & BMCR_RESET));
592 593
593 if (temp & BMCR_RESET) { 594 if (temp & BMCR_RESET) {
594 SMSC_WARNING(HW, "PHY reset failed to complete."); 595 SMSC_WARN(pdata, hw, "PHY reset failed to complete");
595 return -EIO; 596 return -EIO;
596 } 597 }
597 /* Extra delay required because the phy may not be completed with 598 /* Extra delay required because the phy may not be completed with
@@ -695,11 +696,11 @@ static void smsc911x_phy_update_flowcontrol(struct smsc911x_data *pdata)
695 else 696 else
696 afc &= ~0xF; 697 afc &= ~0xF;
697 698
698 SMSC_TRACE(HW, "rx pause %s, tx pause %s", 699 SMSC_TRACE(pdata, hw, "rx pause %s, tx pause %s",
699 (cap & FLOW_CTRL_RX ? "enabled" : "disabled"), 700 (cap & FLOW_CTRL_RX ? "enabled" : "disabled"),
700 (cap & FLOW_CTRL_TX ? "enabled" : "disabled")); 701 (cap & FLOW_CTRL_TX ? "enabled" : "disabled"));
701 } else { 702 } else {
702 SMSC_TRACE(HW, "half duplex"); 703 SMSC_TRACE(pdata, hw, "half duplex");
703 flow = 0; 704 flow = 0;
704 afc |= 0xF; 705 afc |= 0xF;
705 } 706 }
@@ -722,17 +723,17 @@ static void smsc911x_phy_adjust_link(struct net_device *dev)
722 723
723 if (phy_dev->duplex != pdata->last_duplex) { 724 if (phy_dev->duplex != pdata->last_duplex) {
724 unsigned int mac_cr; 725 unsigned int mac_cr;
725 SMSC_TRACE(HW, "duplex state has changed"); 726 SMSC_TRACE(pdata, hw, "duplex state has changed");
726 727
727 spin_lock_irqsave(&pdata->mac_lock, flags); 728 spin_lock_irqsave(&pdata->mac_lock, flags);
728 mac_cr = smsc911x_mac_read(pdata, MAC_CR); 729 mac_cr = smsc911x_mac_read(pdata, MAC_CR);
729 if (phy_dev->duplex) { 730 if (phy_dev->duplex) {
730 SMSC_TRACE(HW, 731 SMSC_TRACE(pdata, hw,
731 "configuring for full duplex mode"); 732 "configuring for full duplex mode");
732 mac_cr |= MAC_CR_FDPX_; 733 mac_cr |= MAC_CR_FDPX_;
733 } else { 734 } else {
734 SMSC_TRACE(HW, 735 SMSC_TRACE(pdata, hw,
735 "configuring for half duplex mode"); 736 "configuring for half duplex mode");
736 mac_cr &= ~MAC_CR_FDPX_; 737 mac_cr &= ~MAC_CR_FDPX_;
737 } 738 }
738 smsc911x_mac_write(pdata, MAC_CR, mac_cr); 739 smsc911x_mac_write(pdata, MAC_CR, mac_cr);
@@ -744,9 +745,9 @@ static void smsc911x_phy_adjust_link(struct net_device *dev)
744 745
745 carrier = netif_carrier_ok(dev); 746 carrier = netif_carrier_ok(dev);
746 if (carrier != pdata->last_carrier) { 747 if (carrier != pdata->last_carrier) {
747 SMSC_TRACE(HW, "carrier state has changed"); 748 SMSC_TRACE(pdata, hw, "carrier state has changed");
748 if (carrier) { 749 if (carrier) {
749 SMSC_TRACE(HW, "configuring for carrier OK"); 750 SMSC_TRACE(pdata, hw, "configuring for carrier OK");
750 if ((pdata->gpio_orig_setting & GPIO_CFG_LED1_EN_) && 751 if ((pdata->gpio_orig_setting & GPIO_CFG_LED1_EN_) &&
751 (!pdata->using_extphy)) { 752 (!pdata->using_extphy)) {
752 /* Restore original GPIO configuration */ 753 /* Restore original GPIO configuration */
@@ -755,7 +756,7 @@ static void smsc911x_phy_adjust_link(struct net_device *dev)
755 pdata->gpio_setting); 756 pdata->gpio_setting);
756 } 757 }
757 } else { 758 } else {
758 SMSC_TRACE(HW, "configuring for no carrier"); 759 SMSC_TRACE(pdata, hw, "configuring for no carrier");
759 /* Check global setting that LED1 760 /* Check global setting that LED1
760 * usage is 10/100 indicator */ 761 * usage is 10/100 indicator */
761 pdata->gpio_setting = smsc911x_reg_read(pdata, 762 pdata->gpio_setting = smsc911x_reg_read(pdata,
@@ -787,25 +788,25 @@ static int smsc911x_mii_probe(struct net_device *dev)
787 /* find the first phy */ 788 /* find the first phy */
788 phydev = phy_find_first(pdata->mii_bus); 789 phydev = phy_find_first(pdata->mii_bus);
789 if (!phydev) { 790 if (!phydev) {
790 pr_err("%s: no PHY found\n", dev->name); 791 netdev_err(dev, "no PHY found\n");
791 return -ENODEV; 792 return -ENODEV;
792 } 793 }
793 794
794 SMSC_TRACE(PROBE, "PHY: addr %d, phy_id 0x%08X", 795 SMSC_TRACE(pdata, probe, "PHY: addr %d, phy_id 0x%08X",
795 phydev->addr, phydev->phy_id); 796 phydev->addr, phydev->phy_id);
796 797
797 ret = phy_connect_direct(dev, phydev, 798 ret = phy_connect_direct(dev, phydev,
798 &smsc911x_phy_adjust_link, 0, 799 &smsc911x_phy_adjust_link, 0,
799 pdata->config.phy_interface); 800 pdata->config.phy_interface);
800 801
801 if (ret) { 802 if (ret) {
802 pr_err("%s: Could not attach to PHY\n", dev->name); 803 netdev_err(dev, "Could not attach to PHY\n");
803 return ret; 804 return ret;
804 } 805 }
805 806
806 pr_info("%s: attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n", 807 netdev_info(dev,
807 dev->name, phydev->drv->name, 808 "attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n",
808 dev_name(&phydev->dev), phydev->irq); 809 phydev->drv->name, dev_name(&phydev->dev), phydev->irq);
809 810
810 /* mask with MAC supported features */ 811 /* mask with MAC supported features */
811 phydev->supported &= (PHY_BASIC_FEATURES | SUPPORTED_Pause | 812 phydev->supported &= (PHY_BASIC_FEATURES | SUPPORTED_Pause |
@@ -818,13 +819,13 @@ static int smsc911x_mii_probe(struct net_device *dev)
818 819
819#ifdef USE_PHY_WORK_AROUND 820#ifdef USE_PHY_WORK_AROUND
820 if (smsc911x_phy_loopbacktest(dev) < 0) { 821 if (smsc911x_phy_loopbacktest(dev) < 0) {
821 SMSC_WARNING(HW, "Failed Loop Back Test"); 822 SMSC_WARN(pdata, hw, "Failed Loop Back Test");
822 return -ENODEV; 823 return -ENODEV;
823 } 824 }
824 SMSC_TRACE(HW, "Passed Loop Back Test"); 825 SMSC_TRACE(pdata, hw, "Passed Loop Back Test");
825#endif /* USE_PHY_WORK_AROUND */ 826#endif /* USE_PHY_WORK_AROUND */
826 827
827 SMSC_TRACE(HW, "phy initialised successfully"); 828 SMSC_TRACE(pdata, hw, "phy initialised successfully");
828 return 0; 829 return 0;
829} 830}
830 831
@@ -860,8 +861,8 @@ static int __devinit smsc911x_mii_init(struct platform_device *pdev,
860 smsc911x_phy_initialise_external(pdata); 861 smsc911x_phy_initialise_external(pdata);
861 break; 862 break;
862 default: 863 default:
863 SMSC_TRACE(HW, "External PHY is not supported, " 864 SMSC_TRACE(pdata, hw, "External PHY is not supported, "
864 "using internal PHY"); 865 "using internal PHY");
865 pdata->using_extphy = 0; 866 pdata->using_extphy = 0;
866 break; 867 break;
867 } 868 }
@@ -872,12 +873,12 @@ static int __devinit smsc911x_mii_init(struct platform_device *pdev,
872 } 873 }
873 874
874 if (mdiobus_register(pdata->mii_bus)) { 875 if (mdiobus_register(pdata->mii_bus)) {
875 SMSC_WARNING(PROBE, "Error registering mii bus"); 876 SMSC_WARN(pdata, probe, "Error registering mii bus");
876 goto err_out_free_bus_2; 877 goto err_out_free_bus_2;
877 } 878 }
878 879
879 if (smsc911x_mii_probe(dev) < 0) { 880 if (smsc911x_mii_probe(dev) < 0) {
880 SMSC_WARNING(PROBE, "Error registering mii bus"); 881 SMSC_WARN(pdata, probe, "Error registering mii bus");
881 goto err_out_unregister_bus_3; 882 goto err_out_unregister_bus_3;
882 } 883 }
883 884
@@ -913,8 +914,7 @@ static void smsc911x_tx_update_txcounters(struct net_device *dev)
913 * does not reference a hardware defined reserved bit 914 * does not reference a hardware defined reserved bit
914 * but rather a driver defined one. 915 * but rather a driver defined one.
915 */ 916 */
916 SMSC_WARNING(HW, 917 SMSC_WARN(pdata, hw, "Packet tag reserved bit is high");
917 "Packet tag reserved bit is high");
918 } else { 918 } else {
919 if (unlikely(tx_stat & TX_STS_ES_)) { 919 if (unlikely(tx_stat & TX_STS_ES_)) {
920 dev->stats.tx_errors++; 920 dev->stats.tx_errors++;
@@ -977,8 +977,8 @@ smsc911x_rx_fastforward(struct smsc911x_data *pdata, unsigned int pktbytes)
977 } while ((val & RX_DP_CTRL_RX_FFWD_) && --timeout); 977 } while ((val & RX_DP_CTRL_RX_FFWD_) && --timeout);
978 978
979 if (unlikely(timeout == 0)) 979 if (unlikely(timeout == 0))
980 SMSC_WARNING(HW, "Timed out waiting for " 980 SMSC_WARN(pdata, hw, "Timed out waiting for "
981 "RX FFWD to finish, RX_DP_CTRL: 0x%08X", val); 981 "RX FFWD to finish, RX_DP_CTRL: 0x%08X", val);
982 } else { 982 } else {
983 unsigned int temp; 983 unsigned int temp;
984 while (pktwords--) 984 while (pktwords--)
@@ -1021,8 +1021,8 @@ static int smsc911x_poll(struct napi_struct *napi, int budget)
1021 smsc911x_rx_counterrors(dev, rxstat); 1021 smsc911x_rx_counterrors(dev, rxstat);
1022 1022
1023 if (unlikely(rxstat & RX_STS_ES_)) { 1023 if (unlikely(rxstat & RX_STS_ES_)) {
1024 SMSC_WARNING(RX_ERR, 1024 SMSC_WARN(pdata, rx_err,
1025 "Discarding packet with error bit set"); 1025 "Discarding packet with error bit set");
1026 /* Packet has an error, discard it and continue with 1026 /* Packet has an error, discard it and continue with
1027 * the next */ 1027 * the next */
1028 smsc911x_rx_fastforward(pdata, pktwords); 1028 smsc911x_rx_fastforward(pdata, pktwords);
@@ -1032,8 +1032,8 @@ static int smsc911x_poll(struct napi_struct *napi, int budget)
1032 1032
1033 skb = netdev_alloc_skb(dev, pktlength + NET_IP_ALIGN); 1033 skb = netdev_alloc_skb(dev, pktlength + NET_IP_ALIGN);
1034 if (unlikely(!skb)) { 1034 if (unlikely(!skb)) {
1035 SMSC_WARNING(RX_ERR, 1035 SMSC_WARN(pdata, rx_err,
1036 "Unable to allocate skb for rx packet"); 1036 "Unable to allocate skb for rx packet");
1037 /* Drop the packet and stop this polling iteration */ 1037 /* Drop the packet and stop this polling iteration */
1038 smsc911x_rx_fastforward(pdata, pktwords); 1038 smsc911x_rx_fastforward(pdata, pktwords);
1039 dev->stats.rx_dropped++; 1039 dev->stats.rx_dropped++;
@@ -1083,8 +1083,8 @@ static void smsc911x_rx_multicast_update(struct smsc911x_data *pdata)
1083 smsc911x_mac_write(pdata, MAC_CR, mac_cr); 1083 smsc911x_mac_write(pdata, MAC_CR, mac_cr);
1084 smsc911x_mac_write(pdata, HASHH, pdata->hashhi); 1084 smsc911x_mac_write(pdata, HASHH, pdata->hashhi);
1085 smsc911x_mac_write(pdata, HASHL, pdata->hashlo); 1085 smsc911x_mac_write(pdata, HASHL, pdata->hashlo);
1086 SMSC_TRACE(HW, "maccr 0x%08X, HASHH 0x%08X, HASHL 0x%08X", 1086 SMSC_TRACE(pdata, hw, "maccr 0x%08X, HASHH 0x%08X, HASHL 0x%08X",
1087 mac_cr, pdata->hashhi, pdata->hashlo); 1087 mac_cr, pdata->hashhi, pdata->hashlo);
1088} 1088}
1089 1089
1090static void smsc911x_rx_multicast_update_workaround(struct smsc911x_data *pdata) 1090static void smsc911x_rx_multicast_update_workaround(struct smsc911x_data *pdata)
@@ -1102,7 +1102,7 @@ static void smsc911x_rx_multicast_update_workaround(struct smsc911x_data *pdata)
1102 1102
1103 /* Check Rx has stopped */ 1103 /* Check Rx has stopped */
1104 if (smsc911x_mac_read(pdata, MAC_CR) & MAC_CR_RXEN_) 1104 if (smsc911x_mac_read(pdata, MAC_CR) & MAC_CR_RXEN_)
1105 SMSC_WARNING(DRV, "Rx not stopped"); 1105 SMSC_WARN(pdata, drv, "Rx not stopped");
1106 1106
1107 /* Perform the update - safe to do now Rx has stopped */ 1107 /* Perform the update - safe to do now Rx has stopped */
1108 smsc911x_rx_multicast_update(pdata); 1108 smsc911x_rx_multicast_update(pdata);
@@ -1131,7 +1131,7 @@ static int smsc911x_soft_reset(struct smsc911x_data *pdata)
1131 } while ((--timeout) && (temp & HW_CFG_SRST_)); 1131 } while ((--timeout) && (temp & HW_CFG_SRST_));
1132 1132
1133 if (unlikely(temp & HW_CFG_SRST_)) { 1133 if (unlikely(temp & HW_CFG_SRST_)) {
1134 SMSC_WARNING(DRV, "Failed to complete reset"); 1134 SMSC_WARN(pdata, drv, "Failed to complete reset");
1135 return -EIO; 1135 return -EIO;
1136 } 1136 }
1137 return 0; 1137 return 0;
@@ -1160,18 +1160,18 @@ static int smsc911x_open(struct net_device *dev)
1160 1160
1161 /* if the phy is not yet registered, retry later*/ 1161 /* if the phy is not yet registered, retry later*/
1162 if (!pdata->phy_dev) { 1162 if (!pdata->phy_dev) {
1163 SMSC_WARNING(HW, "phy_dev is NULL"); 1163 SMSC_WARN(pdata, hw, "phy_dev is NULL");
1164 return -EAGAIN; 1164 return -EAGAIN;
1165 } 1165 }
1166 1166
1167 if (!is_valid_ether_addr(dev->dev_addr)) { 1167 if (!is_valid_ether_addr(dev->dev_addr)) {
1168 SMSC_WARNING(HW, "dev_addr is not a valid MAC address"); 1168 SMSC_WARN(pdata, hw, "dev_addr is not a valid MAC address");
1169 return -EADDRNOTAVAIL; 1169 return -EADDRNOTAVAIL;
1170 } 1170 }
1171 1171
1172 /* Reset the LAN911x */ 1172 /* Reset the LAN911x */
1173 if (smsc911x_soft_reset(pdata)) { 1173 if (smsc911x_soft_reset(pdata)) {
1174 SMSC_WARNING(HW, "soft reset failed"); 1174 SMSC_WARN(pdata, hw, "soft reset failed");
1175 return -EIO; 1175 return -EIO;
1176 } 1176 }
1177 1177
@@ -1191,8 +1191,8 @@ static int smsc911x_open(struct net_device *dev)
1191 } 1191 }
1192 1192
1193 if (unlikely(timeout == 0)) 1193 if (unlikely(timeout == 0))
1194 SMSC_WARNING(IFUP, 1194 SMSC_WARN(pdata, ifup,
1195 "Timed out waiting for EEPROM busy bit to clear"); 1195 "Timed out waiting for EEPROM busy bit to clear");
1196 1196
1197 smsc911x_reg_write(pdata, GPIO_CFG, 0x70070000); 1197 smsc911x_reg_write(pdata, GPIO_CFG, 0x70070000);
1198 1198
@@ -1210,22 +1210,22 @@ static int smsc911x_open(struct net_device *dev)
1210 intcfg = ((10 << 24) | INT_CFG_IRQ_EN_); 1210 intcfg = ((10 << 24) | INT_CFG_IRQ_EN_);
1211 1211
1212 if (pdata->config.irq_polarity) { 1212 if (pdata->config.irq_polarity) {
1213 SMSC_TRACE(IFUP, "irq polarity: active high"); 1213 SMSC_TRACE(pdata, ifup, "irq polarity: active high");
1214 intcfg |= INT_CFG_IRQ_POL_; 1214 intcfg |= INT_CFG_IRQ_POL_;
1215 } else { 1215 } else {
1216 SMSC_TRACE(IFUP, "irq polarity: active low"); 1216 SMSC_TRACE(pdata, ifup, "irq polarity: active low");
1217 } 1217 }
1218 1218
1219 if (pdata->config.irq_type) { 1219 if (pdata->config.irq_type) {
1220 SMSC_TRACE(IFUP, "irq type: push-pull"); 1220 SMSC_TRACE(pdata, ifup, "irq type: push-pull");
1221 intcfg |= INT_CFG_IRQ_TYPE_; 1221 intcfg |= INT_CFG_IRQ_TYPE_;
1222 } else { 1222 } else {
1223 SMSC_TRACE(IFUP, "irq type: open drain"); 1223 SMSC_TRACE(pdata, ifup, "irq type: open drain");
1224 } 1224 }
1225 1225
1226 smsc911x_reg_write(pdata, INT_CFG, intcfg); 1226 smsc911x_reg_write(pdata, INT_CFG, intcfg);
1227 1227
1228 SMSC_TRACE(IFUP, "Testing irq handler using IRQ %d", dev->irq); 1228 SMSC_TRACE(pdata, ifup, "Testing irq handler using IRQ %d", dev->irq);
1229 pdata->software_irq_signal = 0; 1229 pdata->software_irq_signal = 0;
1230 smp_wmb(); 1230 smp_wmb();
1231 1231
@@ -1241,14 +1241,15 @@ static int smsc911x_open(struct net_device *dev)
1241 } 1241 }
1242 1242
1243 if (!pdata->software_irq_signal) { 1243 if (!pdata->software_irq_signal) {
1244 dev_warn(&dev->dev, "ISR failed signaling test (IRQ %d)\n", 1244 netdev_warn(dev, "ISR failed signaling test (IRQ %d)\n",
1245 dev->irq); 1245 dev->irq);
1246 return -ENODEV; 1246 return -ENODEV;
1247 } 1247 }
1248 SMSC_TRACE(IFUP, "IRQ handler passed test using IRQ %d", dev->irq); 1248 SMSC_TRACE(pdata, ifup, "IRQ handler passed test using IRQ %d",
1249 dev->irq);
1249 1250
1250 dev_info(&dev->dev, "SMSC911x/921x identified at %#08lx, IRQ: %d\n", 1251 netdev_info(dev, "SMSC911x/921x identified at %#08lx, IRQ: %d\n",
1251 (unsigned long)pdata->ioaddr, dev->irq); 1252 (unsigned long)pdata->ioaddr, dev->irq);
1252 1253
1253 /* Reset the last known duplex and carrier */ 1254 /* Reset the last known duplex and carrier */
1254 pdata->last_duplex = -1; 1255 pdata->last_duplex = -1;
@@ -1313,7 +1314,7 @@ static int smsc911x_stop(struct net_device *dev)
1313 if (pdata->phy_dev) 1314 if (pdata->phy_dev)
1314 phy_stop(pdata->phy_dev); 1315 phy_stop(pdata->phy_dev);
1315 1316
1316 SMSC_TRACE(IFDOWN, "Interface stopped"); 1317 SMSC_TRACE(pdata, ifdown, "Interface stopped");
1317 return 0; 1318 return 0;
1318} 1319}
1319 1320
@@ -1331,8 +1332,8 @@ static int smsc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
1331 freespace = smsc911x_reg_read(pdata, TX_FIFO_INF) & TX_FIFO_INF_TDFREE_; 1332 freespace = smsc911x_reg_read(pdata, TX_FIFO_INF) & TX_FIFO_INF_TDFREE_;
1332 1333
1333 if (unlikely(freespace < TX_FIFO_LOW_THRESHOLD)) 1334 if (unlikely(freespace < TX_FIFO_LOW_THRESHOLD))
1334 SMSC_WARNING(TX_ERR, 1335 SMSC_WARN(pdata, tx_err,
1335 "Tx data fifo low, space available: %d", freespace); 1336 "Tx data fifo low, space available: %d", freespace);
1336 1337
1337 /* Word alignment adjustment */ 1338 /* Word alignment adjustment */
1338 tx_cmd_a = (u32)((ulong)skb->data & 0x03) << 16; 1339 tx_cmd_a = (u32)((ulong)skb->data & 0x03) << 16;
@@ -1432,7 +1433,7 @@ static void smsc911x_set_multicast_list(struct net_device *dev)
1432 * receiving data */ 1433 * receiving data */
1433 if (!pdata->multicast_update_pending) { 1434 if (!pdata->multicast_update_pending) {
1434 unsigned int temp; 1435 unsigned int temp;
1435 SMSC_TRACE(HW, "scheduling mcast update"); 1436 SMSC_TRACE(pdata, hw, "scheduling mcast update");
1436 pdata->multicast_update_pending = 1; 1437 pdata->multicast_update_pending = 1;
1437 1438
1438 /* Request the hardware to stop, then perform the 1439 /* Request the hardware to stop, then perform the
@@ -1474,7 +1475,7 @@ static irqreturn_t smsc911x_irqhandler(int irq, void *dev_id)
1474 if (unlikely(intsts & inten & INT_STS_RXSTOP_INT_)) { 1475 if (unlikely(intsts & inten & INT_STS_RXSTOP_INT_)) {
1475 /* Called when there is a multicast update scheduled and 1476 /* Called when there is a multicast update scheduled and
1476 * it is now safe to complete the update */ 1477 * it is now safe to complete the update */
1477 SMSC_TRACE(INTR, "RX Stop interrupt"); 1478 SMSC_TRACE(pdata, intr, "RX Stop interrupt");
1478 smsc911x_reg_write(pdata, INT_STS, INT_STS_RXSTOP_INT_); 1479 smsc911x_reg_write(pdata, INT_STS, INT_STS_RXSTOP_INT_);
1479 if (pdata->multicast_update_pending) 1480 if (pdata->multicast_update_pending)
1480 smsc911x_rx_multicast_update_workaround(pdata); 1481 smsc911x_rx_multicast_update_workaround(pdata);
@@ -1491,7 +1492,7 @@ static irqreturn_t smsc911x_irqhandler(int irq, void *dev_id)
1491 } 1492 }
1492 1493
1493 if (unlikely(intsts & inten & INT_STS_RXE_)) { 1494 if (unlikely(intsts & inten & INT_STS_RXE_)) {
1494 SMSC_TRACE(INTR, "RX Error interrupt"); 1495 SMSC_TRACE(pdata, intr, "RX Error interrupt");
1495 smsc911x_reg_write(pdata, INT_STS, INT_STS_RXE_); 1496 smsc911x_reg_write(pdata, INT_STS, INT_STS_RXE_);
1496 serviced = IRQ_HANDLED; 1497 serviced = IRQ_HANDLED;
1497 } 1498 }
@@ -1505,8 +1506,7 @@ static irqreturn_t smsc911x_irqhandler(int irq, void *dev_id)
1505 /* Schedule a NAPI poll */ 1506 /* Schedule a NAPI poll */
1506 __napi_schedule(&pdata->napi); 1507 __napi_schedule(&pdata->napi);
1507 } else { 1508 } else {
1508 SMSC_WARNING(RX_ERR, 1509 SMSC_WARN(pdata, rx_err, "napi_schedule_prep failed");
1509 "napi_schedule_prep failed");
1510 } 1510 }
1511 serviced = IRQ_HANDLED; 1511 serviced = IRQ_HANDLED;
1512 } 1512 }
@@ -1543,7 +1543,7 @@ static int smsc911x_set_mac_address(struct net_device *dev, void *p)
1543 smsc911x_set_hw_mac_address(pdata, dev->dev_addr); 1543 smsc911x_set_hw_mac_address(pdata, dev->dev_addr);
1544 spin_unlock_irq(&pdata->mac_lock); 1544 spin_unlock_irq(&pdata->mac_lock);
1545 1545
1546 dev_info(&dev->dev, "MAC Address: %pM\n", dev->dev_addr); 1546 netdev_info(dev, "MAC Address: %pM\n", dev->dev_addr);
1547 1547
1548 return 0; 1548 return 0;
1549} 1549}
@@ -1649,9 +1649,9 @@ static int smsc911x_eeprom_send_cmd(struct smsc911x_data *pdata, u32 op)
1649 int timeout = 100; 1649 int timeout = 100;
1650 u32 e2cmd; 1650 u32 e2cmd;
1651 1651
1652 SMSC_TRACE(DRV, "op 0x%08x", op); 1652 SMSC_TRACE(pdata, drv, "op 0x%08x", op);
1653 if (smsc911x_reg_read(pdata, E2P_CMD) & E2P_CMD_EPC_BUSY_) { 1653 if (smsc911x_reg_read(pdata, E2P_CMD) & E2P_CMD_EPC_BUSY_) {
1654 SMSC_WARNING(DRV, "Busy at start"); 1654 SMSC_WARN(pdata, drv, "Busy at start");
1655 return -EBUSY; 1655 return -EBUSY;
1656 } 1656 }
1657 1657
@@ -1664,12 +1664,12 @@ static int smsc911x_eeprom_send_cmd(struct smsc911x_data *pdata, u32 op)
1664 } while ((e2cmd & E2P_CMD_EPC_BUSY_) && (--timeout)); 1664 } while ((e2cmd & E2P_CMD_EPC_BUSY_) && (--timeout));
1665 1665
1666 if (!timeout) { 1666 if (!timeout) {
1667 SMSC_TRACE(DRV, "TIMED OUT"); 1667 SMSC_TRACE(pdata, drv, "TIMED OUT");
1668 return -EAGAIN; 1668 return -EAGAIN;
1669 } 1669 }
1670 1670
1671 if (e2cmd & E2P_CMD_EPC_TIMEOUT_) { 1671 if (e2cmd & E2P_CMD_EPC_TIMEOUT_) {
1672 SMSC_TRACE(DRV, "Error occured during eeprom operation"); 1672 SMSC_TRACE(pdata, drv, "Error occured during eeprom operation");
1673 return -EINVAL; 1673 return -EINVAL;
1674 } 1674 }
1675 1675
@@ -1682,7 +1682,7 @@ static int smsc911x_eeprom_read_location(struct smsc911x_data *pdata,
1682 u32 op = E2P_CMD_EPC_CMD_READ_ | address; 1682 u32 op = E2P_CMD_EPC_CMD_READ_ | address;
1683 int ret; 1683 int ret;
1684 1684
1685 SMSC_TRACE(DRV, "address 0x%x", address); 1685 SMSC_TRACE(pdata, drv, "address 0x%x", address);
1686 ret = smsc911x_eeprom_send_cmd(pdata, op); 1686 ret = smsc911x_eeprom_send_cmd(pdata, op);
1687 1687
1688 if (!ret) 1688 if (!ret)
@@ -1698,7 +1698,7 @@ static int smsc911x_eeprom_write_location(struct smsc911x_data *pdata,
1698 u32 temp; 1698 u32 temp;
1699 int ret; 1699 int ret;
1700 1700
1701 SMSC_TRACE(DRV, "address 0x%x, data 0x%x", address, data); 1701 SMSC_TRACE(pdata, drv, "address 0x%x, data 0x%x", address, data);
1702 ret = smsc911x_eeprom_send_cmd(pdata, op); 1702 ret = smsc911x_eeprom_send_cmd(pdata, op);
1703 1703
1704 if (!ret) { 1704 if (!ret) {
@@ -1811,25 +1811,25 @@ static int __devinit smsc911x_init(struct net_device *dev)
1811 struct smsc911x_data *pdata = netdev_priv(dev); 1811 struct smsc911x_data *pdata = netdev_priv(dev);
1812 unsigned int byte_test; 1812 unsigned int byte_test;
1813 1813
1814 SMSC_TRACE(PROBE, "Driver Parameters:"); 1814 SMSC_TRACE(pdata, probe, "Driver Parameters:");
1815 SMSC_TRACE(PROBE, "LAN base: 0x%08lX", 1815 SMSC_TRACE(pdata, probe, "LAN base: 0x%08lX",
1816 (unsigned long)pdata->ioaddr); 1816 (unsigned long)pdata->ioaddr);
1817 SMSC_TRACE(PROBE, "IRQ: %d", dev->irq); 1817 SMSC_TRACE(pdata, probe, "IRQ: %d", dev->irq);
1818 SMSC_TRACE(PROBE, "PHY will be autodetected."); 1818 SMSC_TRACE(pdata, probe, "PHY will be autodetected.");
1819 1819
1820 spin_lock_init(&pdata->dev_lock); 1820 spin_lock_init(&pdata->dev_lock);
1821 1821
1822 if (pdata->ioaddr == 0) { 1822 if (pdata->ioaddr == 0) {
1823 SMSC_WARNING(PROBE, "pdata->ioaddr: 0x00000000"); 1823 SMSC_WARN(pdata, probe, "pdata->ioaddr: 0x00000000");
1824 return -ENODEV; 1824 return -ENODEV;
1825 } 1825 }
1826 1826
1827 /* Check byte ordering */ 1827 /* Check byte ordering */
1828 byte_test = smsc911x_reg_read(pdata, BYTE_TEST); 1828 byte_test = smsc911x_reg_read(pdata, BYTE_TEST);
1829 SMSC_TRACE(PROBE, "BYTE_TEST: 0x%08X", byte_test); 1829 SMSC_TRACE(pdata, probe, "BYTE_TEST: 0x%08X", byte_test);
1830 if (byte_test == 0x43218765) { 1830 if (byte_test == 0x43218765) {
1831 SMSC_TRACE(PROBE, "BYTE_TEST looks swapped, " 1831 SMSC_TRACE(pdata, probe, "BYTE_TEST looks swapped, "
1832 "applying WORD_SWAP"); 1832 "applying WORD_SWAP");
1833 smsc911x_reg_write(pdata, WORD_SWAP, 0xffffffff); 1833 smsc911x_reg_write(pdata, WORD_SWAP, 0xffffffff);
1834 1834
1835 /* 1 dummy read of BYTE_TEST is needed after a write to 1835 /* 1 dummy read of BYTE_TEST is needed after a write to
@@ -1840,12 +1840,13 @@ static int __devinit smsc911x_init(struct net_device *dev)
1840 } 1840 }
1841 1841
1842 if (byte_test != 0x87654321) { 1842 if (byte_test != 0x87654321) {
1843 SMSC_WARNING(DRV, "BYTE_TEST: 0x%08X", byte_test); 1843 SMSC_WARN(pdata, drv, "BYTE_TEST: 0x%08X", byte_test);
1844 if (((byte_test >> 16) & 0xFFFF) == (byte_test & 0xFFFF)) { 1844 if (((byte_test >> 16) & 0xFFFF) == (byte_test & 0xFFFF)) {
1845 SMSC_WARNING(PROBE, 1845 SMSC_WARN(pdata, probe,
1846 "top 16 bits equal to bottom 16 bits"); 1846 "top 16 bits equal to bottom 16 bits");
1847 SMSC_TRACE(PROBE, "This may mean the chip is set " 1847 SMSC_TRACE(pdata, probe,
1848 "for 32 bit while the bus is reading 16 bit"); 1848 "This may mean the chip is set "
1849 "for 32 bit while the bus is reading 16 bit");
1849 } 1850 }
1850 return -ENODEV; 1851 return -ENODEV;
1851 } 1852 }
@@ -1880,17 +1881,18 @@ static int __devinit smsc911x_init(struct net_device *dev)
1880 break; 1881 break;
1881 1882
1882 default: 1883 default:
1883 SMSC_WARNING(PROBE, "LAN911x not identified, idrev: 0x%08X", 1884 SMSC_WARN(pdata, probe, "LAN911x not identified, idrev: 0x%08X",
1884 pdata->idrev); 1885 pdata->idrev);
1885 return -ENODEV; 1886 return -ENODEV;
1886 } 1887 }
1887 1888
1888 SMSC_TRACE(PROBE, "LAN911x identified, idrev: 0x%08X, generation: %d", 1889 SMSC_TRACE(pdata, probe,
1889 pdata->idrev, pdata->generation); 1890 "LAN911x identified, idrev: 0x%08X, generation: %d",
1891 pdata->idrev, pdata->generation);
1890 1892
1891 if (pdata->generation == 0) 1893 if (pdata->generation == 0)
1892 SMSC_WARNING(PROBE, 1894 SMSC_WARN(pdata, probe,
1893 "This driver is not intended for this chip revision"); 1895 "This driver is not intended for this chip revision");
1894 1896
1895 /* workaround for platforms without an eeprom, where the mac address 1897 /* workaround for platforms without an eeprom, where the mac address
1896 * is stored elsewhere and set by the bootloader. This saves the 1898 * is stored elsewhere and set by the bootloader. This saves the
@@ -1927,7 +1929,7 @@ static int __devexit smsc911x_drv_remove(struct platform_device *pdev)
1927 BUG_ON(!pdata->ioaddr); 1929 BUG_ON(!pdata->ioaddr);
1928 BUG_ON(!pdata->phy_dev); 1930 BUG_ON(!pdata->phy_dev);
1929 1931
1930 SMSC_TRACE(IFDOWN, "Stopping driver."); 1932 SMSC_TRACE(pdata, ifdown, "Stopping driver");
1931 1933
1932 phy_disconnect(pdata->phy_dev); 1934 phy_disconnect(pdata->phy_dev);
1933 pdata->phy_dev = NULL; 1935 pdata->phy_dev = NULL;
@@ -1961,11 +1963,11 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
1961 int res_size, irq_flags; 1963 int res_size, irq_flags;
1962 int retval; 1964 int retval;
1963 1965
1964 pr_info("%s: Driver version %s.\n", SMSC_CHIPNAME, SMSC_DRV_VERSION); 1966 pr_info("Driver version %s\n", SMSC_DRV_VERSION);
1965 1967
1966 /* platform data specifies irq & dynamic bus configuration */ 1968 /* platform data specifies irq & dynamic bus configuration */
1967 if (!pdev->dev.platform_data) { 1969 if (!pdev->dev.platform_data) {
1968 pr_warning("%s: platform_data not provided\n", SMSC_CHIPNAME); 1970 pr_warn("platform_data not provided\n");
1969 retval = -ENODEV; 1971 retval = -ENODEV;
1970 goto out_0; 1972 goto out_0;
1971 } 1973 }
@@ -1975,8 +1977,7 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
1975 if (!res) 1977 if (!res)
1976 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1978 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1977 if (!res) { 1979 if (!res) {
1978 pr_warning("%s: Could not allocate resource.\n", 1980 pr_warn("Could not allocate resource\n");
1979 SMSC_CHIPNAME);
1980 retval = -ENODEV; 1981 retval = -ENODEV;
1981 goto out_0; 1982 goto out_0;
1982 } 1983 }
@@ -1984,8 +1985,7 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
1984 1985
1985 irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 1986 irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
1986 if (!irq_res) { 1987 if (!irq_res) {
1987 pr_warning("%s: Could not allocate irq resource.\n", 1988 pr_warn("Could not allocate irq resource\n");
1988 SMSC_CHIPNAME);
1989 retval = -ENODEV; 1989 retval = -ENODEV;
1990 goto out_0; 1990 goto out_0;
1991 } 1991 }
@@ -1997,7 +1997,7 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
1997 1997
1998 dev = alloc_etherdev(sizeof(struct smsc911x_data)); 1998 dev = alloc_etherdev(sizeof(struct smsc911x_data));
1999 if (!dev) { 1999 if (!dev) {
2000 pr_warning("%s: Could not allocate device.\n", SMSC_CHIPNAME); 2000 pr_warn("Could not allocate device\n");
2001 retval = -ENOMEM; 2001 retval = -ENOMEM;
2002 goto out_release_io_1; 2002 goto out_release_io_1;
2003 } 2003 }
@@ -2017,8 +2017,7 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
2017 pdata->msg_enable = ((1 << debug) - 1); 2017 pdata->msg_enable = ((1 << debug) - 1);
2018 2018
2019 if (pdata->ioaddr == NULL) { 2019 if (pdata->ioaddr == NULL) {
2020 SMSC_WARNING(PROBE, 2020 SMSC_WARN(pdata, probe, "Error smsc911x base address invalid");
2021 "Error smsc911x base address invalid");
2022 retval = -ENOMEM; 2021 retval = -ENOMEM;
2023 goto out_free_netdev_2; 2022 goto out_free_netdev_2;
2024 } 2023 }
@@ -2043,8 +2042,8 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
2043 retval = request_irq(dev->irq, smsc911x_irqhandler, 2042 retval = request_irq(dev->irq, smsc911x_irqhandler,
2044 irq_flags | IRQF_SHARED, dev->name, dev); 2043 irq_flags | IRQF_SHARED, dev->name, dev);
2045 if (retval) { 2044 if (retval) {
2046 SMSC_WARNING(PROBE, 2045 SMSC_WARN(pdata, probe,
2047 "Unable to claim requested irq: %d", dev->irq); 2046 "Unable to claim requested irq: %d", dev->irq);
2048 goto out_unmap_io_3; 2047 goto out_unmap_io_3;
2049 } 2048 }
2050 2049
@@ -2052,19 +2051,18 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
2052 2051
2053 retval = register_netdev(dev); 2052 retval = register_netdev(dev);
2054 if (retval) { 2053 if (retval) {
2055 SMSC_WARNING(PROBE, 2054 SMSC_WARN(pdata, probe, "Error %i registering device", retval);
2056 "Error %i registering device", retval);
2057 goto out_unset_drvdata_4; 2055 goto out_unset_drvdata_4;
2058 } else { 2056 } else {
2059 SMSC_TRACE(PROBE, "Network interface: \"%s\"", dev->name); 2057 SMSC_TRACE(pdata, probe,
2058 "Network interface: \"%s\"", dev->name);
2060 } 2059 }
2061 2060
2062 spin_lock_init(&pdata->mac_lock); 2061 spin_lock_init(&pdata->mac_lock);
2063 2062
2064 retval = smsc911x_mii_init(pdev, dev); 2063 retval = smsc911x_mii_init(pdev, dev);
2065 if (retval) { 2064 if (retval) {
2066 SMSC_WARNING(PROBE, 2065 SMSC_WARN(pdata, probe, "Error %i initialising mii", retval);
2067 "Error %i initialising mii", retval);
2068 goto out_unregister_netdev_5; 2066 goto out_unregister_netdev_5;
2069 } 2067 }
2070 2068
@@ -2073,10 +2071,12 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
2073 /* Check if mac address has been specified when bringing interface up */ 2071 /* Check if mac address has been specified when bringing interface up */
2074 if (is_valid_ether_addr(dev->dev_addr)) { 2072 if (is_valid_ether_addr(dev->dev_addr)) {
2075 smsc911x_set_hw_mac_address(pdata, dev->dev_addr); 2073 smsc911x_set_hw_mac_address(pdata, dev->dev_addr);
2076 SMSC_TRACE(PROBE, "MAC Address is specified by configuration"); 2074 SMSC_TRACE(pdata, probe,
2075 "MAC Address is specified by configuration");
2077 } else if (is_valid_ether_addr(pdata->config.mac)) { 2076 } else if (is_valid_ether_addr(pdata->config.mac)) {
2078 memcpy(dev->dev_addr, pdata->config.mac, 6); 2077 memcpy(dev->dev_addr, pdata->config.mac, 6);
2079 SMSC_TRACE(PROBE, "MAC Address specified by platform data"); 2078 SMSC_TRACE(pdata, probe,
2079 "MAC Address specified by platform data");
2080 } else { 2080 } else {
2081 /* Try reading mac address from device. if EEPROM is present 2081 /* Try reading mac address from device. if EEPROM is present
2082 * it will already have been set */ 2082 * it will already have been set */
@@ -2084,20 +2084,20 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
2084 2084
2085 if (is_valid_ether_addr(dev->dev_addr)) { 2085 if (is_valid_ether_addr(dev->dev_addr)) {
2086 /* eeprom values are valid so use them */ 2086 /* eeprom values are valid so use them */
2087 SMSC_TRACE(PROBE, 2087 SMSC_TRACE(pdata, probe,
2088 "Mac Address is read from LAN911x EEPROM"); 2088 "Mac Address is read from LAN911x EEPROM");
2089 } else { 2089 } else {
2090 /* eeprom values are invalid, generate random MAC */ 2090 /* eeprom values are invalid, generate random MAC */
2091 random_ether_addr(dev->dev_addr); 2091 random_ether_addr(dev->dev_addr);
2092 smsc911x_set_hw_mac_address(pdata, dev->dev_addr); 2092 smsc911x_set_hw_mac_address(pdata, dev->dev_addr);
2093 SMSC_TRACE(PROBE, 2093 SMSC_TRACE(pdata, probe,
2094 "MAC Address is set to random_ether_addr"); 2094 "MAC Address is set to random_ether_addr");
2095 } 2095 }
2096 } 2096 }
2097 2097
2098 spin_unlock_irq(&pdata->mac_lock); 2098 spin_unlock_irq(&pdata->mac_lock);
2099 2099
2100 dev_info(&dev->dev, "MAC Address: %pM\n", dev->dev_addr); 2100 netdev_info(dev, "MAC Address: %pM\n", dev->dev_addr);
2101 2101
2102 return 0; 2102 return 0;
2103 2103
diff --git a/drivers/net/smsc911x.h b/drivers/net/smsc911x.h
index 50f712e99e96..8d67aacf8867 100644
--- a/drivers/net/smsc911x.h
+++ b/drivers/net/smsc911x.h
@@ -33,25 +33,21 @@
33 * can be successfully looped back */ 33 * can be successfully looped back */
34#define USE_PHY_WORK_AROUND 34#define USE_PHY_WORK_AROUND
35 35
36#define DPRINTK(nlevel, klevel, fmt, args...) \
37 ((void)((NETIF_MSG_##nlevel & pdata->msg_enable) && \
38 printk(KERN_##klevel "%s: %s: " fmt "\n", \
39 pdata->dev->name, __func__, ## args)))
40
41#if USE_DEBUG >= 1 36#if USE_DEBUG >= 1
42#define SMSC_WARNING(nlevel, fmt, args...) \ 37#define SMSC_WARN(pdata, nlevel, fmt, args...) \
43 DPRINTK(nlevel, WARNING, fmt, ## args) 38 netif_warn(pdata, nlevel, (pdata)->dev, \
39 "%s: " fmt "\n", __func__, ##args)
44#else 40#else
45#define SMSC_WARNING(nlevel, fmt, args...) \ 41#define SMSC_WARN(pdata, nlevel, fmt, args...) \
46 ({ do {} while (0); 0; }) 42 no_printk(fmt "\n", ##args)
47#endif 43#endif
48 44
49#if USE_DEBUG >= 2 45#if USE_DEBUG >= 2
50#define SMSC_TRACE(nlevel, fmt, args...) \ 46#define SMSC_TRACE(pdata, nlevel, fmt, args...) \
51 DPRINTK(nlevel, INFO, fmt, ## args) 47 netif_info(pdata, nlevel, pdata->dev, fmt "\n", ##args)
52#else 48#else
53#define SMSC_TRACE(nlevel, fmt, args...) \ 49#define SMSC_TRACE(pdata, nlevel, fmt, args...) \
54 ({ do {} while (0); 0; }) 50 no_printk(fmt "\n", ##args)
55#endif 51#endif
56 52
57#ifdef CONFIG_DEBUG_SPINLOCK 53#ifdef CONFIG_DEBUG_SPINLOCK