diff options
Diffstat (limited to 'drivers/net/au1000_eth.c')
-rw-r--r-- | drivers/net/au1000_eth.c | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c index 019b13c08ae..9c875bb3f76 100644 --- a/drivers/net/au1000_eth.c +++ b/drivers/net/au1000_eth.c @@ -193,7 +193,7 @@ struct au1000_private *au_macs[NUM_ETH_INTERFACES]; */ static int au1000_mdio_read(struct net_device *dev, int phy_addr, int reg) { - struct au1000_private *aup = (struct au1000_private *) dev->priv; + struct au1000_private *aup = netdev_priv(dev); volatile u32 *const mii_control_reg = &aup->mac->mii_control; volatile u32 *const mii_data_reg = &aup->mac->mii_data; u32 timedout = 20; @@ -228,7 +228,7 @@ static int au1000_mdio_read(struct net_device *dev, int phy_addr, int reg) static void au1000_mdio_write(struct net_device *dev, int phy_addr, int reg, u16 value) { - struct au1000_private *aup = (struct au1000_private *) dev->priv; + struct au1000_private *aup = netdev_priv(dev); volatile u32 *const mii_control_reg = &aup->mac->mii_control; volatile u32 *const mii_data_reg = &aup->mac->mii_data; u32 timedout = 20; @@ -283,7 +283,7 @@ static int au1000_mdiobus_reset(struct mii_bus *bus) static int mii_probe (struct net_device *dev) { - struct au1000_private *const aup = (struct au1000_private *) dev->priv; + struct au1000_private *const aup = netdev_priv(dev); struct phy_device *phydev = NULL; #if defined(AU1XXX_PHY_STATIC_CONFIG) @@ -353,7 +353,6 @@ static int mii_probe (struct net_device *dev) } /* now we are supposed to have a proper phydev, to attach to... */ - BUG_ON(!phydev); BUG_ON(phydev->attached_dev); phydev = phy_connect(dev, phydev->dev.bus_id, &au1000_adjust_link, 0, @@ -415,7 +414,7 @@ void ReleaseDB(struct au1000_private *aup, db_dest_t *pDB) static void enable_rx_tx(struct net_device *dev) { - struct au1000_private *aup = (struct au1000_private *) dev->priv; + struct au1000_private *aup = netdev_priv(dev); if (au1000_debug > 4) printk(KERN_INFO "%s: enable_rx_tx\n", dev->name); @@ -426,7 +425,7 @@ static void enable_rx_tx(struct net_device *dev) static void hard_stop(struct net_device *dev) { - struct au1000_private *aup = (struct au1000_private *) dev->priv; + struct au1000_private *aup = netdev_priv(dev); if (au1000_debug > 4) printk(KERN_INFO "%s: hard stop\n", dev->name); @@ -438,7 +437,7 @@ static void hard_stop(struct net_device *dev) static void enable_mac(struct net_device *dev, int force_reset) { unsigned long flags; - struct au1000_private *aup = (struct au1000_private *) dev->priv; + struct au1000_private *aup = netdev_priv(dev); spin_lock_irqsave(&aup->lock, flags); @@ -457,7 +456,7 @@ static void enable_mac(struct net_device *dev, int force_reset) static void reset_mac_unlocked(struct net_device *dev) { - struct au1000_private *const aup = (struct au1000_private *) dev->priv; + struct au1000_private *const aup = netdev_priv(dev); int i; hard_stop(dev); @@ -483,7 +482,7 @@ static void reset_mac_unlocked(struct net_device *dev) static void reset_mac(struct net_device *dev) { - struct au1000_private *const aup = (struct au1000_private *) dev->priv; + struct au1000_private *const aup = netdev_priv(dev); unsigned long flags; if (au1000_debug > 4) @@ -572,7 +571,7 @@ static int __init au1000_init_module(void) static int au1000_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) { - struct au1000_private *aup = (struct au1000_private *)dev->priv; + struct au1000_private *aup = netdev_priv(dev); if (aup->phy_dev) return phy_ethtool_gset(aup->phy_dev, cmd); @@ -582,7 +581,7 @@ static int au1000_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) static int au1000_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) { - struct au1000_private *aup = (struct au1000_private *)dev->priv; + struct au1000_private *aup = netdev_priv(dev); if (!capable(CAP_NET_ADMIN)) return -EPERM; @@ -596,7 +595,7 @@ static int au1000_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) static void au1000_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) { - struct au1000_private *aup = (struct au1000_private *)dev->priv; + struct au1000_private *aup = netdev_priv(dev); strcpy(info->driver, DRV_NAME); strcpy(info->version, DRV_VERSION); @@ -652,7 +651,7 @@ static struct net_device * au1000_probe(int port_num) printk("%s: Au1xx0 Ethernet found at 0x%x, irq %d\n", dev->name, base, irq); - aup = dev->priv; + aup = netdev_priv(dev); spin_lock_init(&aup->lock); @@ -817,7 +816,7 @@ err_out: */ static int au1000_init(struct net_device *dev) { - struct au1000_private *aup = (struct au1000_private *) dev->priv; + struct au1000_private *aup = netdev_priv(dev); unsigned long flags; int i; u32 control; @@ -868,7 +867,7 @@ static int au1000_init(struct net_device *dev) static void au1000_adjust_link(struct net_device *dev) { - struct au1000_private *aup = (struct au1000_private *) dev->priv; + struct au1000_private *aup = netdev_priv(dev); struct phy_device *phydev = aup->phy_dev; unsigned long flags; @@ -947,7 +946,7 @@ au1000_adjust_link(struct net_device *dev) static int au1000_open(struct net_device *dev) { int retval; - struct au1000_private *aup = (struct au1000_private *) dev->priv; + struct au1000_private *aup = netdev_priv(dev); if (au1000_debug > 4) printk("%s: open: dev=%p\n", dev->name, dev); @@ -982,7 +981,7 @@ static int au1000_open(struct net_device *dev) static int au1000_close(struct net_device *dev) { unsigned long flags; - struct au1000_private *const aup = (struct au1000_private *) dev->priv; + struct au1000_private *const aup = netdev_priv(dev); if (au1000_debug > 4) printk("%s: close: dev=%p\n", dev->name, dev); @@ -1013,7 +1012,7 @@ static void __exit au1000_cleanup_module(void) for (i = 0; i < num_ifs; i++) { dev = iflist[i].dev; if (dev) { - aup = (struct au1000_private *) dev->priv; + aup = netdev_priv(dev); unregister_netdev(dev); mdiobus_unregister(aup->mii_bus); mdiobus_free(aup->mii_bus); @@ -1035,7 +1034,7 @@ static void __exit au1000_cleanup_module(void) static void update_tx_stats(struct net_device *dev, u32 status) { - struct au1000_private *aup = (struct au1000_private *) dev->priv; + struct au1000_private *aup = netdev_priv(dev); struct net_device_stats *ps = &dev->stats; if (status & TX_FRAME_ABORTED) { @@ -1064,7 +1063,7 @@ static void update_tx_stats(struct net_device *dev, u32 status) */ static void au1000_tx_ack(struct net_device *dev) { - struct au1000_private *aup = (struct au1000_private *) dev->priv; + struct au1000_private *aup = netdev_priv(dev); volatile tx_dma_t *ptxd; ptxd = aup->tx_dma_ring[aup->tx_tail]; @@ -1091,7 +1090,7 @@ static void au1000_tx_ack(struct net_device *dev) */ static int au1000_tx(struct sk_buff *skb, struct net_device *dev) { - struct au1000_private *aup = (struct au1000_private *) dev->priv; + struct au1000_private *aup = netdev_priv(dev); struct net_device_stats *ps = &dev->stats; volatile tx_dma_t *ptxd; u32 buff_stat; @@ -1145,7 +1144,7 @@ static int au1000_tx(struct sk_buff *skb, struct net_device *dev) static inline void update_rx_stats(struct net_device *dev, u32 status) { - struct au1000_private *aup = (struct au1000_private *) dev->priv; + struct au1000_private *aup = netdev_priv(dev); struct net_device_stats *ps = &dev->stats; ps->rx_packets++; @@ -1173,7 +1172,7 @@ static inline void update_rx_stats(struct net_device *dev, u32 status) */ static int au1000_rx(struct net_device *dev) { - struct au1000_private *aup = (struct au1000_private *) dev->priv; + struct au1000_private *aup = netdev_priv(dev); struct sk_buff *skb; volatile rx_dma_t *prxd; u32 buff_stat, status; @@ -1240,7 +1239,6 @@ static int au1000_rx(struct net_device *dev) /* next descriptor */ prxd = aup->rx_dma_ring[aup->rx_head]; buff_stat = prxd->buff_stat; - dev->last_rx = jiffies; } return 0; } @@ -1276,7 +1274,7 @@ static void au1000_tx_timeout(struct net_device *dev) static void set_rx_mode(struct net_device *dev) { - struct au1000_private *aup = (struct au1000_private *) dev->priv; + struct au1000_private *aup = netdev_priv(dev); if (au1000_debug > 4) printk("%s: set_rx_mode: flags=%x\n", dev->name, dev->flags); @@ -1308,7 +1306,7 @@ static void set_rx_mode(struct net_device *dev) static int au1000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { - struct au1000_private *aup = (struct au1000_private *)dev->priv; + struct au1000_private *aup = netdev_priv(dev); if (!netif_running(dev)) return -EINVAL; |