]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/net/smsc911x.c
Merge branch 'docs-next' of git://git.lwn.net/linux-2.6
[karo-tx-linux.git] / drivers / net / smsc911x.c
index ecdde03d4167984c1afc67865b973e26556abd82..dc3f1108884d0709159246031c6252e1f42079f6 100644 (file)
@@ -822,7 +822,6 @@ static int __devinit smsc911x_mii_init(struct platform_device *pdev,
                pdata->mii_bus->irq[i] = PHY_POLL;
 
        pdata->mii_bus->parent = &pdev->dev;
-       dev_set_drvdata(&pdev->dev, &pdata->mii_bus);
 
        pdata->using_extphy = 0;
 
@@ -1267,8 +1266,6 @@ static int smsc911x_stop(struct net_device *dev)
        struct smsc911x_data *pdata = netdev_priv(dev);
        unsigned int temp;
 
-       BUG_ON(!pdata->phy_dev);
-
        /* Disable all device interrupts */
        temp = smsc911x_reg_read(pdata, INT_CFG);
        temp &= ~INT_CFG_IRQ_EN_;
@@ -1283,7 +1280,8 @@ static int smsc911x_stop(struct net_device *dev)
        smsc911x_tx_update_txcounters(dev);
 
        /* Bring the PHY down */
-       phy_stop(pdata->phy_dev);
+       if (pdata->phy_dev)
+               phy_stop(pdata->phy_dev);
 
        SMSC_TRACE(IFDOWN, "Interface stopped");
        return 0;
@@ -1486,13 +1484,13 @@ static irqreturn_t smsc911x_irqhandler(int irq, void *dev_id)
        }
 
        if (likely(intsts & inten & INT_STS_RSFL_)) {
-               if (likely(netif_rx_schedule_prep(dev, &pdata->napi))) {
+               if (likely(netif_rx_schedule_prep(&pdata->napi))) {
                        /* Disable Rx interrupts */
                        temp = smsc911x_reg_read(pdata, INT_EN);
                        temp &= (~INT_EN_RSFL_EN_);
                        smsc911x_reg_write(pdata, INT_EN, temp);
                        /* Schedule a NAPI poll */
-                       __netif_rx_schedule(dev, &pdata->napi);
+                       __netif_rx_schedule(&pdata->napi);
                } else {
                        SMSC_WARNING(RX_ERR,
                                "netif_rx_schedule_prep failed");
@@ -1719,7 +1717,7 @@ static int smsc911x_ethtool_set_eeprom(struct net_device *dev,
        return ret;
 }
 
-static struct ethtool_ops smsc911x_ethtool_ops = {
+static const struct ethtool_ops smsc911x_ethtool_ops = {
        .get_settings = smsc911x_ethtool_getsettings,
        .set_settings = smsc911x_ethtool_setsettings,
        .get_link = ethtool_op_get_link,
@@ -1734,6 +1732,19 @@ static struct ethtool_ops smsc911x_ethtool_ops = {
        .set_eeprom = smsc911x_ethtool_set_eeprom,
 };
 
+static const struct net_device_ops smsc911x_netdev_ops = {
+       .ndo_open               = smsc911x_open,
+       .ndo_stop               = smsc911x_stop,
+       .ndo_start_xmit         = smsc911x_hard_start_xmit,
+       .ndo_get_stats          = smsc911x_get_stats,
+       .ndo_set_multicast_list = smsc911x_set_multicast_list,
+       .ndo_do_ioctl           = smsc911x_do_ioctl,
+       .ndo_validate_addr      = eth_validate_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+       .ndo_poll_controller    = smsc911x_poll_controller,
+#endif
+};
+
 /* Initializing private device structures, only called from probe */
 static int __devinit smsc911x_init(struct net_device *dev)
 {
@@ -1829,20 +1840,11 @@ static int __devinit smsc911x_init(struct net_device *dev)
        smsc911x_reg_write(pdata, INT_EN, 0);
 
        ether_setup(dev);
-       dev->open = smsc911x_open;
-       dev->stop = smsc911x_stop;
-       dev->hard_start_xmit = smsc911x_hard_start_xmit;
-       dev->get_stats = smsc911x_get_stats;
-       dev->set_multicast_list = smsc911x_set_multicast_list;
        dev->flags |= IFF_MULTICAST;
-       dev->do_ioctl = smsc911x_do_ioctl;
        netif_napi_add(dev, &pdata->napi, smsc911x_poll, SMSC_NAPI_WEIGHT);
+       dev->netdev_ops = &smsc911x_netdev_ops;
        dev->ethtool_ops = &smsc911x_ethtool_ops;
 
-#ifdef CONFIG_NET_POLL_CONTROLLER
-       dev->poll_controller = smsc911x_poll_controller;
-#endif                         /* CONFIG_NET_POLL_CONTROLLER */
-
        return 0;
 }
 
@@ -1872,7 +1874,7 @@ static int __devexit smsc911x_drv_remove(struct platform_device *pdev)
        res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
                                           "smsc911x-memory");
        if (!res)
-               platform_get_resource(pdev, IORESOURCE_MEM, 0);
+               res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
        release_mem_region(res->start, res->end - res->start);