aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/smsc911x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/smsc911x.c')
-rw-r--r--drivers/net/smsc911x.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c
index fa28542b47d..5e989d884dd 100644
--- a/drivers/net/smsc911x.c
+++ b/drivers/net/smsc911x.c
@@ -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;
@@ -984,7 +983,7 @@ static int smsc911x_poll(struct napi_struct *napi, int budget)
/* We processed all packets available. Tell NAPI it can
* stop polling then re-enable rx interrupts */
smsc911x_reg_write(pdata, INT_STS, INT_STS_RSFL_);
- netif_rx_complete(dev, napi);
+ netif_rx_complete(napi);
temp = smsc911x_reg_read(pdata, INT_EN);
temp |= INT_EN_RSFL_EN_;
smsc911x_reg_write(pdata, INT_EN, temp);
@@ -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;
@@ -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);