Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband
[pandora-kernel.git] / drivers / net / pci-skeleton.c
index 3388ee1..df8998b 100644 (file)
@@ -98,7 +98,7 @@ IVc. Errata
 #include <linux/crc32.h>
 #include <asm/io.h>
 
-#define NETDRV_VERSION         "1.0.0"
+#define NETDRV_VERSION         "1.0.1"
 #define MODNAME                        "netdrv"
 #define NETDRV_DRIVER_LOAD_MSG "MyVendor Fast Ethernet driver " NETDRV_VERSION " loaded"
 #define PFX                    MODNAME ": "
@@ -502,8 +502,7 @@ static void netdrv_tx_timeout (struct net_device *dev);
 static void netdrv_init_ring (struct net_device *dev);
 static int netdrv_start_xmit (struct sk_buff *skb,
                               struct net_device *dev);
-static irqreturn_t netdrv_interrupt (int irq, void *dev_instance,
-                              struct pt_regs *regs);
+static irqreturn_t netdrv_interrupt (int irq, void *dev_instance);
 static int netdrv_close (struct net_device *dev);
 static int netdrv_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
 static struct net_device_stats *netdrv_get_stats (struct net_device *dev);
@@ -601,7 +600,7 @@ static int __devinit netdrv_init_board (struct pci_dev *pdev,
        /* dev zeroed in alloc_etherdev */
        dev = alloc_etherdev (sizeof (*tp));
        if (dev == NULL) {
-               printk (KERN_ERR PFX "unable to alloc new ethernet\n");
+               dev_err(&pdev->dev, "unable to alloc new ethernet\n");
                DPRINTK ("EXIT, returning -ENOMEM\n");
                return -ENOMEM;
        }
@@ -631,14 +630,14 @@ static int __devinit netdrv_init_board (struct pci_dev *pdev,
 
        /* make sure PCI base addr 0 is PIO */
        if (!(pio_flags & IORESOURCE_IO)) {
-               printk (KERN_ERR PFX "region #0 not a PIO resource, aborting\n");
+               dev_err(&pdev->dev, "region #0 not a PIO resource, aborting\n");
                rc = -ENODEV;
                goto err_out;
        }
 
        /* make sure PCI base addr 1 is MMIO */
        if (!(mmio_flags & IORESOURCE_MEM)) {
-               printk (KERN_ERR PFX "region #1 not an MMIO resource, aborting\n");
+               dev_err(&pdev->dev, "region #1 not an MMIO resource, aborting\n");
                rc = -ENODEV;
                goto err_out;
        }
@@ -646,12 +645,12 @@ static int __devinit netdrv_init_board (struct pci_dev *pdev,
        /* check for weird/broken PCI region reporting */
        if ((pio_len < NETDRV_MIN_IO_SIZE) ||
            (mmio_len < NETDRV_MIN_IO_SIZE)) {
-               printk (KERN_ERR PFX "Invalid PCI region size(s), aborting\n");
+               dev_err(&pdev->dev, "Invalid PCI region size(s), aborting\n");
                rc = -ENODEV;
                goto err_out;
        }
 
-       rc = pci_request_regions (pdev, "pci-skeleton");
+       rc = pci_request_regions (pdev, MODNAME);
        if (rc)
                goto err_out;
 
@@ -663,7 +662,7 @@ static int __devinit netdrv_init_board (struct pci_dev *pdev,
        /* ioremap MMIO region */
        ioaddr = ioremap (mmio_start, mmio_len);
        if (ioaddr == NULL) {
-               printk (KERN_ERR PFX "cannot remap MMIO, aborting\n");
+               dev_err(&pdev->dev, "cannot remap MMIO, aborting\n");
                rc = -EIO;
                goto err_out_free_res;
        }
@@ -699,9 +698,10 @@ static int __devinit netdrv_init_board (struct pci_dev *pdev,
                }
 
        /* if unknown chip, assume array element #0, original RTL-8139 in this case */
-       printk (KERN_DEBUG PFX "PCI device %s: unknown chip version, assuming RTL-8139\n",
-               pci_name(pdev));
-       printk (KERN_DEBUG PFX "PCI device %s: TxConfig = 0x%lx\n", pci_name(pdev), NETDRV_R32 (TxConfig));
+       dev_printk (KERN_DEBUG, &pdev->dev,
+               "unknown chip version, assuming RTL-8139\n");
+       dev_printk (KERN_DEBUG, &pdev->dev, "TxConfig = 0x%lx\n",
+               NETDRV_R32 (TxConfig));
        tp->chipset = 0;
 
 match:
@@ -710,8 +710,8 @@ match:
                tp->chipset,
                rtl_chip_info[tp->chipset].name);
 
-       i = register_netdev (dev);
-       if (i)
+       rc = register_netdev (dev);
+       if (rc)
                goto err_out_unmap;
 
        DPRINTK ("EXIT, returning 0\n");
@@ -1317,7 +1317,7 @@ static void netdrv_tx_timeout (struct net_device *dev)
 
        /* Stop a shared interrupt from scavenging while we are. */
        spin_lock_irqsave (&tp->lock, flags);
-       
+
        netdrv_tx_clear (tp);
 
        spin_unlock_irqrestore (&tp->lock, flags);
@@ -1344,7 +1344,7 @@ static int netdrv_start_xmit (struct sk_buff *skb, struct net_device *dev)
 
        tp->tx_info[entry].skb = skb;
        /* tp->tx_info[entry].mapping = 0; */
-       memcpy (tp->tx_buf[entry], skb->data, skb->len);
+       skb_copy_from_linear_data(skb, tp->tx_buf[entry], skb->len);
 
        /* Note: the chip doesn't have auto-pad! */
        NETDRV_W32 (TxStatus0 + (entry * sizeof(u32)),
@@ -1565,7 +1565,6 @@ static void netdrv_rx_interrupt (struct net_device *dev,
 
                skb = dev_alloc_skb (pkt_size + 2);
                if (skb) {
-                       skb->dev = dev;
                        skb_reserve (skb, 2);   /* 16 byte align the IP fields. */
 
                        eth_copy_and_sum (skb, &rx_ring[ring_offset + 4], pkt_size, 0);
@@ -1653,8 +1652,7 @@ static void netdrv_weird_interrupt (struct net_device *dev,
 
 /* The interrupt handler does all of the Rx thread work and cleans up
    after the Tx thread. */
-static irqreturn_t netdrv_interrupt (int irq, void *dev_instance,
-                              struct pt_regs *regs)
+static irqreturn_t netdrv_interrupt (int irq, void *dev_instance)
 {
        struct net_device *dev = (struct net_device *) dev_instance;
        struct netdrv_private *tp = dev->priv;
@@ -1852,9 +1850,6 @@ static void netdrv_set_rx_mode (struct net_device *dev)
 
        /* Note: do not reorder, GCC is clever about common statements. */
        if (dev->flags & IFF_PROMISC) {
-               /* Unconditionally log net taps. */
-               printk (KERN_NOTICE "%s: Promiscuous mode enabled.\n",
-                       dev->name);
                rx_mode =
                    AcceptBroadcast | AcceptMulticast | AcceptMyPhys |
                    AcceptAllPhys;
@@ -1962,7 +1957,7 @@ static int __init netdrv_init_module (void)
 #ifdef MODULE
        printk(version);
 #endif
-       return pci_module_init (&netdrv_pci_driver);
+       return pci_register_driver(&netdrv_pci_driver);
 }