Merge branch 'x86/urgent' into x86/core
[safe/jmp/linux-2.6] / drivers / net / 8139too.c
index 37456ad..a5b2420 100644 (file)
@@ -741,8 +741,7 @@ static void rtl8139_chip_reset (void __iomem *ioaddr)
 }
 
 
-static int __devinit rtl8139_init_board (struct pci_dev *pdev,
-                                        struct net_device **dev_out)
+static __devinit struct net_device * rtl8139_init_board (struct pci_dev *pdev)
 {
        void __iomem *ioaddr;
        struct net_device *dev;
@@ -756,13 +755,11 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev,
 
        assert (pdev != NULL);
 
-       *dev_out = NULL;
-
        /* dev and priv zeroed in alloc_etherdev */
        dev = alloc_etherdev (sizeof (*tp));
        if (dev == NULL) {
                dev_err(&pdev->dev, "Unable to alloc new net device\n");
-               return -ENOMEM;
+               return ERR_PTR(-ENOMEM);
        }
        SET_NETDEV_DEV(dev, &pdev->dev);
 
@@ -906,16 +903,29 @@ match:
 
        rtl8139_chip_reset (ioaddr);
 
-       *dev_out = dev;
-       return 0;
+       return dev;
 
 err_out:
        __rtl8139_cleanup_dev (dev);
        if (disable_dev_on_err)
                pci_disable_device (pdev);
-       return rc;
+       return ERR_PTR(rc);
 }
 
+static const struct net_device_ops rtl8139_netdev_ops = {
+       .ndo_open               = rtl8139_open,
+       .ndo_stop               = rtl8139_close,
+       .ndo_get_stats          = rtl8139_get_stats,
+       .ndo_validate_addr      = eth_validate_addr,
+       .ndo_set_mac_address    = eth_mac_addr,
+       .ndo_start_xmit         = rtl8139_start_xmit,
+       .ndo_set_multicast_list = rtl8139_set_rx_mode,
+       .ndo_do_ioctl           = netdev_ioctl,
+       .ndo_tx_timeout         = rtl8139_tx_timeout,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+       .ndo_poll_controller    = rtl8139_poll_controller,
+#endif
+};
 
 static int __devinit rtl8139_init_one (struct pci_dev *pdev,
                                       const struct pci_device_id *ent)
@@ -958,9 +968,9 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
                use_io = 1;
        }
 
-       i = rtl8139_init_board (pdev, &dev);
-       if (i < 0)
-               return i;
+       dev = rtl8139_init_board (pdev);
+       if (IS_ERR(dev))
+               return PTR_ERR(dev);
 
        assert (dev != NULL);
        tp = netdev_priv(dev);
@@ -976,19 +986,10 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
        memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
 
        /* The Rtl8139-specific entries in the device structure. */
-       dev->open = rtl8139_open;
-       dev->hard_start_xmit = rtl8139_start_xmit;
-       netif_napi_add(dev, &tp->napi, rtl8139_poll, 64);
-       dev->stop = rtl8139_close;
-       dev->get_stats = rtl8139_get_stats;
-       dev->set_multicast_list = rtl8139_set_rx_mode;
-       dev->do_ioctl = netdev_ioctl;
+       dev->netdev_ops = &rtl8139_netdev_ops;
        dev->ethtool_ops = &rtl8139_ethtool_ops;
-       dev->tx_timeout = rtl8139_tx_timeout;
        dev->watchdog_timeo = TX_TIMEOUT;
-#ifdef CONFIG_NET_POLL_CONTROLLER
-       dev->poll_controller = rtl8139_poll_controller;
-#endif
+       netif_napi_add(dev, &tp->napi, rtl8139_poll, 64);
 
        /* note: the hardware is not capable of sg/csum/highdma, however
         * through the use of skb_copy_and_csum_dev we enable these
@@ -2127,7 +2128,7 @@ static int rtl8139_poll(struct napi_struct *napi, int budget)
                 */
                spin_lock_irqsave(&tp->lock, flags);
                RTL_W16_F(IntrMask, rtl8139_intr_mask);
-               __netif_rx_complete(dev, napi);
+               __netif_rx_complete(napi);
                spin_unlock_irqrestore(&tp->lock, flags);
        }
        spin_unlock(&tp->rx_lock);
@@ -2177,9 +2178,9 @@ static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance)
        /* Receive packets are processed by poll routine.
           If not running start it now. */
        if (status & RxAckBits){
-               if (netif_rx_schedule_prep(dev, &tp->napi)) {
+               if (netif_rx_schedule_prep(&tp->napi)) {
                        RTL_W16_F (IntrMask, rtl8139_norx_intr_mask);
-                       __netif_rx_schedule(dev, &tp->napi);
+                       __netif_rx_schedule(&tp->napi);
                }
        }