diff options
Diffstat (limited to 'drivers/net/8139too.c')
-rw-r--r-- | drivers/net/8139too.c | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c index abd6261465f1..dbc5c0b1b96c 100644 --- a/drivers/net/8139too.c +++ b/drivers/net/8139too.c | |||
@@ -90,10 +90,9 @@ | |||
90 | */ | 90 | */ |
91 | 91 | ||
92 | #define DRV_NAME "8139too" | 92 | #define DRV_NAME "8139too" |
93 | #define DRV_VERSION "0.9.27" | 93 | #define DRV_VERSION "0.9.28" |
94 | 94 | ||
95 | 95 | ||
96 | #include <linux/config.h> | ||
97 | #include <linux/module.h> | 96 | #include <linux/module.h> |
98 | #include <linux/kernel.h> | 97 | #include <linux/kernel.h> |
99 | #include <linux/compiler.h> | 98 | #include <linux/compiler.h> |
@@ -640,7 +639,7 @@ static void __set_rx_mode (struct net_device *dev); | |||
640 | static void rtl8139_hw_start (struct net_device *dev); | 639 | static void rtl8139_hw_start (struct net_device *dev); |
641 | static void rtl8139_thread (void *_data); | 640 | static void rtl8139_thread (void *_data); |
642 | static void rtl8139_tx_timeout_task(void *_data); | 641 | static void rtl8139_tx_timeout_task(void *_data); |
643 | static struct ethtool_ops rtl8139_ethtool_ops; | 642 | static const struct ethtool_ops rtl8139_ethtool_ops; |
644 | 643 | ||
645 | /* write MMIO register, with flush */ | 644 | /* write MMIO register, with flush */ |
646 | /* Flush avoids rtl8139 bug w/ posted MMIO writes */ | 645 | /* Flush avoids rtl8139 bug w/ posted MMIO writes */ |
@@ -769,7 +768,7 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev, | |||
769 | /* dev and priv zeroed in alloc_etherdev */ | 768 | /* dev and priv zeroed in alloc_etherdev */ |
770 | dev = alloc_etherdev (sizeof (*tp)); | 769 | dev = alloc_etherdev (sizeof (*tp)); |
771 | if (dev == NULL) { | 770 | if (dev == NULL) { |
772 | printk (KERN_ERR PFX "%s: Unable to alloc new net device\n", pci_name(pdev)); | 771 | dev_err(&pdev->dev, "Unable to alloc new net device\n"); |
773 | return -ENOMEM; | 772 | return -ENOMEM; |
774 | } | 773 | } |
775 | SET_MODULE_OWNER(dev); | 774 | SET_MODULE_OWNER(dev); |
@@ -801,31 +800,31 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev, | |||
801 | #ifdef USE_IO_OPS | 800 | #ifdef USE_IO_OPS |
802 | /* make sure PCI base addr 0 is PIO */ | 801 | /* make sure PCI base addr 0 is PIO */ |
803 | if (!(pio_flags & IORESOURCE_IO)) { | 802 | if (!(pio_flags & IORESOURCE_IO)) { |
804 | printk (KERN_ERR PFX "%s: region #0 not a PIO resource, aborting\n", pci_name(pdev)); | 803 | dev_err(&pdev->dev, "region #0 not a PIO resource, aborting\n"); |
805 | rc = -ENODEV; | 804 | rc = -ENODEV; |
806 | goto err_out; | 805 | goto err_out; |
807 | } | 806 | } |
808 | /* check for weird/broken PCI region reporting */ | 807 | /* check for weird/broken PCI region reporting */ |
809 | if (pio_len < RTL_MIN_IO_SIZE) { | 808 | if (pio_len < RTL_MIN_IO_SIZE) { |
810 | printk (KERN_ERR PFX "%s: Invalid PCI I/O region size(s), aborting\n", pci_name(pdev)); | 809 | dev_err(&pdev->dev, "Invalid PCI I/O region size(s), aborting\n"); |
811 | rc = -ENODEV; | 810 | rc = -ENODEV; |
812 | goto err_out; | 811 | goto err_out; |
813 | } | 812 | } |
814 | #else | 813 | #else |
815 | /* make sure PCI base addr 1 is MMIO */ | 814 | /* make sure PCI base addr 1 is MMIO */ |
816 | if (!(mmio_flags & IORESOURCE_MEM)) { | 815 | if (!(mmio_flags & IORESOURCE_MEM)) { |
817 | printk (KERN_ERR PFX "%s: region #1 not an MMIO resource, aborting\n", pci_name(pdev)); | 816 | dev_err(&pdev->dev, "region #1 not an MMIO resource, aborting\n"); |
818 | rc = -ENODEV; | 817 | rc = -ENODEV; |
819 | goto err_out; | 818 | goto err_out; |
820 | } | 819 | } |
821 | if (mmio_len < RTL_MIN_IO_SIZE) { | 820 | if (mmio_len < RTL_MIN_IO_SIZE) { |
822 | printk (KERN_ERR PFX "%s: Invalid PCI mem region size(s), aborting\n", pci_name(pdev)); | 821 | dev_err(&pdev->dev, "Invalid PCI mem region size(s), aborting\n"); |
823 | rc = -ENODEV; | 822 | rc = -ENODEV; |
824 | goto err_out; | 823 | goto err_out; |
825 | } | 824 | } |
826 | #endif | 825 | #endif |
827 | 826 | ||
828 | rc = pci_request_regions (pdev, "8139too"); | 827 | rc = pci_request_regions (pdev, DRV_NAME); |
829 | if (rc) | 828 | if (rc) |
830 | goto err_out; | 829 | goto err_out; |
831 | disable_dev_on_err = 1; | 830 | disable_dev_on_err = 1; |
@@ -836,7 +835,7 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev, | |||
836 | #ifdef USE_IO_OPS | 835 | #ifdef USE_IO_OPS |
837 | ioaddr = ioport_map(pio_start, pio_len); | 836 | ioaddr = ioport_map(pio_start, pio_len); |
838 | if (!ioaddr) { | 837 | if (!ioaddr) { |
839 | printk (KERN_ERR PFX "%s: cannot map PIO, aborting\n", pci_name(pdev)); | 838 | dev_err(&pdev->dev, "cannot map PIO, aborting\n"); |
840 | rc = -EIO; | 839 | rc = -EIO; |
841 | goto err_out; | 840 | goto err_out; |
842 | } | 841 | } |
@@ -847,7 +846,7 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev, | |||
847 | /* ioremap MMIO region */ | 846 | /* ioremap MMIO region */ |
848 | ioaddr = pci_iomap(pdev, 1, 0); | 847 | ioaddr = pci_iomap(pdev, 1, 0); |
849 | if (ioaddr == NULL) { | 848 | if (ioaddr == NULL) { |
850 | printk (KERN_ERR PFX "%s: cannot remap MMIO, aborting\n", pci_name(pdev)); | 849 | dev_err(&pdev->dev, "cannot remap MMIO, aborting\n"); |
851 | rc = -EIO; | 850 | rc = -EIO; |
852 | goto err_out; | 851 | goto err_out; |
853 | } | 852 | } |
@@ -861,8 +860,7 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev, | |||
861 | 860 | ||
862 | /* check for missing/broken hardware */ | 861 | /* check for missing/broken hardware */ |
863 | if (RTL_R32 (TxConfig) == 0xFFFFFFFF) { | 862 | if (RTL_R32 (TxConfig) == 0xFFFFFFFF) { |
864 | printk (KERN_ERR PFX "%s: Chip not responding, ignoring board\n", | 863 | dev_err(&pdev->dev, "Chip not responding, ignoring board\n"); |
865 | pci_name(pdev)); | ||
866 | rc = -EIO; | 864 | rc = -EIO; |
867 | goto err_out; | 865 | goto err_out; |
868 | } | 866 | } |
@@ -876,9 +874,10 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev, | |||
876 | } | 874 | } |
877 | 875 | ||
878 | /* if unknown chip, assume array element #0, original RTL-8139 in this case */ | 876 | /* if unknown chip, assume array element #0, original RTL-8139 in this case */ |
879 | printk (KERN_DEBUG PFX "%s: unknown chip version, assuming RTL-8139\n", | 877 | dev_printk (KERN_DEBUG, &pdev->dev, |
880 | pci_name(pdev)); | 878 | "unknown chip version, assuming RTL-8139\n"); |
881 | printk (KERN_DEBUG PFX "%s: TxConfig = 0x%lx\n", pci_name(pdev), RTL_R32 (TxConfig)); | 879 | dev_printk (KERN_DEBUG, &pdev->dev, |
880 | "TxConfig = 0x%lx\n", RTL_R32 (TxConfig)); | ||
882 | tp->chipset = 0; | 881 | tp->chipset = 0; |
883 | 882 | ||
884 | match: | 883 | match: |
@@ -955,9 +954,11 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev, | |||
955 | 954 | ||
956 | if (pdev->vendor == PCI_VENDOR_ID_REALTEK && | 955 | if (pdev->vendor == PCI_VENDOR_ID_REALTEK && |
957 | pdev->device == PCI_DEVICE_ID_REALTEK_8139 && pci_rev >= 0x20) { | 956 | pdev->device == PCI_DEVICE_ID_REALTEK_8139 && pci_rev >= 0x20) { |
958 | printk(KERN_INFO PFX "pci dev %s (id %04x:%04x rev %02x) is an enhanced 8139C+ chip\n", | 957 | dev_info(&pdev->dev, |
959 | pci_name(pdev), pdev->vendor, pdev->device, pci_rev); | 958 | "This (id %04x:%04x rev %02x) is an enhanced 8139C+ chip\n", |
960 | printk(KERN_INFO PFX "Use the \"8139cp\" driver for improved performance and stability.\n"); | 959 | pdev->vendor, pdev->device, pci_rev); |
960 | dev_info(&pdev->dev, | ||
961 | "Use the \"8139cp\" driver for improved performance and stability.\n"); | ||
961 | } | 962 | } |
962 | 963 | ||
963 | i = rtl8139_init_board (pdev, &dev); | 964 | i = rtl8139_init_board (pdev, &dev); |
@@ -1311,7 +1312,7 @@ static int rtl8139_open (struct net_device *dev) | |||
1311 | int retval; | 1312 | int retval; |
1312 | void __iomem *ioaddr = tp->mmio_addr; | 1313 | void __iomem *ioaddr = tp->mmio_addr; |
1313 | 1314 | ||
1314 | retval = request_irq (dev->irq, rtl8139_interrupt, SA_SHIRQ, dev->name, dev); | 1315 | retval = request_irq (dev->irq, rtl8139_interrupt, IRQF_SHARED, dev->name, dev); |
1315 | if (retval) | 1316 | if (retval) |
1316 | return retval; | 1317 | return retval; |
1317 | 1318 | ||
@@ -1341,9 +1342,9 @@ static int rtl8139_open (struct net_device *dev) | |||
1341 | netif_start_queue (dev); | 1342 | netif_start_queue (dev); |
1342 | 1343 | ||
1343 | if (netif_msg_ifup(tp)) | 1344 | if (netif_msg_ifup(tp)) |
1344 | printk(KERN_DEBUG "%s: rtl8139_open() ioaddr %#lx IRQ %d" | 1345 | printk(KERN_DEBUG "%s: rtl8139_open() ioaddr %#llx IRQ %d" |
1345 | " GP Pins %2.2x %s-duplex.\n", | 1346 | " GP Pins %2.2x %s-duplex.\n", dev->name, |
1346 | dev->name, pci_resource_start (tp->pci_dev, 1), | 1347 | (unsigned long long)pci_resource_start (tp->pci_dev, 1), |
1347 | dev->irq, RTL_R8 (MediaStatus), | 1348 | dev->irq, RTL_R8 (MediaStatus), |
1348 | tp->mii.full_duplex ? "full" : "half"); | 1349 | tp->mii.full_duplex ? "full" : "half"); |
1349 | 1350 | ||
@@ -1708,6 +1709,7 @@ static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev) | |||
1708 | void __iomem *ioaddr = tp->mmio_addr; | 1709 | void __iomem *ioaddr = tp->mmio_addr; |
1709 | unsigned int entry; | 1710 | unsigned int entry; |
1710 | unsigned int len = skb->len; | 1711 | unsigned int len = skb->len; |
1712 | unsigned long flags; | ||
1711 | 1713 | ||
1712 | /* Calculate the next Tx descriptor entry. */ | 1714 | /* Calculate the next Tx descriptor entry. */ |
1713 | entry = tp->cur_tx % NUM_TX_DESC; | 1715 | entry = tp->cur_tx % NUM_TX_DESC; |
@@ -1724,7 +1726,7 @@ static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev) | |||
1724 | return 0; | 1726 | return 0; |
1725 | } | 1727 | } |
1726 | 1728 | ||
1727 | spin_lock_irq(&tp->lock); | 1729 | spin_lock_irqsave(&tp->lock, flags); |
1728 | RTL_W32_F (TxStatus0 + (entry * sizeof (u32)), | 1730 | RTL_W32_F (TxStatus0 + (entry * sizeof (u32)), |
1729 | tp->tx_flag | max(len, (unsigned int)ETH_ZLEN)); | 1731 | tp->tx_flag | max(len, (unsigned int)ETH_ZLEN)); |
1730 | 1732 | ||
@@ -1735,7 +1737,7 @@ static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev) | |||
1735 | 1737 | ||
1736 | if ((tp->cur_tx - NUM_TX_DESC) == tp->dirty_tx) | 1738 | if ((tp->cur_tx - NUM_TX_DESC) == tp->dirty_tx) |
1737 | netif_stop_queue (dev); | 1739 | netif_stop_queue (dev); |
1738 | spin_unlock_irq(&tp->lock); | 1740 | spin_unlock_irqrestore(&tp->lock, flags); |
1739 | 1741 | ||
1740 | if (netif_msg_tx_queued(tp)) | 1742 | if (netif_msg_tx_queued(tp)) |
1741 | printk (KERN_DEBUG "%s: Queued Tx packet size %u to slot %d.\n", | 1743 | printk (KERN_DEBUG "%s: Queued Tx packet size %u to slot %d.\n", |
@@ -2444,7 +2446,7 @@ static void rtl8139_get_strings(struct net_device *dev, u32 stringset, u8 *data) | |||
2444 | memcpy(data, ethtool_stats_keys, sizeof(ethtool_stats_keys)); | 2446 | memcpy(data, ethtool_stats_keys, sizeof(ethtool_stats_keys)); |
2445 | } | 2447 | } |
2446 | 2448 | ||
2447 | static struct ethtool_ops rtl8139_ethtool_ops = { | 2449 | static const struct ethtool_ops rtl8139_ethtool_ops = { |
2448 | .get_drvinfo = rtl8139_get_drvinfo, | 2450 | .get_drvinfo = rtl8139_get_drvinfo, |
2449 | .get_settings = rtl8139_get_settings, | 2451 | .get_settings = rtl8139_get_settings, |
2450 | .set_settings = rtl8139_set_settings, | 2452 | .set_settings = rtl8139_set_settings, |
@@ -2510,9 +2512,6 @@ static void __set_rx_mode (struct net_device *dev) | |||
2510 | 2512 | ||
2511 | /* Note: do not reorder, GCC is clever about common statements. */ | 2513 | /* Note: do not reorder, GCC is clever about common statements. */ |
2512 | if (dev->flags & IFF_PROMISC) { | 2514 | if (dev->flags & IFF_PROMISC) { |
2513 | /* Unconditionally log net taps. */ | ||
2514 | printk (KERN_NOTICE "%s: Promiscuous mode enabled.\n", | ||
2515 | dev->name); | ||
2516 | rx_mode = | 2515 | rx_mode = |
2517 | AcceptBroadcast | AcceptMulticast | AcceptMyPhys | | 2516 | AcceptBroadcast | AcceptMulticast | AcceptMyPhys | |
2518 | AcceptAllPhys; | 2517 | AcceptAllPhys; |
@@ -2627,7 +2626,7 @@ static int __init rtl8139_init_module (void) | |||
2627 | printk (KERN_INFO RTL8139_DRIVER_NAME "\n"); | 2626 | printk (KERN_INFO RTL8139_DRIVER_NAME "\n"); |
2628 | #endif | 2627 | #endif |
2629 | 2628 | ||
2630 | return pci_module_init (&rtl8139_pci_driver); | 2629 | return pci_register_driver(&rtl8139_pci_driver); |
2631 | } | 2630 | } |
2632 | 2631 | ||
2633 | 2632 | ||