diff options
author | Joe Perches <joe@perches.com> | 2011-04-16 10:15:25 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-17 20:56:36 -0400 |
commit | df4511feb76173db872c8845b63179dd15f2b7da (patch) | |
tree | 8158215b7c626d928721ffd8caadeaff9ce99b49 /drivers | |
parent | 28674b97cfb907b0b3de7b7fea89efda1e65f34e (diff) |
via_rhine: Use netdev_<level> and pr_<level>
Use the more current logging styles.
Add #define DEBUG to make netdev_dbg always active.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/via-rhine.c | 230 |
1 files changed, 108 insertions, 122 deletions
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c index 0422a79acfd7..40f394ce113b 100644 --- a/drivers/net/via-rhine.c +++ b/drivers/net/via-rhine.c | |||
@@ -29,6 +29,8 @@ | |||
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
33 | |||
32 | #define DRV_NAME "via-rhine" | 34 | #define DRV_NAME "via-rhine" |
33 | #define DRV_VERSION "1.5.0" | 35 | #define DRV_VERSION "1.5.0" |
34 | #define DRV_RELDATE "2010-10-09" | 36 | #define DRV_RELDATE "2010-10-09" |
@@ -37,6 +39,7 @@ | |||
37 | /* A few user-configurable values. | 39 | /* A few user-configurable values. |
38 | These may be modified when a driver module is loaded. */ | 40 | These may be modified when a driver module is loaded. */ |
39 | 41 | ||
42 | #define DEBUG | ||
40 | static int debug = 1; /* 1 normal messages, 0 quiet .. 7 verbose. */ | 43 | static int debug = 1; /* 1 normal messages, 0 quiet .. 7 verbose. */ |
41 | static int max_interrupt_work = 20; | 44 | static int max_interrupt_work = 20; |
42 | 45 | ||
@@ -111,8 +114,7 @@ static const int multicast_filter_limit = 32; | |||
111 | 114 | ||
112 | /* These identify the driver base version and may not be removed. */ | 115 | /* These identify the driver base version and may not be removed. */ |
113 | static const char version[] __devinitconst = | 116 | static const char version[] __devinitconst = |
114 | KERN_INFO DRV_NAME ".c:v1.10-LK" DRV_VERSION " " DRV_RELDATE | 117 | "v1.10-LK" DRV_VERSION " " DRV_RELDATE " Written by Donald Becker"; |
115 | " Written by Donald Becker\n"; | ||
116 | 118 | ||
117 | /* This driver was written to use PCI memory space. Some early versions | 119 | /* This driver was written to use PCI memory space. Some early versions |
118 | of the Rhine may only work correctly with I/O space accesses. */ | 120 | of the Rhine may only work correctly with I/O space accesses. */ |
@@ -495,14 +497,15 @@ static void rhine_set_vlan_cam_mask(void __iomem *ioaddr, u32 mask); | |||
495 | static void rhine_init_cam_filter(struct net_device *dev); | 497 | static void rhine_init_cam_filter(struct net_device *dev); |
496 | static void rhine_update_vcam(struct net_device *dev); | 498 | static void rhine_update_vcam(struct net_device *dev); |
497 | 499 | ||
498 | #define RHINE_WAIT_FOR(condition) do { \ | 500 | #define RHINE_WAIT_FOR(condition) \ |
499 | int i=1024; \ | 501 | do { \ |
500 | while (!(condition) && --i) \ | 502 | int i = 1024; \ |
501 | ; \ | 503 | while (!(condition) && --i) \ |
502 | if (debug > 1 && i < 512) \ | 504 | ; \ |
503 | printk(KERN_INFO "%s: %4d cycles used @ %s:%d\n", \ | 505 | if (debug > 1 && i < 512) \ |
504 | DRV_NAME, 1024-i, __func__, __LINE__); \ | 506 | pr_info("%4d cycles used @ %s:%d\n", \ |
505 | } while(0) | 507 | 1024 - i, __func__, __LINE__); \ |
508 | } while (0) | ||
506 | 509 | ||
507 | static inline u32 get_intr_status(struct net_device *dev) | 510 | static inline u32 get_intr_status(struct net_device *dev) |
508 | { | 511 | { |
@@ -571,8 +574,8 @@ static void rhine_power_init(struct net_device *dev) | |||
571 | default: | 574 | default: |
572 | reason = "Unknown"; | 575 | reason = "Unknown"; |
573 | } | 576 | } |
574 | printk(KERN_INFO "%s: Woke system up. Reason: %s.\n", | 577 | netdev_info(dev, "Woke system up. Reason: %s\n", |
575 | DRV_NAME, reason); | 578 | reason); |
576 | } | 579 | } |
577 | } | 580 | } |
578 | } | 581 | } |
@@ -586,8 +589,7 @@ static void rhine_chip_reset(struct net_device *dev) | |||
586 | IOSYNC; | 589 | IOSYNC; |
587 | 590 | ||
588 | if (ioread8(ioaddr + ChipCmd1) & Cmd1Reset) { | 591 | if (ioread8(ioaddr + ChipCmd1) & Cmd1Reset) { |
589 | printk(KERN_INFO "%s: Reset not complete yet. " | 592 | netdev_info(dev, "Reset not complete yet. Trying harder.\n"); |
590 | "Trying harder.\n", DRV_NAME); | ||
591 | 593 | ||
592 | /* Force reset */ | 594 | /* Force reset */ |
593 | if (rp->quirks & rqForceReset) | 595 | if (rp->quirks & rqForceReset) |
@@ -598,9 +600,9 @@ static void rhine_chip_reset(struct net_device *dev) | |||
598 | } | 600 | } |
599 | 601 | ||
600 | if (debug > 1) | 602 | if (debug > 1) |
601 | printk(KERN_INFO "%s: Reset %s.\n", dev->name, | 603 | netdev_info(dev, "Reset %s\n", |
602 | (ioread8(ioaddr + ChipCmd1) & Cmd1Reset) ? | 604 | (ioread8(ioaddr + ChipCmd1) & Cmd1Reset) ? |
603 | "failed" : "succeeded"); | 605 | "failed" : "succeeded"); |
604 | } | 606 | } |
605 | 607 | ||
606 | #ifdef USE_MMIO | 608 | #ifdef USE_MMIO |
@@ -728,9 +730,7 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, | |||
728 | 730 | ||
729 | /* when built into the kernel, we only print version if device is found */ | 731 | /* when built into the kernel, we only print version if device is found */ |
730 | #ifndef MODULE | 732 | #ifndef MODULE |
731 | static int printed_version; | 733 | pr_info_once("%s\n", version); |
732 | if (!printed_version++) | ||
733 | printk(version); | ||
734 | #endif | 734 | #endif |
735 | 735 | ||
736 | io_size = 256; | 736 | io_size = 256; |
@@ -765,8 +765,8 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, | |||
765 | /* this should always be supported */ | 765 | /* this should always be supported */ |
766 | rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); | 766 | rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); |
767 | if (rc) { | 767 | if (rc) { |
768 | printk(KERN_ERR "32-bit PCI DMA addresses not supported by " | 768 | dev_err(&pdev->dev, |
769 | "the card!?\n"); | 769 | "32-bit PCI DMA addresses not supported by the card!?\n"); |
770 | goto err_out; | 770 | goto err_out; |
771 | } | 771 | } |
772 | 772 | ||
@@ -774,7 +774,7 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, | |||
774 | if ((pci_resource_len(pdev, 0) < io_size) || | 774 | if ((pci_resource_len(pdev, 0) < io_size) || |
775 | (pci_resource_len(pdev, 1) < io_size)) { | 775 | (pci_resource_len(pdev, 1) < io_size)) { |
776 | rc = -EIO; | 776 | rc = -EIO; |
777 | printk(KERN_ERR "Insufficient PCI resources, aborting\n"); | 777 | dev_err(&pdev->dev, "Insufficient PCI resources, aborting\n"); |
778 | goto err_out; | 778 | goto err_out; |
779 | } | 779 | } |
780 | 780 | ||
@@ -786,7 +786,7 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, | |||
786 | dev = alloc_etherdev(sizeof(struct rhine_private)); | 786 | dev = alloc_etherdev(sizeof(struct rhine_private)); |
787 | if (!dev) { | 787 | if (!dev) { |
788 | rc = -ENOMEM; | 788 | rc = -ENOMEM; |
789 | printk(KERN_ERR "alloc_etherdev failed\n"); | 789 | dev_err(&pdev->dev, "alloc_etherdev failed\n"); |
790 | goto err_out; | 790 | goto err_out; |
791 | } | 791 | } |
792 | SET_NETDEV_DEV(dev, &pdev->dev); | 792 | SET_NETDEV_DEV(dev, &pdev->dev); |
@@ -804,8 +804,9 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, | |||
804 | ioaddr = pci_iomap(pdev, bar, io_size); | 804 | ioaddr = pci_iomap(pdev, bar, io_size); |
805 | if (!ioaddr) { | 805 | if (!ioaddr) { |
806 | rc = -EIO; | 806 | rc = -EIO; |
807 | printk(KERN_ERR "ioremap failed for device %s, region 0x%X " | 807 | dev_err(&pdev->dev, |
808 | "@ 0x%lX\n", pci_name(pdev), io_size, memaddr); | 808 | "ioremap failed for device %s, region 0x%X @ 0x%lX\n", |
809 | pci_name(pdev), io_size, memaddr); | ||
809 | goto err_out_free_res; | 810 | goto err_out_free_res; |
810 | } | 811 | } |
811 | 812 | ||
@@ -820,8 +821,9 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, | |||
820 | unsigned char b = readb(ioaddr+reg); | 821 | unsigned char b = readb(ioaddr+reg); |
821 | if (a != b) { | 822 | if (a != b) { |
822 | rc = -EIO; | 823 | rc = -EIO; |
823 | printk(KERN_ERR "MMIO do not match PIO [%02x] " | 824 | dev_err(&pdev->dev, |
824 | "(%02x != %02x)\n", reg, a, b); | 825 | "MMIO do not match PIO [%02x] (%02x != %02x)\n", |
826 | reg, a, b); | ||
825 | goto err_out_unmap; | 827 | goto err_out_unmap; |
826 | } | 828 | } |
827 | } | 829 | } |
@@ -840,7 +842,7 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, | |||
840 | 842 | ||
841 | if (!is_valid_ether_addr(dev->perm_addr)) { | 843 | if (!is_valid_ether_addr(dev->perm_addr)) { |
842 | rc = -EIO; | 844 | rc = -EIO; |
843 | printk(KERN_ERR "Invalid MAC address\n"); | 845 | dev_err(&pdev->dev, "Invalid MAC address\n"); |
844 | goto err_out_unmap; | 846 | goto err_out_unmap; |
845 | } | 847 | } |
846 | 848 | ||
@@ -878,14 +880,14 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, | |||
878 | if (rc) | 880 | if (rc) |
879 | goto err_out_unmap; | 881 | goto err_out_unmap; |
880 | 882 | ||
881 | printk(KERN_INFO "%s: VIA %s at 0x%lx, %pM, IRQ %d.\n", | 883 | netdev_info(dev, "VIA %s at 0x%lx, %pM, IRQ %d\n", |
882 | dev->name, name, | 884 | name, |
883 | #ifdef USE_MMIO | 885 | #ifdef USE_MMIO |
884 | memaddr, | 886 | memaddr, |
885 | #else | 887 | #else |
886 | (long)ioaddr, | 888 | (long)ioaddr, |
887 | #endif | 889 | #endif |
888 | dev->dev_addr, pdev->irq); | 890 | dev->dev_addr, pdev->irq); |
889 | 891 | ||
890 | pci_set_drvdata(pdev, dev); | 892 | pci_set_drvdata(pdev, dev); |
891 | 893 | ||
@@ -896,11 +898,11 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, | |||
896 | mdio_write(dev, phy_id, MII_BMCR, mii_cmd); | 898 | mdio_write(dev, phy_id, MII_BMCR, mii_cmd); |
897 | if (mii_status != 0xffff && mii_status != 0x0000) { | 899 | if (mii_status != 0xffff && mii_status != 0x0000) { |
898 | rp->mii_if.advertising = mdio_read(dev, phy_id, 4); | 900 | rp->mii_if.advertising = mdio_read(dev, phy_id, 4); |
899 | printk(KERN_INFO "%s: MII PHY found at address " | 901 | netdev_info(dev, |
900 | "%d, status 0x%4.4x advertising %4.4x " | 902 | "MII PHY found at address %d, status 0x%04x advertising %04x Link %04x\n", |
901 | "Link %4.4x.\n", dev->name, phy_id, | 903 | phy_id, |
902 | mii_status, rp->mii_if.advertising, | 904 | mii_status, rp->mii_if.advertising, |
903 | mdio_read(dev, phy_id, 5)); | 905 | mdio_read(dev, phy_id, 5)); |
904 | 906 | ||
905 | /* set IFF_RUNNING */ | 907 | /* set IFF_RUNNING */ |
906 | if (mii_status & BMSR_LSTATUS) | 908 | if (mii_status & BMSR_LSTATUS) |
@@ -912,8 +914,7 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, | |||
912 | } | 914 | } |
913 | rp->mii_if.phy_id = phy_id; | 915 | rp->mii_if.phy_id = phy_id; |
914 | if (debug > 1 && avoid_D3) | 916 | if (debug > 1 && avoid_D3) |
915 | printk(KERN_INFO "%s: No D3 power state at shutdown.\n", | 917 | netdev_info(dev, "No D3 power state at shutdown\n"); |
916 | dev->name); | ||
917 | 918 | ||
918 | return 0; | 919 | return 0; |
919 | 920 | ||
@@ -938,7 +939,7 @@ static int alloc_ring(struct net_device* dev) | |||
938 | TX_RING_SIZE * sizeof(struct tx_desc), | 939 | TX_RING_SIZE * sizeof(struct tx_desc), |
939 | &ring_dma); | 940 | &ring_dma); |
940 | if (!ring) { | 941 | if (!ring) { |
941 | printk(KERN_ERR "Could not allocate DMA memory.\n"); | 942 | netdev_err(dev, "Could not allocate DMA memory\n"); |
942 | return -ENOMEM; | 943 | return -ENOMEM; |
943 | } | 944 | } |
944 | if (rp->quirks & rqRhineI) { | 945 | if (rp->quirks & rqRhineI) { |
@@ -1098,8 +1099,8 @@ static void rhine_check_media(struct net_device *dev, unsigned int init_media) | |||
1098 | iowrite8(ioread8(ioaddr + ChipCmd1) & ~Cmd1FDuplex, | 1099 | iowrite8(ioread8(ioaddr + ChipCmd1) & ~Cmd1FDuplex, |
1099 | ioaddr + ChipCmd1); | 1100 | ioaddr + ChipCmd1); |
1100 | if (debug > 1) | 1101 | if (debug > 1) |
1101 | printk(KERN_INFO "%s: force_media %d, carrier %d\n", dev->name, | 1102 | netdev_info(dev, "force_media %d, carrier %d\n", |
1102 | rp->mii_if.force_media, netif_carrier_ok(dev)); | 1103 | rp->mii_if.force_media, netif_carrier_ok(dev)); |
1103 | } | 1104 | } |
1104 | 1105 | ||
1105 | /* Called after status of force_media possibly changed */ | 1106 | /* Called after status of force_media possibly changed */ |
@@ -1113,9 +1114,8 @@ static void rhine_set_carrier(struct mii_if_info *mii) | |||
1113 | else /* Let MMI library update carrier status */ | 1114 | else /* Let MMI library update carrier status */ |
1114 | rhine_check_media(mii->dev, 0); | 1115 | rhine_check_media(mii->dev, 0); |
1115 | if (debug > 1) | 1116 | if (debug > 1) |
1116 | printk(KERN_INFO "%s: force_media %d, carrier %d\n", | 1117 | netdev_info(mii->dev, "force_media %d, carrier %d\n", |
1117 | mii->dev->name, mii->force_media, | 1118 | mii->force_media, netif_carrier_ok(mii->dev)); |
1118 | netif_carrier_ok(mii->dev)); | ||
1119 | } | 1119 | } |
1120 | 1120 | ||
1121 | /** | 1121 | /** |
@@ -1402,8 +1402,7 @@ static int rhine_open(struct net_device *dev) | |||
1402 | return rc; | 1402 | return rc; |
1403 | 1403 | ||
1404 | if (debug > 1) | 1404 | if (debug > 1) |
1405 | printk(KERN_DEBUG "%s: rhine_open() irq %d.\n", | 1405 | netdev_dbg(dev, "%s() irq %d\n", __func__, rp->pdev->irq); |
1406 | dev->name, rp->pdev->irq); | ||
1407 | 1406 | ||
1408 | rc = alloc_ring(dev); | 1407 | rc = alloc_ring(dev); |
1409 | if (rc) { | 1408 | if (rc) { |
@@ -1415,10 +1414,9 @@ static int rhine_open(struct net_device *dev) | |||
1415 | rhine_chip_reset(dev); | 1414 | rhine_chip_reset(dev); |
1416 | init_registers(dev); | 1415 | init_registers(dev); |
1417 | if (debug > 2) | 1416 | if (debug > 2) |
1418 | printk(KERN_DEBUG "%s: Done rhine_open(), status %4.4x " | 1417 | netdev_dbg(dev, "%s() Done - status %04x MII status: %04x\n", |
1419 | "MII status: %4.4x.\n", | 1418 | __func__, ioread16(ioaddr + ChipCmd), |
1420 | dev->name, ioread16(ioaddr + ChipCmd), | 1419 | mdio_read(dev, rp->mii_if.phy_id, MII_BMSR)); |
1421 | mdio_read(dev, rp->mii_if.phy_id, MII_BMSR)); | ||
1422 | 1420 | ||
1423 | netif_start_queue(dev); | 1421 | netif_start_queue(dev); |
1424 | 1422 | ||
@@ -1461,10 +1459,9 @@ static void rhine_tx_timeout(struct net_device *dev) | |||
1461 | struct rhine_private *rp = netdev_priv(dev); | 1459 | struct rhine_private *rp = netdev_priv(dev); |
1462 | void __iomem *ioaddr = rp->base; | 1460 | void __iomem *ioaddr = rp->base; |
1463 | 1461 | ||
1464 | printk(KERN_WARNING "%s: Transmit timed out, status %4.4x, PHY status " | 1462 | netdev_warn(dev, "Transmit timed out, status %04x, PHY status %04x, resetting...\n", |
1465 | "%4.4x, resetting...\n", | 1463 | ioread16(ioaddr + IntrStatus), |
1466 | dev->name, ioread16(ioaddr + IntrStatus), | 1464 | mdio_read(dev, rp->mii_if.phy_id, MII_BMSR)); |
1467 | mdio_read(dev, rp->mii_if.phy_id, MII_BMSR)); | ||
1468 | 1465 | ||
1469 | schedule_work(&rp->reset_task); | 1466 | schedule_work(&rp->reset_task); |
1470 | } | 1467 | } |
@@ -1551,8 +1548,8 @@ static netdev_tx_t rhine_start_tx(struct sk_buff *skb, | |||
1551 | spin_unlock_irqrestore(&rp->lock, flags); | 1548 | spin_unlock_irqrestore(&rp->lock, flags); |
1552 | 1549 | ||
1553 | if (debug > 4) { | 1550 | if (debug > 4) { |
1554 | printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d.\n", | 1551 | netdev_dbg(dev, "Transmit frame #%d queued in slot %d\n", |
1555 | dev->name, rp->cur_tx-1, entry); | 1552 | rp->cur_tx-1, entry); |
1556 | } | 1553 | } |
1557 | return NETDEV_TX_OK; | 1554 | return NETDEV_TX_OK; |
1558 | } | 1555 | } |
@@ -1578,8 +1575,8 @@ static irqreturn_t rhine_interrupt(int irq, void *dev_instance) | |||
1578 | IOSYNC; | 1575 | IOSYNC; |
1579 | 1576 | ||
1580 | if (debug > 4) | 1577 | if (debug > 4) |
1581 | printk(KERN_DEBUG "%s: Interrupt, status %8.8x.\n", | 1578 | netdev_dbg(dev, "Interrupt, status %08x\n", |
1582 | dev->name, intr_status); | 1579 | intr_status); |
1583 | 1580 | ||
1584 | if (intr_status & (IntrRxDone | IntrRxErr | IntrRxDropped | | 1581 | if (intr_status & (IntrRxDone | IntrRxErr | IntrRxDropped | |
1585 | IntrRxWakeUp | IntrRxEmpty | IntrRxNoBuf)) { | 1582 | IntrRxWakeUp | IntrRxEmpty | IntrRxNoBuf)) { |
@@ -1597,9 +1594,9 @@ static irqreturn_t rhine_interrupt(int irq, void *dev_instance) | |||
1597 | RHINE_WAIT_FOR(!(ioread8(ioaddr+ChipCmd) & CmdTxOn)); | 1594 | RHINE_WAIT_FOR(!(ioread8(ioaddr+ChipCmd) & CmdTxOn)); |
1598 | if (debug > 2 && | 1595 | if (debug > 2 && |
1599 | ioread8(ioaddr+ChipCmd) & CmdTxOn) | 1596 | ioread8(ioaddr+ChipCmd) & CmdTxOn) |
1600 | printk(KERN_WARNING "%s: " | 1597 | netdev_warn(dev, |
1601 | "rhine_interrupt() Tx engine " | 1598 | "%s: Tx engine still on\n", |
1602 | "still on.\n", dev->name); | 1599 | __func__); |
1603 | } | 1600 | } |
1604 | rhine_tx(dev); | 1601 | rhine_tx(dev); |
1605 | } | 1602 | } |
@@ -1611,16 +1608,15 @@ static irqreturn_t rhine_interrupt(int irq, void *dev_instance) | |||
1611 | rhine_error(dev, intr_status); | 1608 | rhine_error(dev, intr_status); |
1612 | 1609 | ||
1613 | if (--boguscnt < 0) { | 1610 | if (--boguscnt < 0) { |
1614 | printk(KERN_WARNING "%s: Too much work at interrupt, " | 1611 | netdev_warn(dev, "Too much work at interrupt, status=%#08x\n", |
1615 | "status=%#8.8x.\n", | 1612 | intr_status); |
1616 | dev->name, intr_status); | ||
1617 | break; | 1613 | break; |
1618 | } | 1614 | } |
1619 | } | 1615 | } |
1620 | 1616 | ||
1621 | if (debug > 3) | 1617 | if (debug > 3) |
1622 | printk(KERN_DEBUG "%s: exiting interrupt, status=%8.8x.\n", | 1618 | netdev_dbg(dev, "exiting interrupt, status=%08x\n", |
1623 | dev->name, ioread16(ioaddr + IntrStatus)); | 1619 | ioread16(ioaddr + IntrStatus)); |
1624 | return IRQ_RETVAL(handled); | 1620 | return IRQ_RETVAL(handled); |
1625 | } | 1621 | } |
1626 | 1622 | ||
@@ -1637,15 +1633,14 @@ static void rhine_tx(struct net_device *dev) | |||
1637 | while (rp->dirty_tx != rp->cur_tx) { | 1633 | while (rp->dirty_tx != rp->cur_tx) { |
1638 | txstatus = le32_to_cpu(rp->tx_ring[entry].tx_status); | 1634 | txstatus = le32_to_cpu(rp->tx_ring[entry].tx_status); |
1639 | if (debug > 6) | 1635 | if (debug > 6) |
1640 | printk(KERN_DEBUG "Tx scavenge %d status %8.8x.\n", | 1636 | netdev_dbg(dev, "Tx scavenge %d status %08x\n", |
1641 | entry, txstatus); | 1637 | entry, txstatus); |
1642 | if (txstatus & DescOwn) | 1638 | if (txstatus & DescOwn) |
1643 | break; | 1639 | break; |
1644 | if (txstatus & 0x8000) { | 1640 | if (txstatus & 0x8000) { |
1645 | if (debug > 1) | 1641 | if (debug > 1) |
1646 | printk(KERN_DEBUG "%s: Transmit error, " | 1642 | netdev_dbg(dev, "Transmit error, Tx status %08x\n", |
1647 | "Tx status %8.8x.\n", | 1643 | txstatus); |
1648 | dev->name, txstatus); | ||
1649 | dev->stats.tx_errors++; | 1644 | dev->stats.tx_errors++; |
1650 | if (txstatus & 0x0400) | 1645 | if (txstatus & 0x0400) |
1651 | dev->stats.tx_carrier_errors++; | 1646 | dev->stats.tx_carrier_errors++; |
@@ -1668,9 +1663,9 @@ static void rhine_tx(struct net_device *dev) | |||
1668 | else | 1663 | else |
1669 | dev->stats.collisions += txstatus & 0x0F; | 1664 | dev->stats.collisions += txstatus & 0x0F; |
1670 | if (debug > 6) | 1665 | if (debug > 6) |
1671 | printk(KERN_DEBUG "collisions: %1.1x:%1.1x\n", | 1666 | netdev_dbg(dev, "collisions: %1.1x:%1.1x\n", |
1672 | (txstatus >> 3) & 0xF, | 1667 | (txstatus >> 3) & 0xF, |
1673 | txstatus & 0xF); | 1668 | txstatus & 0xF); |
1674 | dev->stats.tx_bytes += rp->tx_skbuff[entry]->len; | 1669 | dev->stats.tx_bytes += rp->tx_skbuff[entry]->len; |
1675 | dev->stats.tx_packets++; | 1670 | dev->stats.tx_packets++; |
1676 | } | 1671 | } |
@@ -1714,9 +1709,9 @@ static int rhine_rx(struct net_device *dev, int limit) | |||
1714 | int entry = rp->cur_rx % RX_RING_SIZE; | 1709 | int entry = rp->cur_rx % RX_RING_SIZE; |
1715 | 1710 | ||
1716 | if (debug > 4) { | 1711 | if (debug > 4) { |
1717 | printk(KERN_DEBUG "%s: rhine_rx(), entry %d status %8.8x.\n", | 1712 | netdev_dbg(dev, "%s(), entry %d status %08x\n", |
1718 | dev->name, entry, | 1713 | __func__, entry, |
1719 | le32_to_cpu(rp->rx_head_desc->rx_status)); | 1714 | le32_to_cpu(rp->rx_head_desc->rx_status)); |
1720 | } | 1715 | } |
1721 | 1716 | ||
1722 | /* If EOP is set on the next entry, it's a new packet. Send it up. */ | 1717 | /* If EOP is set on the next entry, it's a new packet. Send it up. */ |
@@ -1730,26 +1725,26 @@ static int rhine_rx(struct net_device *dev, int limit) | |||
1730 | break; | 1725 | break; |
1731 | 1726 | ||
1732 | if (debug > 4) | 1727 | if (debug > 4) |
1733 | printk(KERN_DEBUG "rhine_rx() status is %8.8x.\n", | 1728 | netdev_dbg(dev, "%s() status is %08x\n", |
1734 | desc_status); | 1729 | __func__, desc_status); |
1735 | 1730 | ||
1736 | if ((desc_status & (RxWholePkt | RxErr)) != RxWholePkt) { | 1731 | if ((desc_status & (RxWholePkt | RxErr)) != RxWholePkt) { |
1737 | if ((desc_status & RxWholePkt) != RxWholePkt) { | 1732 | if ((desc_status & RxWholePkt) != RxWholePkt) { |
1738 | printk(KERN_WARNING "%s: Oversized Ethernet " | 1733 | netdev_warn(dev, |
1739 | "frame spanned multiple buffers, entry " | 1734 | "Oversized Ethernet frame spanned multiple buffers, " |
1740 | "%#x length %d status %8.8x!\n", | 1735 | "entry %#x length %d status %08x!\n", |
1741 | dev->name, entry, data_size, | 1736 | entry, data_size, |
1742 | desc_status); | 1737 | desc_status); |
1743 | printk(KERN_WARNING "%s: Oversized Ethernet " | 1738 | netdev_warn(dev, |
1744 | "frame %p vs %p.\n", dev->name, | 1739 | "Oversized Ethernet frame %p vs %p\n", |
1745 | rp->rx_head_desc, &rp->rx_ring[entry]); | 1740 | rp->rx_head_desc, |
1741 | &rp->rx_ring[entry]); | ||
1746 | dev->stats.rx_length_errors++; | 1742 | dev->stats.rx_length_errors++; |
1747 | } else if (desc_status & RxErr) { | 1743 | } else if (desc_status & RxErr) { |
1748 | /* There was a error. */ | 1744 | /* There was a error. */ |
1749 | if (debug > 2) | 1745 | if (debug > 2) |
1750 | printk(KERN_DEBUG "rhine_rx() Rx " | 1746 | netdev_dbg(dev, "%s() Rx error was %08x\n", |
1751 | "error was %8.8x.\n", | 1747 | __func__, desc_status); |
1752 | desc_status); | ||
1753 | dev->stats.rx_errors++; | 1748 | dev->stats.rx_errors++; |
1754 | if (desc_status & 0x0030) | 1749 | if (desc_status & 0x0030) |
1755 | dev->stats.rx_length_errors++; | 1750 | dev->stats.rx_length_errors++; |
@@ -1791,9 +1786,7 @@ static int rhine_rx(struct net_device *dev, int limit) | |||
1791 | } else { | 1786 | } else { |
1792 | skb = rp->rx_skbuff[entry]; | 1787 | skb = rp->rx_skbuff[entry]; |
1793 | if (skb == NULL) { | 1788 | if (skb == NULL) { |
1794 | printk(KERN_ERR "%s: Inconsistent Rx " | 1789 | netdev_err(dev, "Inconsistent Rx descriptor chain\n"); |
1795 | "descriptor chain.\n", | ||
1796 | dev->name); | ||
1797 | break; | 1790 | break; |
1798 | } | 1791 | } |
1799 | rp->rx_skbuff[entry] = NULL; | 1792 | rp->rx_skbuff[entry] = NULL; |
@@ -1886,9 +1879,8 @@ static void rhine_restart_tx(struct net_device *dev) { | |||
1886 | else { | 1879 | else { |
1887 | /* This should never happen */ | 1880 | /* This should never happen */ |
1888 | if (debug > 1) | 1881 | if (debug > 1) |
1889 | printk(KERN_WARNING "%s: rhine_restart_tx() " | 1882 | netdev_warn(dev, "%s() Another error occurred %08x\n", |
1890 | "Another error occurred %8.8x.\n", | 1883 | __func__, intr_status); |
1891 | dev->name, intr_status); | ||
1892 | } | 1884 | } |
1893 | 1885 | ||
1894 | } | 1886 | } |
@@ -1909,21 +1901,19 @@ static void rhine_error(struct net_device *dev, int intr_status) | |||
1909 | } | 1901 | } |
1910 | if (intr_status & IntrTxAborted) { | 1902 | if (intr_status & IntrTxAborted) { |
1911 | if (debug > 1) | 1903 | if (debug > 1) |
1912 | printk(KERN_INFO "%s: Abort %8.8x, frame dropped.\n", | 1904 | netdev_info(dev, "Abort %08x, frame dropped\n", |
1913 | dev->name, intr_status); | 1905 | intr_status); |
1914 | } | 1906 | } |
1915 | if (intr_status & IntrTxUnderrun) { | 1907 | if (intr_status & IntrTxUnderrun) { |
1916 | if (rp->tx_thresh < 0xE0) | 1908 | if (rp->tx_thresh < 0xE0) |
1917 | BYTE_REG_BITS_SET((rp->tx_thresh += 0x20), 0x80, ioaddr + TxConfig); | 1909 | BYTE_REG_BITS_SET((rp->tx_thresh += 0x20), 0x80, ioaddr + TxConfig); |
1918 | if (debug > 1) | 1910 | if (debug > 1) |
1919 | printk(KERN_INFO "%s: Transmitter underrun, Tx " | 1911 | netdev_info(dev, "Transmitter underrun, Tx threshold now %02x\n", |
1920 | "threshold now %2.2x.\n", | 1912 | rp->tx_thresh); |
1921 | dev->name, rp->tx_thresh); | ||
1922 | } | 1913 | } |
1923 | if (intr_status & IntrTxDescRace) { | 1914 | if (intr_status & IntrTxDescRace) { |
1924 | if (debug > 2) | 1915 | if (debug > 2) |
1925 | printk(KERN_INFO "%s: Tx descriptor write-back race.\n", | 1916 | netdev_info(dev, "Tx descriptor write-back race\n"); |
1926 | dev->name); | ||
1927 | } | 1917 | } |
1928 | if ((intr_status & IntrTxError) && | 1918 | if ((intr_status & IntrTxError) && |
1929 | (intr_status & (IntrTxAborted | | 1919 | (intr_status & (IntrTxAborted | |
@@ -1932,9 +1922,8 @@ static void rhine_error(struct net_device *dev, int intr_status) | |||
1932 | BYTE_REG_BITS_SET((rp->tx_thresh += 0x20), 0x80, ioaddr + TxConfig); | 1922 | BYTE_REG_BITS_SET((rp->tx_thresh += 0x20), 0x80, ioaddr + TxConfig); |
1933 | } | 1923 | } |
1934 | if (debug > 1) | 1924 | if (debug > 1) |
1935 | printk(KERN_INFO "%s: Unspecified error. Tx " | 1925 | netdev_info(dev, "Unspecified error. Tx threshold now %02x\n", |
1936 | "threshold now %2.2x.\n", | 1926 | rp->tx_thresh); |
1937 | dev->name, rp->tx_thresh); | ||
1938 | } | 1927 | } |
1939 | if (intr_status & (IntrTxAborted | IntrTxUnderrun | IntrTxDescRace | | 1928 | if (intr_status & (IntrTxAborted | IntrTxUnderrun | IntrTxDescRace | |
1940 | IntrTxError)) | 1929 | IntrTxError)) |
@@ -1944,8 +1933,8 @@ static void rhine_error(struct net_device *dev, int intr_status) | |||
1944 | IntrTxError | IntrTxAborted | IntrNormalSummary | | 1933 | IntrTxError | IntrTxAborted | IntrNormalSummary | |
1945 | IntrTxDescRace)) { | 1934 | IntrTxDescRace)) { |
1946 | if (debug > 1) | 1935 | if (debug > 1) |
1947 | printk(KERN_ERR "%s: Something Wicked happened! " | 1936 | netdev_err(dev, "Something Wicked happened! %08x\n", |
1948 | "%8.8x.\n", dev->name, intr_status); | 1937 | intr_status); |
1949 | } | 1938 | } |
1950 | 1939 | ||
1951 | spin_unlock(&rp->lock); | 1940 | spin_unlock(&rp->lock); |
@@ -2145,9 +2134,8 @@ static int rhine_close(struct net_device *dev) | |||
2145 | spin_lock_irq(&rp->lock); | 2134 | spin_lock_irq(&rp->lock); |
2146 | 2135 | ||
2147 | if (debug > 1) | 2136 | if (debug > 1) |
2148 | printk(KERN_DEBUG "%s: Shutting down ethercard, " | 2137 | netdev_dbg(dev, "Shutting down ethercard, status was %04x\n", |
2149 | "status was %4.4x.\n", | 2138 | ioread16(ioaddr + ChipCmd)); |
2150 | dev->name, ioread16(ioaddr + ChipCmd)); | ||
2151 | 2139 | ||
2152 | /* Switch to loopback mode to avoid hardware races. */ | 2140 | /* Switch to loopback mode to avoid hardware races. */ |
2153 | iowrite8(rp->tx_thresh | 0x02, ioaddr + TxConfig); | 2141 | iowrite8(rp->tx_thresh | 0x02, ioaddr + TxConfig); |
@@ -2265,12 +2253,12 @@ static int rhine_resume(struct pci_dev *pdev) | |||
2265 | return 0; | 2253 | return 0; |
2266 | 2254 | ||
2267 | if (request_irq(dev->irq, rhine_interrupt, IRQF_SHARED, dev->name, dev)) | 2255 | if (request_irq(dev->irq, rhine_interrupt, IRQF_SHARED, dev->name, dev)) |
2268 | printk(KERN_ERR "via-rhine %s: request_irq failed\n", dev->name); | 2256 | netdev_err(dev, "request_irq failed\n"); |
2269 | 2257 | ||
2270 | ret = pci_set_power_state(pdev, PCI_D0); | 2258 | ret = pci_set_power_state(pdev, PCI_D0); |
2271 | if (debug > 1) | 2259 | if (debug > 1) |
2272 | printk(KERN_INFO "%s: Entering power state D0 %s (%d).\n", | 2260 | netdev_info(dev, "Entering power state D0 %s (%d)\n", |
2273 | dev->name, ret ? "failed" : "succeeded", ret); | 2261 | ret ? "failed" : "succeeded", ret); |
2274 | 2262 | ||
2275 | pci_restore_state(pdev); | 2263 | pci_restore_state(pdev); |
2276 | 2264 | ||
@@ -2326,17 +2314,15 @@ static int __init rhine_init(void) | |||
2326 | { | 2314 | { |
2327 | /* when a module, this is printed whether or not devices are found in probe */ | 2315 | /* when a module, this is printed whether or not devices are found in probe */ |
2328 | #ifdef MODULE | 2316 | #ifdef MODULE |
2329 | printk(version); | 2317 | pr_info("%s\n", version); |
2330 | #endif | 2318 | #endif |
2331 | if (dmi_check_system(rhine_dmi_table)) { | 2319 | if (dmi_check_system(rhine_dmi_table)) { |
2332 | /* these BIOSes fail at PXE boot if chip is in D3 */ | 2320 | /* these BIOSes fail at PXE boot if chip is in D3 */ |
2333 | avoid_D3 = 1; | 2321 | avoid_D3 = 1; |
2334 | printk(KERN_WARNING "%s: Broken BIOS detected, avoid_D3 " | 2322 | pr_warn("Broken BIOS detected, avoid_D3 enabled\n"); |
2335 | "enabled.\n", | ||
2336 | DRV_NAME); | ||
2337 | } | 2323 | } |
2338 | else if (avoid_D3) | 2324 | else if (avoid_D3) |
2339 | printk(KERN_INFO "%s: avoid_D3 set.\n", DRV_NAME); | 2325 | pr_info("avoid_D3 set\n"); |
2340 | 2326 | ||
2341 | return pci_register_driver(&rhine_driver); | 2327 | return pci_register_driver(&rhine_driver); |
2342 | } | 2328 | } |