Commit 498bb30a authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[netdrvr] use netdev_priv in dl2k, hamachi

parent f535fd1a
...@@ -168,7 +168,7 @@ rio_probe1 (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -168,7 +168,7 @@ rio_probe1 (struct pci_dev *pdev, const struct pci_device_id *ent)
#endif #endif
dev->base_addr = ioaddr; dev->base_addr = ioaddr;
dev->irq = irq; dev->irq = irq;
np = dev->priv; np = netdev_priv(dev);
np->chip_id = chip_idx; np->chip_id = chip_idx;
np->pdev = pdev; np->pdev = pdev;
spin_lock_init (&np->tx_lock); spin_lock_init (&np->tx_lock);
...@@ -335,7 +335,7 @@ find_miiphy (struct net_device *dev) ...@@ -335,7 +335,7 @@ find_miiphy (struct net_device *dev)
int i, phy_found = 0; int i, phy_found = 0;
struct netdev_private *np; struct netdev_private *np;
long ioaddr; long ioaddr;
np = dev->priv; np = netdev_priv(dev);
ioaddr = dev->base_addr; ioaddr = dev->base_addr;
np->phy_addr = 1; np->phy_addr = 1;
...@@ -362,7 +362,7 @@ parse_eeprom (struct net_device *dev) ...@@ -362,7 +362,7 @@ parse_eeprom (struct net_device *dev)
u8 *psib; u8 *psib;
u32 crc; u32 crc;
PSROM_t psrom = (PSROM_t) sromdata; PSROM_t psrom = (PSROM_t) sromdata;
struct netdev_private *np = dev->priv; struct netdev_private *np = netdev_priv(dev);
int cid, next; int cid, next;
...@@ -432,7 +432,7 @@ parse_eeprom (struct net_device *dev) ...@@ -432,7 +432,7 @@ parse_eeprom (struct net_device *dev)
static int static int
rio_open (struct net_device *dev) rio_open (struct net_device *dev)
{ {
struct netdev_private *np = dev->priv; struct netdev_private *np = netdev_priv(dev);
long ioaddr = dev->base_addr; long ioaddr = dev->base_addr;
int i; int i;
u16 macctrl; u16 macctrl;
...@@ -516,7 +516,7 @@ static void ...@@ -516,7 +516,7 @@ static void
rio_timer (unsigned long data) rio_timer (unsigned long data)
{ {
struct net_device *dev = (struct net_device *)data; struct net_device *dev = (struct net_device *)data;
struct netdev_private *np = dev->priv; struct netdev_private *np = netdev_priv(dev);
unsigned int entry; unsigned int entry;
int next_tick = 1*HZ; int next_tick = 1*HZ;
unsigned long flags; unsigned long flags;
...@@ -574,7 +574,7 @@ rio_tx_timeout (struct net_device *dev) ...@@ -574,7 +574,7 @@ rio_tx_timeout (struct net_device *dev)
static void static void
alloc_list (struct net_device *dev) alloc_list (struct net_device *dev)
{ {
struct netdev_private *np = dev->priv; struct netdev_private *np = netdev_priv(dev);
int i; int i;
np->cur_rx = np->cur_tx = 0; np->cur_rx = np->cur_tx = 0;
...@@ -631,7 +631,7 @@ alloc_list (struct net_device *dev) ...@@ -631,7 +631,7 @@ alloc_list (struct net_device *dev)
static int static int
start_xmit (struct sk_buff *skb, struct net_device *dev) start_xmit (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; struct netdev_desc *txdesc;
unsigned entry; unsigned entry;
u32 ioaddr; u32 ioaddr;
...@@ -711,7 +711,7 @@ rio_interrupt (int irq, void *dev_instance, struct pt_regs *rgs) ...@@ -711,7 +711,7 @@ rio_interrupt (int irq, void *dev_instance, struct pt_regs *rgs)
int handled = 0; int handled = 0;
ioaddr = dev->base_addr; ioaddr = dev->base_addr;
np = dev->priv; np = netdev_priv(dev);
while (1) { while (1) {
int_status = readw (ioaddr + IntStatus); int_status = readw (ioaddr + IntStatus);
writew (int_status, ioaddr + IntStatus); writew (int_status, ioaddr + IntStatus);
...@@ -745,7 +745,7 @@ rio_interrupt (int irq, void *dev_instance, struct pt_regs *rgs) ...@@ -745,7 +745,7 @@ rio_interrupt (int irq, void *dev_instance, struct pt_regs *rgs)
static void static void
rio_free_tx (struct net_device *dev, int irq) rio_free_tx (struct net_device *dev, int irq)
{ {
struct netdev_private *np = dev->priv; struct netdev_private *np = netdev_priv(dev);
int entry = np->old_tx % TX_RING_SIZE; int entry = np->old_tx % TX_RING_SIZE;
int tx_use = 0; int tx_use = 0;
unsigned long flag = 0; unsigned long flag = 0;
...@@ -798,7 +798,7 @@ tx_error (struct net_device *dev, int tx_status) ...@@ -798,7 +798,7 @@ tx_error (struct net_device *dev, int tx_status)
int frame_id; int frame_id;
int i; int i;
np = dev->priv; np = netdev_priv(dev);
frame_id = (tx_status & 0xffff0000); frame_id = (tx_status & 0xffff0000);
printk (KERN_ERR "%s: Transmit error, TxStatus %4.4x, FrameId %d.\n", printk (KERN_ERR "%s: Transmit error, TxStatus %4.4x, FrameId %d.\n",
...@@ -855,7 +855,7 @@ tx_error (struct net_device *dev, int tx_status) ...@@ -855,7 +855,7 @@ tx_error (struct net_device *dev, int tx_status)
static int static int
receive_packet (struct net_device *dev) receive_packet (struct net_device *dev)
{ {
struct netdev_private *np = dev->priv; struct netdev_private *np = netdev_priv(dev);
int entry = np->cur_rx % RX_RING_SIZE; int entry = np->cur_rx % RX_RING_SIZE;
int cnt = 30; int cnt = 30;
...@@ -965,7 +965,7 @@ static void ...@@ -965,7 +965,7 @@ static void
rio_error (struct net_device *dev, int int_status) rio_error (struct net_device *dev, int int_status)
{ {
long ioaddr = dev->base_addr; long ioaddr = dev->base_addr;
struct netdev_private *np = dev->priv; struct netdev_private *np = netdev_priv(dev);
u16 macctrl; u16 macctrl;
/* Link change event */ /* Link change event */
...@@ -1016,7 +1016,7 @@ static struct net_device_stats * ...@@ -1016,7 +1016,7 @@ static struct net_device_stats *
get_stats (struct net_device *dev) get_stats (struct net_device *dev)
{ {
long ioaddr = dev->base_addr; long ioaddr = dev->base_addr;
struct netdev_private *np = dev->priv; struct netdev_private *np = netdev_priv(dev);
#ifdef MEM_MAPPING #ifdef MEM_MAPPING
int i; int i;
#endif #endif
...@@ -1132,7 +1132,7 @@ clear_stats (struct net_device *dev) ...@@ -1132,7 +1132,7 @@ clear_stats (struct net_device *dev)
int int
change_mtu (struct net_device *dev, int new_mtu) change_mtu (struct net_device *dev, int new_mtu)
{ {
struct netdev_private *np = dev->priv; struct netdev_private *np = netdev_priv(dev);
int max = (np->jumbo) ? MAX_JUMBO : 1536; int max = (np->jumbo) ? MAX_JUMBO : 1536;
if ((new_mtu < 68) || (new_mtu > max)) { if ((new_mtu < 68) || (new_mtu > max)) {
...@@ -1150,7 +1150,7 @@ set_multicast (struct net_device *dev) ...@@ -1150,7 +1150,7 @@ set_multicast (struct net_device *dev)
long ioaddr = dev->base_addr; long ioaddr = dev->base_addr;
u32 hash_table[2]; u32 hash_table[2];
u16 rx_mode = 0; u16 rx_mode = 0;
struct netdev_private *np = dev->priv; struct netdev_private *np = netdev_priv(dev);
hash_table[0] = hash_table[1] = 0; hash_table[0] = hash_table[1] = 0;
/* RxFlowcontrol DA: 01-80-C2-00-00-01. Hash index=0x39 */ /* RxFlowcontrol DA: 01-80-C2-00-00-01. Hash index=0x39 */
...@@ -1197,7 +1197,7 @@ set_multicast (struct net_device *dev) ...@@ -1197,7 +1197,7 @@ set_multicast (struct net_device *dev)
static int static int
rio_ethtool_ioctl (struct net_device *dev, void __user *useraddr) rio_ethtool_ioctl (struct net_device *dev, void __user *useraddr)
{ {
struct netdev_private *np = dev->priv; struct netdev_private *np = netdev_priv(dev);
u32 ethcmd; u32 ethcmd;
if (copy_from_user (&ethcmd, useraddr, sizeof (ethcmd))) if (copy_from_user (&ethcmd, useraddr, sizeof (ethcmd)))
...@@ -1324,7 +1324,7 @@ static int ...@@ -1324,7 +1324,7 @@ static int
rio_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) rio_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
{ {
int phy_addr; int phy_addr;
struct netdev_private *np = dev->priv; struct netdev_private *np = netdev_priv(dev);
struct mii_data *miidata = (struct mii_data *) &rq->ifr_ifru; struct mii_data *miidata = (struct mii_data *) &rq->ifr_ifru;
struct netdev_desc *desc; struct netdev_desc *desc;
...@@ -1490,7 +1490,7 @@ mii_wait_link (struct net_device *dev, int wait) ...@@ -1490,7 +1490,7 @@ mii_wait_link (struct net_device *dev, int wait)
int phy_addr; int phy_addr;
struct netdev_private *np; struct netdev_private *np;
np = dev->priv; np = netdev_priv(dev);
phy_addr = np->phy_addr; phy_addr = np->phy_addr;
do { do {
...@@ -1512,7 +1512,7 @@ mii_get_media (struct net_device *dev) ...@@ -1512,7 +1512,7 @@ mii_get_media (struct net_device *dev)
int phy_addr; int phy_addr;
struct netdev_private *np; struct netdev_private *np;
np = dev->priv; np = netdev_priv(dev);
phy_addr = np->phy_addr; phy_addr = np->phy_addr;
bmsr.image = mii_read (dev, phy_addr, MII_BMSR); bmsr.image = mii_read (dev, phy_addr, MII_BMSR);
...@@ -1594,7 +1594,7 @@ mii_set_media (struct net_device *dev) ...@@ -1594,7 +1594,7 @@ mii_set_media (struct net_device *dev)
ANAR_t anar; ANAR_t anar;
int phy_addr; int phy_addr;
struct netdev_private *np; struct netdev_private *np;
np = dev->priv; np = netdev_priv(dev);
phy_addr = np->phy_addr; phy_addr = np->phy_addr;
/* Does user set speed? */ /* Does user set speed? */
...@@ -1684,7 +1684,7 @@ mii_get_media_pcs (struct net_device *dev) ...@@ -1684,7 +1684,7 @@ mii_get_media_pcs (struct net_device *dev)
int phy_addr; int phy_addr;
struct netdev_private *np; struct netdev_private *np;
np = dev->priv; np = netdev_priv(dev);
phy_addr = np->phy_addr; phy_addr = np->phy_addr;
bmsr.image = mii_read (dev, phy_addr, PCS_BMSR); bmsr.image = mii_read (dev, phy_addr, PCS_BMSR);
...@@ -1740,7 +1740,7 @@ mii_set_media_pcs (struct net_device *dev) ...@@ -1740,7 +1740,7 @@ mii_set_media_pcs (struct net_device *dev)
ANAR_PCS_t anar; ANAR_PCS_t anar;
int phy_addr; int phy_addr;
struct netdev_private *np; struct netdev_private *np;
np = dev->priv; np = netdev_priv(dev);
phy_addr = np->phy_addr; phy_addr = np->phy_addr;
/* Auto-Negotiation? */ /* Auto-Negotiation? */
...@@ -1794,7 +1794,7 @@ static int ...@@ -1794,7 +1794,7 @@ static int
rio_close (struct net_device *dev) rio_close (struct net_device *dev)
{ {
long ioaddr = dev->base_addr; long ioaddr = dev->base_addr;
struct netdev_private *np = dev->priv; struct netdev_private *np = netdev_priv(dev);
struct sk_buff *skb; struct sk_buff *skb;
int i; int i;
...@@ -1840,7 +1840,7 @@ rio_remove1 (struct pci_dev *pdev) ...@@ -1840,7 +1840,7 @@ rio_remove1 (struct pci_dev *pdev)
struct net_device *dev = pci_get_drvdata (pdev); struct net_device *dev = pci_get_drvdata (pdev);
if (dev) { if (dev) {
struct netdev_private *np = dev->priv; struct netdev_private *np = netdev_priv(dev);
unregister_netdev (dev); unregister_netdev (dev);
pci_free_consistent (pdev, RX_TOTAL_SIZE, np->rx_ring, pci_free_consistent (pdev, RX_TOTAL_SIZE, np->rx_ring,
......
...@@ -631,7 +631,7 @@ static int __devinit hamachi_init_one (struct pci_dev *pdev, ...@@ -631,7 +631,7 @@ static int __devinit hamachi_init_one (struct pci_dev *pdev,
read_eeprom(ioaddr, i), i % 16 != 15 ? " " : "\n"); read_eeprom(ioaddr, i), i % 16 != 15 ? " " : "\n");
#endif #endif
hmp = dev->priv; hmp = netdev_priv(dev);
spin_lock_init(&hmp->lock); spin_lock_init(&hmp->lock);
hmp->mii_if.dev = dev; hmp->mii_if.dev = dev;
...@@ -851,7 +851,7 @@ static void mdio_write(struct net_device *dev, int phy_id, int location, int val ...@@ -851,7 +851,7 @@ static void mdio_write(struct net_device *dev, int phy_id, int location, int val
static int hamachi_open(struct net_device *dev) static int hamachi_open(struct net_device *dev)
{ {
struct hamachi_private *hmp = dev->priv; struct hamachi_private *hmp = netdev_priv(dev);
long ioaddr = dev->base_addr; long ioaddr = dev->base_addr;
int i; int i;
u32 rx_int_var, tx_int_var; u32 rx_int_var, tx_int_var;
...@@ -1000,7 +1000,7 @@ static int hamachi_open(struct net_device *dev) ...@@ -1000,7 +1000,7 @@ static int hamachi_open(struct net_device *dev)
static inline int hamachi_tx(struct net_device *dev) static inline int hamachi_tx(struct net_device *dev)
{ {
struct hamachi_private *hmp = dev->priv; struct hamachi_private *hmp = netdev_priv(dev);
/* Update the dirty pointer until we find an entry that is /* Update the dirty pointer until we find an entry that is
still owned by the card */ still owned by the card */
...@@ -1032,7 +1032,7 @@ static inline int hamachi_tx(struct net_device *dev) ...@@ -1032,7 +1032,7 @@ static inline int hamachi_tx(struct net_device *dev)
static void hamachi_timer(unsigned long data) static void hamachi_timer(unsigned long data)
{ {
struct net_device *dev = (struct net_device *)data; struct net_device *dev = (struct net_device *)data;
struct hamachi_private *hmp = dev->priv; struct hamachi_private *hmp = netdev_priv(dev);
long ioaddr = dev->base_addr; long ioaddr = dev->base_addr;
int next_tick = 10*HZ; int next_tick = 10*HZ;
...@@ -1057,7 +1057,7 @@ static void hamachi_timer(unsigned long data) ...@@ -1057,7 +1057,7 @@ static void hamachi_timer(unsigned long data)
static void hamachi_tx_timeout(struct net_device *dev) static void hamachi_tx_timeout(struct net_device *dev)
{ {
int i; int i;
struct hamachi_private *hmp = dev->priv; struct hamachi_private *hmp = netdev_priv(dev);
long ioaddr = dev->base_addr; long ioaddr = dev->base_addr;
printk(KERN_WARNING "%s: Hamachi transmit timed out, status %8.8x," printk(KERN_WARNING "%s: Hamachi transmit timed out, status %8.8x,"
...@@ -1163,7 +1163,7 @@ static void hamachi_tx_timeout(struct net_device *dev) ...@@ -1163,7 +1163,7 @@ static void hamachi_tx_timeout(struct net_device *dev)
/* Initialize the Rx and Tx rings, along with various 'dev' bits. */ /* Initialize the Rx and Tx rings, along with various 'dev' bits. */
static void hamachi_init_ring(struct net_device *dev) static void hamachi_init_ring(struct net_device *dev)
{ {
struct hamachi_private *hmp = dev->priv; struct hamachi_private *hmp = netdev_priv(dev);
int i; int i;
hmp->tx_full = 0; hmp->tx_full = 0;
...@@ -1255,7 +1255,7 @@ do { \ ...@@ -1255,7 +1255,7 @@ do { \
static int hamachi_start_xmit(struct sk_buff *skb, struct net_device *dev) static int hamachi_start_xmit(struct sk_buff *skb, struct net_device *dev)
{ {
struct hamachi_private *hmp = dev->priv; struct hamachi_private *hmp = netdev_priv(dev);
unsigned entry; unsigned entry;
u16 status; u16 status;
...@@ -1383,7 +1383,7 @@ static irqreturn_t hamachi_interrupt(int irq, void *dev_instance, struct pt_regs ...@@ -1383,7 +1383,7 @@ static irqreturn_t hamachi_interrupt(int irq, void *dev_instance, struct pt_regs
#endif #endif
ioaddr = dev->base_addr; ioaddr = dev->base_addr;
hmp = dev->priv; hmp = netdev_priv(dev);
spin_lock(&hmp->lock); spin_lock(&hmp->lock);
do { do {
...@@ -1477,7 +1477,7 @@ static irqreturn_t hamachi_interrupt(int irq, void *dev_instance, struct pt_regs ...@@ -1477,7 +1477,7 @@ static irqreturn_t hamachi_interrupt(int irq, void *dev_instance, struct pt_regs
for clarity and better register allocation. */ for clarity and better register allocation. */
static int hamachi_rx(struct net_device *dev) static int hamachi_rx(struct net_device *dev)
{ {
struct hamachi_private *hmp = dev->priv; struct hamachi_private *hmp = netdev_priv(dev);
int entry = hmp->cur_rx % RX_RING_SIZE; int entry = hmp->cur_rx % RX_RING_SIZE;
int boguscnt = (hmp->dirty_rx + RX_RING_SIZE) - hmp->cur_rx; int boguscnt = (hmp->dirty_rx + RX_RING_SIZE) - hmp->cur_rx;
...@@ -1693,7 +1693,7 @@ static int hamachi_rx(struct net_device *dev) ...@@ -1693,7 +1693,7 @@ static int hamachi_rx(struct net_device *dev)
static void hamachi_error(struct net_device *dev, int intr_status) static void hamachi_error(struct net_device *dev, int intr_status)
{ {
long ioaddr = dev->base_addr; long ioaddr = dev->base_addr;
struct hamachi_private *hmp = dev->priv; struct hamachi_private *hmp = netdev_priv(dev);
if (intr_status & (LinkChange|NegotiationChange)) { if (intr_status & (LinkChange|NegotiationChange)) {
if (hamachi_debug > 1) if (hamachi_debug > 1)
...@@ -1727,7 +1727,7 @@ static void hamachi_error(struct net_device *dev, int intr_status) ...@@ -1727,7 +1727,7 @@ static void hamachi_error(struct net_device *dev, int intr_status)
static int hamachi_close(struct net_device *dev) static int hamachi_close(struct net_device *dev)
{ {
long ioaddr = dev->base_addr; long ioaddr = dev->base_addr;
struct hamachi_private *hmp = dev->priv; struct hamachi_private *hmp = netdev_priv(dev);
struct sk_buff *skb; struct sk_buff *skb;
int i; int i;
...@@ -1813,7 +1813,7 @@ static int hamachi_close(struct net_device *dev) ...@@ -1813,7 +1813,7 @@ static int hamachi_close(struct net_device *dev)
static struct net_device_stats *hamachi_get_stats(struct net_device *dev) static struct net_device_stats *hamachi_get_stats(struct net_device *dev)
{ {
long ioaddr = dev->base_addr; long ioaddr = dev->base_addr;
struct hamachi_private *hmp = dev->priv; struct hamachi_private *hmp = netdev_priv(dev);
/* We should lock this segment of code for SMP eventually, although /* We should lock this segment of code for SMP eventually, although
the vulnerability window is very small and statistics are the vulnerability window is very small and statistics are
...@@ -1869,7 +1869,7 @@ static void set_rx_mode(struct net_device *dev) ...@@ -1869,7 +1869,7 @@ static void set_rx_mode(struct net_device *dev)
static int netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr) static int netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr)
{ {
struct hamachi_private *np = dev->priv; struct hamachi_private *np = netdev_priv(dev);
u32 ethcmd; u32 ethcmd;
if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd))) if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
...@@ -1934,7 +1934,7 @@ static int netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr) ...@@ -1934,7 +1934,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) static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{ {
struct hamachi_private *np = dev->priv; struct hamachi_private *np = netdev_priv(dev);
struct mii_ioctl_data *data = if_mii(rq); struct mii_ioctl_data *data = if_mii(rq);
int rc; int rc;
...@@ -1976,7 +1976,7 @@ static void __devexit hamachi_remove_one (struct pci_dev *pdev) ...@@ -1976,7 +1976,7 @@ static void __devexit hamachi_remove_one (struct pci_dev *pdev)
struct net_device *dev = pci_get_drvdata(pdev); struct net_device *dev = pci_get_drvdata(pdev);
if (dev) { if (dev) {
struct hamachi_private *hmp = dev->priv; struct hamachi_private *hmp = netdev_priv(dev);
pci_free_consistent(pdev, RX_TOTAL_SIZE, hmp->rx_ring, pci_free_consistent(pdev, RX_TOTAL_SIZE, hmp->rx_ring,
hmp->rx_ring_dma); hmp->rx_ring_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