Commit f535fd1a authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[netdrvr] netdev_priv for sundance, typhoon, yellowfin

parent 35c49f89
......@@ -567,7 +567,7 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev,
dev->base_addr = ioaddr;
dev->irq = irq;
np = dev->priv;
np = netdev_priv(dev);
np->pci_dev = pdev;
np->chip_id = chip_idx;
np->msg_enable = (1 << debug) - 1;
......@@ -787,7 +787,7 @@ static void mdio_sync(long mdio_addr)
static int mdio_read(struct net_device *dev, int phy_id, int location)
{
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
long mdio_addr = dev->base_addr + MIICtrl;
int mii_cmd = (0xf6 << 10) | (phy_id << 5) | location;
int i, retval = 0;
......@@ -817,7 +817,7 @@ static int mdio_read(struct net_device *dev, int phy_id, int location)
static void mdio_write(struct net_device *dev, int phy_id, int location, int value)
{
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
long mdio_addr = dev->base_addr + MIICtrl;
int mii_cmd = (0x5002 << 16) | (phy_id << 23) | (location<<18) | value;
int i;
......@@ -846,7 +846,7 @@ static void mdio_write(struct net_device *dev, int phy_id, int location, int val
static int netdev_open(struct net_device *dev)
{
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
long ioaddr = dev->base_addr;
int i;
......@@ -916,7 +916,7 @@ static int netdev_open(struct net_device *dev)
static void check_duplex(struct net_device *dev)
{
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
long ioaddr = dev->base_addr;
int mii_lpa = mdio_read(dev, np->phys[0], MII_LPA);
int negotiated = mii_lpa & np->mii_if.advertising;
......@@ -945,7 +945,7 @@ static void check_duplex(struct net_device *dev)
static void netdev_timer(unsigned long data)
{
struct net_device *dev = (struct net_device *)data;
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
long ioaddr = dev->base_addr;
int next_tick = 10*HZ;
......@@ -962,7 +962,7 @@ static void netdev_timer(unsigned long data)
static void tx_timeout(struct net_device *dev)
{
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
long ioaddr = dev->base_addr;
unsigned long flag;
......@@ -1015,7 +1015,7 @@ static void tx_timeout(struct net_device *dev)
/* Initialize the Rx and Tx rings, along with various 'dev' bits. */
static void init_ring(struct net_device *dev)
{
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
int i;
np->cur_rx = np->cur_tx = 0;
......@@ -1058,7 +1058,7 @@ static void init_ring(struct net_device *dev)
static void tx_poll (unsigned long data)
{
struct net_device *dev = (struct net_device *)data;
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
unsigned head = np->cur_task % TX_RING_SIZE;
struct netdev_desc *txdesc =
&np->tx_ring[(np->cur_tx - 1) % TX_RING_SIZE];
......@@ -1085,7 +1085,7 @@ static void tx_poll (unsigned long data)
static int
start_tx (struct sk_buff *skb, struct net_device *dev)
{
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
struct netdev_desc *txdesc;
unsigned entry;
......@@ -1127,7 +1127,7 @@ start_tx (struct sk_buff *skb, struct net_device *dev)
static int
reset_tx (struct net_device *dev)
{
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
long ioaddr = dev->base_addr;
struct sk_buff *skb;
int i;
......@@ -1176,7 +1176,7 @@ static irqreturn_t intr_handler(int irq, void *dev_instance, struct pt_regs *rgs
int handled = 0;
ioaddr = dev->base_addr;
np = dev->priv;
np = netdev_priv(dev);
do {
int intr_status = readw(ioaddr + IntrStatus);
......@@ -1301,7 +1301,7 @@ static irqreturn_t intr_handler(int irq, void *dev_instance, struct pt_regs *rgs
static void rx_poll(unsigned long data)
{
struct net_device *dev = (struct net_device *)data;
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
int entry = np->cur_rx % RX_RING_SIZE;
int boguscnt = np->budget;
long ioaddr = dev->base_addr;
......@@ -1398,7 +1398,7 @@ static void rx_poll(unsigned long data)
static void refill_rx (struct net_device *dev)
{
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
int entry;
int cnt = 0;
......@@ -1429,7 +1429,7 @@ static void refill_rx (struct net_device *dev)
static void netdev_error(struct net_device *dev, int intr_status)
{
long ioaddr = dev->base_addr;
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
u16 mii_ctl, mii_advertise, mii_lpa;
int speed;
......@@ -1483,7 +1483,7 @@ static void netdev_error(struct net_device *dev, int intr_status)
static struct net_device_stats *get_stats(struct net_device *dev)
{
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
long ioaddr = dev->base_addr;
int i;
......@@ -1512,7 +1512,7 @@ static struct net_device_stats *get_stats(struct net_device *dev)
static void set_rx_mode(struct net_device *dev)
{
long ioaddr = dev->base_addr;
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
u16 mc_filter[4]; /* Multicast hash filter */
u32 rx_mode;
int i;
......@@ -1569,7 +1569,7 @@ static int __set_mac_addr(struct net_device *dev)
static int netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr)
{
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
u32 ethcmd;
if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
......@@ -1649,7 +1649,7 @@ static int netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr)
static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
int rc;
int i;
long ioaddr = dev->base_addr;
......@@ -1696,7 +1696,7 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
static int netdev_close(struct net_device *dev)
{
long ioaddr = dev->base_addr;
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
struct sk_buff *skb;
int i;
......@@ -1775,7 +1775,7 @@ static void __devexit sundance_remove1 (struct pci_dev *pdev)
struct net_device *dev = pci_get_drvdata(pdev);
if (dev) {
struct netdev_private *np = dev->priv;
struct netdev_private *np = netdev_priv(dev);
unregister_netdev(dev);
pci_free_consistent(pdev, RX_TOTAL_SIZE, np->rx_ring,
......
......@@ -688,7 +688,7 @@ typhoon_issue_command(struct typhoon *tp, int num_cmd, struct cmd_desc *cmd,
static void
typhoon_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
{
struct typhoon *tp = (struct typhoon *) dev->priv;
struct typhoon *tp = netdev_priv(dev);
struct cmd_desc xp_cmd;
int err;
......@@ -726,7 +726,7 @@ typhoon_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
static void
typhoon_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
{
struct typhoon *tp = (struct typhoon *) dev->priv;
struct typhoon *tp = netdev_priv(dev);
spin_lock_bh(&tp->state_lock);
if(tp->vlgrp)
tp->vlgrp->vlan_devices[vid] = NULL;
......@@ -757,7 +757,7 @@ typhoon_tso_fill(struct sk_buff *skb, struct transmit_ring *txRing,
static int
typhoon_start_tx(struct sk_buff *skb, struct net_device *dev)
{
struct typhoon *tp = (struct typhoon *) dev->priv;
struct typhoon *tp = netdev_priv(dev);
struct transmit_ring *txRing;
struct tx_desc *txd, *first_txd;
dma_addr_t skb_dma;
......@@ -908,7 +908,7 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev)
static void
typhoon_set_rx_mode(struct net_device *dev)
{
struct typhoon *tp = (struct typhoon *) dev->priv;
struct typhoon *tp = netdev_priv(dev);
struct cmd_desc xp_cmd;
u32 mc_filter[2];
u16 filter;
......@@ -1002,7 +1002,7 @@ typhoon_do_get_stats(struct typhoon *tp)
static struct net_device_stats *
typhoon_get_stats(struct net_device *dev)
{
struct typhoon *tp = (struct typhoon *) dev->priv;
struct typhoon *tp = netdev_priv(dev);
struct net_device_stats *stats = &tp->stats;
struct net_device_stats *saved = &tp->stats_saved;
......@@ -1158,7 +1158,7 @@ typhoon_ethtool_sset(struct typhoon *tp, struct ethtool_cmd *cmd)
static inline int
typhoon_ethtool_ioctl(struct net_device *dev, void __user *useraddr)
{
struct typhoon *tp = (struct typhoon *) dev->priv;
struct typhoon *tp = netdev_priv(dev);
u32 ethcmd;
if(copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
......@@ -1756,7 +1756,7 @@ typhoon_fill_free_ring(struct typhoon *tp)
static int
typhoon_poll(struct net_device *dev, int *total_budget)
{
struct typhoon *tp = (struct typhoon *) dev->priv;
struct typhoon *tp = netdev_priv(dev);
struct typhoon_indexes *indexes = tp->indexes;
int orig_budget = *total_budget;
int budget, work_done, done;
......@@ -2068,7 +2068,7 @@ typhoon_stop_runtime(struct typhoon *tp, int wait_type)
static void
typhoon_tx_timeout(struct net_device *dev)
{
struct typhoon *tp = (struct typhoon *) dev->priv;
struct typhoon *tp = netdev_priv(dev);
if(typhoon_reset(dev->base_addr, WaitNoSleep) < 0) {
printk(KERN_WARNING "%s: could not reset in tx timeout\n",
......@@ -2098,7 +2098,7 @@ typhoon_tx_timeout(struct net_device *dev)
static int
typhoon_open(struct net_device *dev)
{
struct typhoon *tp = (struct typhoon *) dev->priv;
struct typhoon *tp = netdev_priv(dev);
int err;
err = typhoon_wakeup(tp, WaitSleep);
......@@ -2140,7 +2140,7 @@ typhoon_open(struct net_device *dev)
static int
typhoon_close(struct net_device *dev)
{
struct typhoon *tp = (struct typhoon *) dev->priv;
struct typhoon *tp = netdev_priv(dev);
netif_stop_queue(dev);
......@@ -2168,7 +2168,7 @@ static int
typhoon_resume(struct pci_dev *pdev)
{
struct net_device *dev = pci_get_drvdata(pdev);
struct typhoon *tp = (struct typhoon *) dev->priv;
struct typhoon *tp = netdev_priv(dev);
/* If we're down, resume when we are upped.
*/
......@@ -2200,7 +2200,7 @@ static int
typhoon_suspend(struct pci_dev *pdev, u32 state)
{
struct net_device *dev = pci_get_drvdata(pdev);
struct typhoon *tp = (struct typhoon *) dev->priv;
struct typhoon *tp = netdev_priv(dev);
struct cmd_desc xp_cmd;
/* If we're down, we're already suspended.
......@@ -2366,7 +2366,7 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
}
dev->irq = pdev->irq;
tp = dev->priv;
tp = netdev_priv(dev);
tp->shared = (struct typhoon_shared *) shared;
tp->shared_dma = shared_dma;
tp->pdev = pdev;
......@@ -2537,7 +2537,7 @@ static void __devexit
typhoon_remove_one(struct pci_dev *pdev)
{
struct net_device *dev = pci_get_drvdata(pdev);
struct typhoon *tp = (struct typhoon *) (dev->priv);
struct typhoon *tp = netdev_priv(dev);
unregister_netdev(dev);
pci_set_power_state(pdev, 0);
......
......@@ -440,7 +440,7 @@ static int __devinit yellowfin_init_one(struct pci_dev *pdev,
SET_MODULE_OWNER(dev);
SET_NETDEV_DEV(dev, &pdev->dev);
np = dev->priv;
np = netdev_priv(dev);
if (pci_request_regions(pdev, DRV_NAME))
goto err_out_free_netdev;
......@@ -619,7 +619,7 @@ static void mdio_write(long ioaddr, int phy_id, int location, int value)
static int yellowfin_open(struct net_device *dev)
{
struct yellowfin_private *yp = dev->priv;
struct yellowfin_private *yp = netdev_priv(dev);
long ioaddr = dev->base_addr;
int i;
......@@ -701,7 +701,7 @@ static int yellowfin_open(struct net_device *dev)
static void yellowfin_timer(unsigned long data)
{
struct net_device *dev = (struct net_device *)data;
struct yellowfin_private *yp = dev->priv;
struct yellowfin_private *yp = netdev_priv(dev);
long ioaddr = dev->base_addr;
int next_tick = 60*HZ;
......@@ -735,7 +735,7 @@ static void yellowfin_timer(unsigned long data)
static void yellowfin_tx_timeout(struct net_device *dev)
{
struct yellowfin_private *yp = dev->priv;
struct yellowfin_private *yp = netdev_priv(dev);
long ioaddr = dev->base_addr;
printk(KERN_WARNING "%s: Yellowfin transmit timed out at %d/%d Tx "
......@@ -772,7 +772,7 @@ static void yellowfin_tx_timeout(struct net_device *dev)
/* Initialize the Rx and Tx rings, along with various 'dev' bits. */
static void yellowfin_init_ring(struct net_device *dev)
{
struct yellowfin_private *yp = dev->priv;
struct yellowfin_private *yp = netdev_priv(dev);
int i;
yp->tx_full = 0;
......@@ -855,7 +855,7 @@ static void yellowfin_init_ring(struct net_device *dev)
static int yellowfin_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct yellowfin_private *yp = dev->priv;
struct yellowfin_private *yp = netdev_priv(dev);
unsigned entry;
int len = skb->len;
......@@ -953,7 +953,7 @@ static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance, struct pt_re
#endif
ioaddr = dev->base_addr;
yp = dev->priv;
yp = netdev_priv(dev);
spin_lock (&yp->lock);
......@@ -1095,7 +1095,7 @@ static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance, struct pt_re
for clarity and better register allocation. */
static int yellowfin_rx(struct net_device *dev)
{
struct yellowfin_private *yp = dev->priv;
struct yellowfin_private *yp = netdev_priv(dev);
int entry = yp->cur_rx % RX_RING_SIZE;
int boguscnt = yp->dirty_rx + RX_RING_SIZE - yp->cur_rx;
......@@ -1239,7 +1239,7 @@ static int yellowfin_rx(struct net_device *dev)
static void yellowfin_error(struct net_device *dev, int intr_status)
{
struct yellowfin_private *yp = dev->priv;
struct yellowfin_private *yp = netdev_priv(dev);
printk(KERN_ERR "%s: Something Wicked happened! %4.4x.\n",
dev->name, intr_status);
......@@ -1253,7 +1253,7 @@ static void yellowfin_error(struct net_device *dev, int intr_status)
static int yellowfin_close(struct net_device *dev)
{
long ioaddr = dev->base_addr;
struct yellowfin_private *yp = dev->priv;
struct yellowfin_private *yp = netdev_priv(dev);
int i;
netif_stop_queue (dev);
......@@ -1340,7 +1340,7 @@ static int yellowfin_close(struct net_device *dev)
static struct net_device_stats *yellowfin_get_stats(struct net_device *dev)
{
struct yellowfin_private *yp = dev->priv;
struct yellowfin_private *yp = netdev_priv(dev);
return &yp->stats;
}
......@@ -1348,7 +1348,7 @@ static struct net_device_stats *yellowfin_get_stats(struct net_device *dev)
static void set_rx_mode(struct net_device *dev)
{
struct yellowfin_private *yp = dev->priv;
struct yellowfin_private *yp = netdev_priv(dev);
long ioaddr = dev->base_addr;
u16 cfg_value = inw(ioaddr + Cnfg);
......@@ -1396,7 +1396,7 @@ static void set_rx_mode(struct net_device *dev)
static int netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr)
{
struct yellowfin_private *np = dev->priv;
struct yellowfin_private *np = netdev_priv(dev);
u32 ethcmd;
if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
......@@ -1420,7 +1420,7 @@ static int netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr)
static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
struct yellowfin_private *np = dev->priv;
struct yellowfin_private *np = netdev_priv(dev);
long ioaddr = dev->base_addr;
struct mii_ioctl_data *data = if_mii(rq);
......@@ -1466,7 +1466,7 @@ static void __devexit yellowfin_remove_one (struct pci_dev *pdev)
if (!dev)
BUG();
np = dev->priv;
np = netdev_priv(dev);
pci_free_consistent(pdev, STATUS_TOTAL_SIZE, np->tx_status,
np->tx_status_dma);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment