aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/8139too.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/8139too.c')
-rw-r--r--drivers/net/8139too.c48
1 files changed, 25 insertions, 23 deletions
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
index abd6261465f1..e4f4eaff7679 100644
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -93,7 +93,6 @@
93#define DRV_VERSION "0.9.27" 93#define DRV_VERSION "0.9.27"
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>
@@ -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
884match: 883match:
@@ -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",