Merge branch 'ixp4xx' of git://git.kernel.org/pub/scm/linux/kernel/git/chris/linux-2.6
[safe/jmp/linux-2.6] / drivers / net / smc911x.c
index 84d1feb..44ebbaa 100644 (file)
@@ -220,9 +220,9 @@ static void smc911x_reset(struct net_device *dev)
 
        /* make sure EEPROM has finished loading before setting GPIO_CFG */
        timeout=1000;
-       while ( timeout-- && (SMC_GET_E2P_CMD(lp) & E2P_CMD_EPC_BUSY_)) {
+       while (--timeout && (SMC_GET_E2P_CMD(lp) & E2P_CMD_EPC_BUSY_))
                udelay(10);
-       }
+
        if (timeout == 0){
                PRINTK("%s: smc911x_reset timeout waiting for EEPROM busy\n", dev->name);
                return;
@@ -553,7 +553,7 @@ static int smc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
                dev->stats.tx_dropped++;
                spin_unlock_irqrestore(&lp->lock, flags);
                dev_kfree_skb(skb);
-               return 0;
+               return NETDEV_TX_OK;
        }
 
 #ifdef SMC_USE_DMA
@@ -566,7 +566,7 @@ static int smc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
                        lp->pending_tx_skb = skb;
                        netif_stop_queue(dev);
                        spin_unlock_irqrestore(&lp->lock, flags);
-                       return 0;
+                       return NETDEV_TX_OK;
                } else {
                        DBG(SMC_DEBUG_TX | SMC_DEBUG_DMA, "%s: Activating Tx DMA\n", dev->name);
                        lp->txdma_active = 1;
@@ -577,7 +577,7 @@ static int smc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
        smc911x_hardware_send_pkt(dev);
        spin_unlock_irqrestore(&lp->lock, flags);
 
-       return 0;
+       return NETDEV_TX_OK;
 }
 
 /*
@@ -1545,7 +1545,7 @@ smc911x_ethtool_getdrvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 {
        strncpy(info->driver, CARDNAME, sizeof(info->driver));
        strncpy(info->version, version, sizeof(info->version));
-       strncpy(info->bus_info, dev->dev.parent->bus_id, sizeof(info->bus_info));
+       strncpy(info->bus_info, dev_name(dev->dev.parent), sizeof(info->bus_info));
 }
 
 static int smc911x_ethtool_nwayreset(struct net_device *dev)
@@ -1733,7 +1733,7 @@ static const struct ethtool_ops smc911x_ethtool_ops = {
  * This routine has a simple purpose -- make the SMC chip generate an
  * interrupt, so an auto-detect routine can detect it, and find the IRQ,
  */
-static int __init smc911x_findirq(struct net_device *dev)
+static int __devinit smc911x_findirq(struct net_device *dev)
 {
        struct smc911x_local *lp = netdev_priv(dev);
        int timeout = 20;
@@ -1774,6 +1774,20 @@ static int __init smc911x_findirq(struct net_device *dev)
        return probe_irq_off(cookie);
 }
 
+static const struct net_device_ops smc911x_netdev_ops = {
+       .ndo_open               = smc911x_open,
+       .ndo_stop               = smc911x_close,
+       .ndo_start_xmit         = smc911x_hard_start_xmit,
+       .ndo_tx_timeout         = smc911x_timeout,
+       .ndo_set_multicast_list = smc911x_set_multicast_list,
+       .ndo_change_mtu         = eth_change_mtu,
+       .ndo_validate_addr      = eth_validate_addr,
+       .ndo_set_mac_address    = eth_mac_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+       .ndo_poll_controller    = smc911x_poll_controller,
+#endif
+};
+
 /*
  * Function: smc911x_probe(unsigned long ioaddr)
  *
@@ -1797,7 +1811,7 @@ static int __init smc911x_findirq(struct net_device *dev)
  * o  actually GRAB the irq.
  * o  GRAB the region
  */
-static int __init smc911x_probe(struct net_device *dev)
+static int __devinit smc911x_probe(struct net_device *dev)
 {
        struct smc911x_local *lp = netdev_priv(dev);
        int i, retval;
@@ -1940,16 +1954,9 @@ static int __init smc911x_probe(struct net_device *dev)
        /* Fill in the fields of the device structure with ethernet values. */
        ether_setup(dev);
 
-       dev->open = smc911x_open;
-       dev->stop = smc911x_close;
-       dev->hard_start_xmit = smc911x_hard_start_xmit;
-       dev->tx_timeout = smc911x_timeout;
+       dev->netdev_ops = &smc911x_netdev_ops;
        dev->watchdog_timeo = msecs_to_jiffies(watchdog);
-       dev->set_multicast_list = smc911x_set_multicast_list;
        dev->ethtool_ops = &smc911x_ethtool_ops;
-#ifdef CONFIG_NET_POLL_CONTROLLER
-       dev->poll_controller = smc911x_poll_controller;
-#endif
 
        INIT_WORK(&lp->phy_configure, smc911x_phy_configure);
        lp->mii.phy_id_mask = 0x1f;
@@ -1977,7 +1984,7 @@ static int __init smc911x_probe(struct net_device *dev)
 #endif
 
        /* Grab the IRQ */
-       retval = request_irq(dev->irq, &smc911x_interrupt,
+       retval = request_irq(dev->irq, smc911x_interrupt,
                             irq_flags, dev->name, dev);
        if (retval)
                goto err_out;
@@ -2046,11 +2053,8 @@ err_out:
  *      0 --> there is a device
  *      anything else, error
  */
-static int smc911x_drv_probe(struct platform_device *pdev)
+static int __devinit smc911x_drv_probe(struct platform_device *pdev)
 {
-#ifdef SMC_DYNAMIC_BUS_CONFIG
-       struct smc911x_platdata *pd = pdev->dev.platform_data;
-#endif
        struct net_device *ndev;
        struct resource *res;
        struct smc911x_local *lp;
@@ -2085,11 +2089,14 @@ static int smc911x_drv_probe(struct platform_device *pdev)
        lp = netdev_priv(ndev);
        lp->netdev = ndev;
 #ifdef SMC_DYNAMIC_BUS_CONFIG
-       if (!pd) {
-               ret = -EINVAL;
-               goto release_both;
+       {
+               struct smc911x_platdata *pd = pdev->dev.platform_data;
+               if (!pd) {
+                       ret = -EINVAL;
+                       goto release_both;
+               }
+               memcpy(&lp->cfg, pd, sizeof(lp->cfg));
        }
-       memcpy(&lp->cfg, pd, sizeof(lp->cfg));
 #endif
 
        addr = ioremap(res->start, SMC911X_IO_EXTENT);
@@ -2122,7 +2129,7 @@ out:
        return ret;
 }
 
-static int smc911x_drv_remove(struct platform_device *pdev)
+static int __devexit smc911x_drv_remove(struct platform_device *pdev)
 {
        struct net_device *ndev = platform_get_drvdata(pdev);
        struct smc911x_local *lp = netdev_priv(ndev);
@@ -2193,7 +2200,7 @@ static int smc911x_drv_resume(struct platform_device *dev)
 
 static struct platform_driver smc911x_driver = {
        .probe           = smc911x_drv_probe,
-       .remove  = smc911x_drv_remove,
+       .remove  = __devexit_p(smc911x_drv_remove),
        .suspend         = smc911x_drv_suspend,
        .resume  = smc911x_drv_resume,
        .driver  = {