Merge git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog
[safe/jmp/linux-2.6] / drivers / net / wireless / wavelan.c
index 6fa3d79..ab7fc5c 100644 (file)
@@ -40,11 +40,11 @@ static u8 wv_irq_to_psa(int irq)
  */
 static int __init wv_psa_to_irq(u8 irqval)
 {
-       int irq;
+       int i;
 
-       for (irq = 0; irq < ARRAY_SIZE(irqvals); irq++)
-               if (irqvals[irq] == irqval)
-                       return irq;
+       for (i = 0; i < ARRAY_SIZE(irqvals); i++)
+               if (irqvals[i] == irqval)
+                       return i;
 
        return -1;
 }
@@ -134,7 +134,7 @@ static inline void wv_16_on(unsigned long ioaddr, u16 hacr)
  */
 static inline void wv_ints_off(struct net_device * dev)
 {
-       net_local *lp = (net_local *) dev->priv;
+       net_local *lp = netdev_priv(dev);
        unsigned long ioaddr = dev->base_addr;
        
        lp->hacr &= ~HACR_INTRON;
@@ -148,7 +148,7 @@ static inline void wv_ints_off(struct net_device * dev)
  */
 static inline void wv_ints_on(struct net_device * dev)
 {
-       net_local *lp = (net_local *) dev->priv;
+       net_local *lp = netdev_priv(dev);
        unsigned long ioaddr = dev->base_addr;
 
        lp->hacr |= HACR_INTRON;
@@ -526,7 +526,7 @@ static inline void obram_write(unsigned long ioaddr, u16 o, u8 * b, int n)
  */
 static void wv_ack(struct net_device * dev)
 {
-       net_local *lp = (net_local *) dev->priv;
+       net_local *lp = netdev_priv(dev);
        unsigned long ioaddr = dev->base_addr;
        u16 scb_cs;
        int i;
@@ -568,7 +568,7 @@ static void wv_ack(struct net_device * dev)
  */
 static int wv_synchronous_cmd(struct net_device * dev, const char *str)
 {
-       net_local *lp = (net_local *) dev->priv;
+       net_local *lp = netdev_priv(dev);
        unsigned long ioaddr = dev->base_addr;
        u16 scb_cmd;
        ach_t cb;
@@ -735,9 +735,9 @@ if (lp->tx_n_in_use > 0)
                if (tx_status & AC_SFLD_OK) {
                        int ncollisions;
 
-                       lp->stats.tx_packets++;
+                       dev->stats.tx_packets++;
                        ncollisions = tx_status & AC_SFLD_MAXCOL;
-                       lp->stats.collisions += ncollisions;
+                       dev->stats.collisions += ncollisions;
 #ifdef DEBUG_TX_INFO
                        if (ncollisions > 0)
                                printk(KERN_DEBUG
@@ -745,9 +745,9 @@ if (lp->tx_n_in_use > 0)
                                       dev->name, ncollisions);
 #endif
                } else {
-                       lp->stats.tx_errors++;
+                       dev->stats.tx_errors++;
                        if (tx_status & AC_SFLD_S10) {
-                               lp->stats.tx_carrier_errors++;
+                               dev->stats.tx_carrier_errors++;
 #ifdef DEBUG_TX_FAIL
                                printk(KERN_DEBUG
                                       "%s: wv_complete(): tx error: no CS.\n",
@@ -755,7 +755,7 @@ if (lp->tx_n_in_use > 0)
 #endif
                        }
                        if (tx_status & AC_SFLD_S9) {
-                               lp->stats.tx_carrier_errors++;
+                               dev->stats.tx_carrier_errors++;
 #ifdef DEBUG_TX_FAIL
                                printk(KERN_DEBUG
                                       "%s: wv_complete(): tx error: lost CTS.\n",
@@ -763,7 +763,7 @@ if (lp->tx_n_in_use > 0)
 #endif
                        }
                        if (tx_status & AC_SFLD_S8) {
-                               lp->stats.tx_fifo_errors++;
+                               dev->stats.tx_fifo_errors++;
 #ifdef DEBUG_TX_FAIL
                                printk(KERN_DEBUG
                                       "%s: wv_complete(): tx error: slow DMA.\n",
@@ -771,7 +771,7 @@ if (lp->tx_n_in_use > 0)
 #endif
                        }
                        if (tx_status & AC_SFLD_S6) {
-                               lp->stats.tx_heartbeat_errors++;
+                               dev->stats.tx_heartbeat_errors++;
 #ifdef DEBUG_TX_FAIL
                                printk(KERN_DEBUG
                                       "%s: wv_complete(): tx error: heart beat.\n",
@@ -779,7 +779,7 @@ if (lp->tx_n_in_use > 0)
 #endif
                        }
                        if (tx_status & AC_SFLD_S5) {
-                               lp->stats.tx_aborted_errors++;
+                               dev->stats.tx_aborted_errors++;
 #ifdef DEBUG_TX_FAIL
                                printk(KERN_DEBUG
                                       "%s: wv_complete(): tx error: too many collisions.\n",
@@ -824,7 +824,7 @@ if (lp->tx_n_in_use > 0)
  */
 static void wv_82586_reconfig(struct net_device * dev)
 {
-       net_local *lp = (net_local *) dev->priv;
+       net_local *lp = netdev_priv(dev);
        unsigned long flags;
 
        /* Arm the flag, will be cleard in wv_82586_config() */
@@ -922,7 +922,7 @@ static void wv_psa_show(psa_t * p)
 static void wv_mmc_show(struct net_device * dev)
 {
        unsigned long ioaddr = dev->base_addr;
-       net_local *lp = (net_local *) dev->priv;
+       net_local *lp = netdev_priv(dev);
        mmr_t m;
 
        /* Basic check */
@@ -1102,8 +1102,6 @@ static void wv_scb_show(unsigned long ioaddr)
  */
 static void wv_ru_show(struct net_device * dev)
 {
-       /* net_local *lp = (net_local *) dev->priv; */
-
        printk(KERN_DEBUG
               "##### WaveLAN i82586 receiver unit status: #####\n");
        printk(KERN_DEBUG "ru:");
@@ -1148,7 +1146,7 @@ static void wv_cu_show_one(struct net_device * dev, net_local * lp, int i, u16 p
  */
 static void wv_cu_show(struct net_device * dev)
 {
-       net_local *lp = (net_local *) dev->priv;
+       net_local *lp = netdev_priv(dev);
        unsigned int i;
        u16 p;
 
@@ -1190,7 +1188,7 @@ static void wv_local_show(struct net_device * dev)
 {
        net_local *lp;
 
-       lp = (net_local *) dev->priv;
+       lp = netdev_priv(dev);
 
        printk(KERN_DEBUG "local:");
        printk(" tx_n_in_use=%d,", lp->tx_n_in_use);
@@ -1250,7 +1248,7 @@ static inline void wv_packet_info(u8 * p, /* Packet to dump */
 static void wv_init_info(struct net_device * dev)
 {
        short ioaddr = dev->base_addr;
-       net_local *lp = (net_local *) dev->priv;
+       net_local *lp = netdev_priv(dev);
        psa_t psa;
 
        /* Read the parameter storage area */
@@ -1348,20 +1346,6 @@ static void wv_init_info(struct net_device * dev)
  * or wireless extensions
  */
 
-/*------------------------------------------------------------------*/
-/*
- * Get the current Ethernet statistics. This may be called with the
- * card open or closed.
- * Used when the user read /proc/net/dev
- */
-static en_stats *wavelan_get_stats(struct net_device * dev)
-{
-#ifdef DEBUG_IOCTL_TRACE
-       printk(KERN_DEBUG "%s: <>wavelan_get_stats()\n", dev->name);
-#endif
-
-       return (&((net_local *) dev->priv)->stats);
-}
 
 /*------------------------------------------------------------------*/
 /*
@@ -1373,7 +1357,7 @@ static en_stats *wavelan_get_stats(struct net_device * dev)
  */
 static void wavelan_set_multicast_list(struct net_device * dev)
 {
-       net_local *lp = (net_local *) dev->priv;
+       net_local *lp = netdev_priv(dev);
 
 #ifdef DEBUG_IOCTL_TRACE
        printk(KERN_DEBUG "%s: ->wavelan_set_multicast_list()\n",
@@ -1707,7 +1691,7 @@ static inline void wl_spy_gather(struct net_device * dev,
  */
 static inline void wl_his_gather(struct net_device * dev, u8 * stats)
 {                              /* Statistics to gather */
-       net_local *lp = (net_local *) dev->priv;
+       net_local *lp = netdev_priv(dev);
        u8 level = stats[0] & MMR_SIGNAL_LVL;
        int i;
 
@@ -1744,7 +1728,7 @@ static int wavelan_set_nwid(struct net_device *dev,
                            char *extra)
 {
        unsigned long ioaddr = dev->base_addr;
-       net_local *lp = (net_local *) dev->priv;        /* lp is not unused */
+       net_local *lp = netdev_priv(dev);       /* lp is not unused */
        psa_t psa;
        mm_t m;
        unsigned long flags;
@@ -1803,7 +1787,7 @@ static int wavelan_get_nwid(struct net_device *dev,
                            char *extra)
 {
        unsigned long ioaddr = dev->base_addr;
-       net_local *lp = (net_local *) dev->priv;        /* lp is not unused */
+       net_local *lp = netdev_priv(dev);       /* lp is not unused */
        psa_t psa;
        unsigned long flags;
        int ret = 0;
@@ -1835,7 +1819,7 @@ static int wavelan_set_freq(struct net_device *dev,
                            char *extra)
 {
        unsigned long ioaddr = dev->base_addr;
-       net_local *lp = (net_local *) dev->priv;        /* lp is not unused */
+       net_local *lp = netdev_priv(dev);       /* lp is not unused */
        unsigned long flags;
        int ret;
 
@@ -1865,7 +1849,7 @@ static int wavelan_get_freq(struct net_device *dev,
                            char *extra)
 {
        unsigned long ioaddr = dev->base_addr;
-       net_local *lp = (net_local *) dev->priv;        /* lp is not unused */
+       net_local *lp = netdev_priv(dev);       /* lp is not unused */
        psa_t psa;
        unsigned long flags;
        int ret = 0;
@@ -1911,7 +1895,7 @@ static int wavelan_set_sens(struct net_device *dev,
                            char *extra)
 {
        unsigned long ioaddr = dev->base_addr;
-       net_local *lp = (net_local *) dev->priv;        /* lp is not unused */
+       net_local *lp = netdev_priv(dev);       /* lp is not unused */
        psa_t psa;
        unsigned long flags;
        int ret = 0;
@@ -1947,7 +1931,7 @@ static int wavelan_get_sens(struct net_device *dev,
                            char *extra)
 {
        unsigned long ioaddr = dev->base_addr;
-       net_local *lp = (net_local *) dev->priv;        /* lp is not unused */
+       net_local *lp = netdev_priv(dev);       /* lp is not unused */
        psa_t psa;
        unsigned long flags;
        int ret = 0;
@@ -1978,7 +1962,7 @@ static int wavelan_set_encode(struct net_device *dev,
                              char *extra)
 {
        unsigned long ioaddr = dev->base_addr;
-       net_local *lp = (net_local *) dev->priv;        /* lp is not unused */
+       net_local *lp = netdev_priv(dev);       /* lp is not unused */
        unsigned long flags;
        psa_t psa;
        int ret = 0;
@@ -2048,7 +2032,7 @@ static int wavelan_get_encode(struct net_device *dev,
                              char *extra)
 {
        unsigned long ioaddr = dev->base_addr;
-       net_local *lp = (net_local *) dev->priv;        /* lp is not unused */
+       net_local *lp = netdev_priv(dev);       /* lp is not unused */
        psa_t psa;
        unsigned long flags;
        int ret = 0;
@@ -2095,7 +2079,7 @@ static int wavelan_get_range(struct net_device *dev,
                             char *extra)
 {
        unsigned long ioaddr = dev->base_addr;
-       net_local *lp = (net_local *) dev->priv;        /* lp is not unused */
+       net_local *lp = netdev_priv(dev);       /* lp is not unused */
        struct iw_range *range = (struct iw_range *) extra;
        unsigned long flags;
        int ret = 0;
@@ -2170,7 +2154,7 @@ static int wavelan_set_qthr(struct net_device *dev,
                            char *extra)
 {
        unsigned long ioaddr = dev->base_addr;
-       net_local *lp = (net_local *) dev->priv;        /* lp is not unused */
+       net_local *lp = netdev_priv(dev);       /* lp is not unused */
        psa_t psa;
        unsigned long flags;
 
@@ -2202,7 +2186,7 @@ static int wavelan_get_qthr(struct net_device *dev,
                            char *extra)
 {
        unsigned long ioaddr = dev->base_addr;
-       net_local *lp = (net_local *) dev->priv;        /* lp is not unused */
+       net_local *lp = netdev_priv(dev);       /* lp is not unused */
        psa_t psa;
        unsigned long flags;
 
@@ -2230,7 +2214,7 @@ static int wavelan_set_histo(struct net_device *dev,
                             union iwreq_data *wrqu,
                             char *extra)
 {
-       net_local *lp = (net_local *) dev->priv;        /* lp is not unused */
+       net_local *lp = netdev_priv(dev);       /* lp is not unused */
 
        /* Check the number of intervals. */
        if (wrqu->data.length > 16) {
@@ -2273,7 +2257,7 @@ static int wavelan_get_histo(struct net_device *dev,
                             union iwreq_data *wrqu,
                             char *extra)
 {
-       net_local *lp = (net_local *) dev->priv;        /* lp is not unused */
+       net_local *lp = netdev_priv(dev);       /* lp is not unused */
 
        /* Set the number of intervals. */
        wrqu->data.length = lp->his_number;
@@ -2377,7 +2361,7 @@ static const struct iw_handler_def        wavelan_handler_def =
 static iw_stats *wavelan_get_wireless_stats(struct net_device * dev)
 {
        unsigned long ioaddr = dev->base_addr;
-       net_local *lp = (net_local *) dev->priv;
+       net_local *lp = netdev_priv(dev);
        mmr_t m;
        iw_stats *wstats;
        unsigned long flags;
@@ -2452,7 +2436,7 @@ static iw_stats *wavelan_get_wireless_stats(struct net_device * dev)
 static void
 wv_packet_read(struct net_device * dev, u16 buf_off, int sksize)
 {
-       net_local *lp = (net_local *) dev->priv;
+       net_local *lp = netdev_priv(dev);
        unsigned long ioaddr = dev->base_addr;
        struct sk_buff *skb;
 
@@ -2468,7 +2452,7 @@ wv_packet_read(struct net_device * dev, u16 buf_off, int sksize)
                       "%s: wv_packet_read(): could not alloc_skb(%d, GFP_ATOMIC).\n",
                       dev->name, sksize);
 #endif
-               lp->stats.rx_dropped++;
+               dev->stats.rx_dropped++;
                return;
        }
 
@@ -2528,9 +2512,8 @@ wv_packet_read(struct net_device * dev, u16 buf_off, int sksize)
        netif_rx(skb);
 
        /* Keep statistics up to date */
-       dev->last_rx = jiffies;
-       lp->stats.rx_packets++;
-       lp->stats.rx_bytes += sksize;
+       dev->stats.rx_packets++;
+       dev->stats.rx_bytes += sksize;
 
 #ifdef DEBUG_RX_TRACE
        printk(KERN_DEBUG "%s: <-wv_packet_read()\n", dev->name);
@@ -2547,7 +2530,7 @@ wv_packet_read(struct net_device * dev, u16 buf_off, int sksize)
 static void wv_receive(struct net_device * dev)
 {
        unsigned long ioaddr = dev->base_addr;
-       net_local *lp = (net_local *) dev->priv;
+       net_local *lp = netdev_priv(dev);
        fd_t fd;
        rbd_t rbd;
        int nreaped = 0;
@@ -2611,7 +2594,7 @@ static void wv_receive(struct net_device * dev)
 #endif
                } else {        /* If reception was no successful */
 
-                       lp->stats.rx_errors++;
+                       dev->stats.rx_errors++;
 
 #ifdef DEBUG_RX_INFO
                        printk(KERN_DEBUG
@@ -2627,7 +2610,7 @@ static void wv_receive(struct net_device * dev)
 #endif
 
                        if ((fd.fd_status & FD_STATUS_S7) != 0) {
-                               lp->stats.rx_length_errors++;
+                               dev->stats.rx_length_errors++;
 #ifdef DEBUG_RX_FAIL
                                printk(KERN_DEBUG
                                       "%s: wv_receive(): frame too short.\n",
@@ -2636,7 +2619,7 @@ static void wv_receive(struct net_device * dev)
                        }
 
                        if ((fd.fd_status & FD_STATUS_S8) != 0) {
-                               lp->stats.rx_over_errors++;
+                               dev->stats.rx_over_errors++;
 #ifdef DEBUG_RX_FAIL
                                printk(KERN_DEBUG
                                       "%s: wv_receive(): rx DMA overrun.\n",
@@ -2645,7 +2628,7 @@ static void wv_receive(struct net_device * dev)
                        }
 
                        if ((fd.fd_status & FD_STATUS_S9) != 0) {
-                               lp->stats.rx_fifo_errors++;
+                               dev->stats.rx_fifo_errors++;
 #ifdef DEBUG_RX_FAIL
                                printk(KERN_DEBUG
                                       "%s: wv_receive(): ran out of resources.\n",
@@ -2654,7 +2637,7 @@ static void wv_receive(struct net_device * dev)
                        }
 
                        if ((fd.fd_status & FD_STATUS_S10) != 0) {
-                               lp->stats.rx_frame_errors++;
+                               dev->stats.rx_frame_errors++;
 #ifdef DEBUG_RX_FAIL
                                printk(KERN_DEBUG
                                       "%s: wv_receive(): alignment error.\n",
@@ -2663,7 +2646,7 @@ static void wv_receive(struct net_device * dev)
                        }
 
                        if ((fd.fd_status & FD_STATUS_S11) != 0) {
-                               lp->stats.rx_crc_errors++;
+                               dev->stats.rx_crc_errors++;
 #ifdef DEBUG_RX_FAIL
                                printk(KERN_DEBUG
                                       "%s: wv_receive(): CRC error.\n",
@@ -2729,7 +2712,7 @@ static void wv_receive(struct net_device * dev)
  */
 static int wv_packet_write(struct net_device * dev, void *buf, short length)
 {
-       net_local *lp = (net_local *) dev->priv;
+       net_local *lp = netdev_priv(dev);
        unsigned long ioaddr = dev->base_addr;
        unsigned short txblock;
        unsigned short txpred;
@@ -2829,7 +2812,7 @@ static int wv_packet_write(struct net_device * dev, void *buf, short length)
        dev->trans_start = jiffies;
 
        /* Keep stats up to date. */
-       lp->stats.tx_bytes += length;
+       dev->stats.tx_bytes += length;
 
        if (lp->tx_first_in_use == I82586NULL)
                lp->tx_first_in_use = txblock;
@@ -2860,7 +2843,7 @@ static int wv_packet_write(struct net_device * dev, void *buf, short length)
  */
 static int wavelan_packet_xmit(struct sk_buff *skb, struct net_device * dev)
 {
-       net_local *lp = (net_local *) dev->priv;
+       net_local *lp = netdev_priv(dev);
        unsigned long flags;
        char data[ETH_ZLEN];
 
@@ -2884,12 +2867,8 @@ static int wavelan_packet_xmit(struct sk_buff *skb, struct net_device * dev)
                spin_unlock_irqrestore(&lp->spinlock, flags);
                /* Check that we can continue */
                if (lp->tx_n_in_use == (NTXBLOCKS - 1))
-                       return 1;
+                       return NETDEV_TX_BUSY;
        }
-#ifdef DEBUG_TX_ERROR
-       if (skb->next)
-               printk(KERN_INFO "skb has next\n");
-#endif
 
        /* Do we need some padding? */
        /* Note : on wireless the propagation time is in the order of 1us,
@@ -2901,10 +2880,10 @@ static int wavelan_packet_xmit(struct sk_buff *skb, struct net_device * dev)
                skb_copy_from_linear_data(skb, data, skb->len);
                /* Write packet on the card */
                if(wv_packet_write(dev, data, ETH_ZLEN))
-                       return 1;       /* We failed */
+                       return NETDEV_TX_BUSY;  /* We failed */
        }
        else if(wv_packet_write(dev, skb->data, skb->len))
-               return 1;       /* We failed */
+               return NETDEV_TX_BUSY;  /* We failed */
 
 
        dev_kfree_skb(skb);
@@ -2928,7 +2907,7 @@ static int wavelan_packet_xmit(struct sk_buff *skb, struct net_device * dev)
 static int wv_mmc_init(struct net_device * dev)
 {
        unsigned long ioaddr = dev->base_addr;
-       net_local *lp = (net_local *) dev->priv;
+       net_local *lp = netdev_priv(dev);
        psa_t psa;
        mmw_t m;
        int configured;
@@ -3099,7 +3078,7 @@ static int wv_mmc_init(struct net_device * dev)
  */
 static int wv_ru_start(struct net_device * dev)
 {
-       net_local *lp = (net_local *) dev->priv;
+       net_local *lp = netdev_priv(dev);
        unsigned long ioaddr = dev->base_addr;
        u16 scb_cs;
        fd_t fd;
@@ -3191,7 +3170,7 @@ static int wv_ru_start(struct net_device * dev)
  */
 static int wv_cu_start(struct net_device * dev)
 {
-       net_local *lp = (net_local *) dev->priv;
+       net_local *lp = netdev_priv(dev);
        unsigned long ioaddr = dev->base_addr;
        int i;
        u16 txblock;
@@ -3292,7 +3271,7 @@ static int wv_cu_start(struct net_device * dev)
  */
 static int wv_82586_start(struct net_device * dev)
 {
-       net_local *lp = (net_local *) dev->priv;
+       net_local *lp = netdev_priv(dev);
        unsigned long ioaddr = dev->base_addr;
        scp_t scp;              /* system configuration pointer */
        iscp_t iscp;            /* intermediate scp */
@@ -3424,7 +3403,7 @@ static int wv_82586_start(struct net_device * dev)
  */
 static void wv_82586_config(struct net_device * dev)
 {
-       net_local *lp = (net_local *) dev->priv;
+       net_local *lp = netdev_priv(dev);
        unsigned long ioaddr = dev->base_addr;
        unsigned short txblock;
        unsigned short txpred;
@@ -3600,7 +3579,7 @@ static void wv_82586_config(struct net_device * dev)
  */
 static void wv_82586_stop(struct net_device * dev)
 {
-       net_local *lp = (net_local *) dev->priv;
+       net_local *lp = netdev_priv(dev);
        unsigned long ioaddr = dev->base_addr;
        u16 scb_cmd;
 
@@ -3637,7 +3616,7 @@ static void wv_82586_stop(struct net_device * dev)
  */
 static int wv_hw_reset(struct net_device * dev)
 {
-       net_local *lp = (net_local *) dev->priv;
+       net_local *lp = netdev_priv(dev);
        unsigned long ioaddr = dev->base_addr;
 
 #ifdef DEBUG_CONFIG_TRACE
@@ -3738,7 +3717,7 @@ static irqreturn_t wavelan_interrupt(int irq, void *dev_id)
        printk(KERN_DEBUG "%s: ->wavelan_interrupt()\n", dev->name);
 #endif
 
-       lp = (net_local *) dev->priv;
+       lp = netdev_priv(dev);
        ioaddr = dev->base_addr;
 
 #ifdef DEBUG_INTERRUPT_INFO
@@ -3881,7 +3860,7 @@ static irqreturn_t wavelan_interrupt(int irq, void *dev_id)
  */
 static void wavelan_watchdog(struct net_device *       dev)
 {
-       net_local *     lp = (net_local *)dev->priv;
+       net_local *lp = netdev_priv(dev);
        u_long          ioaddr = dev->base_addr;
        unsigned long   flags;
        unsigned int    nreaped;
@@ -3961,7 +3940,7 @@ static void wavelan_watchdog(struct net_device *  dev)
  */
 static int wavelan_open(struct net_device * dev)
 {
-       net_local *     lp = (net_local *)dev->priv;
+       net_local *lp = netdev_priv(dev);
        unsigned long   flags;
 
 #ifdef DEBUG_CALLBACK_TRACE
@@ -4016,7 +3995,7 @@ static int wavelan_open(struct net_device * dev)
  */
 static int wavelan_close(struct net_device * dev)
 {
-       net_local *lp = (net_local *) dev->priv;
+       net_local *lp = netdev_priv(dev);
        unsigned long flags;
 
 #ifdef DEBUG_CALLBACK_TRACE
@@ -4041,6 +4020,22 @@ static int wavelan_close(struct net_device * dev)
        return 0;
 }
 
+static const struct net_device_ops wavelan_netdev_ops = {
+       .ndo_open               = wavelan_open,
+       .ndo_stop               = wavelan_close,
+       .ndo_start_xmit         = wavelan_packet_xmit,
+       .ndo_set_multicast_list = wavelan_set_multicast_list,
+        .ndo_tx_timeout                = wavelan_watchdog,
+       .ndo_change_mtu         = eth_change_mtu,
+       .ndo_validate_addr      = eth_validate_addr,
+#ifdef SET_MAC_ADDRESS
+       .ndo_set_mac_address    = wavelan_set_mac_address
+#else
+       .ndo_set_mac_address    = eth_mac_addr,
+#endif
+};
+
+
 /*------------------------------------------------------------------*/
 /*
  * Probe an I/O address, and if the WaveLAN is there configure the
@@ -4115,8 +4110,8 @@ static int __init wavelan_config(struct net_device *dev, unsigned short ioaddr)
        dev->if_port = 0;
 
        /* Initialize device structures */
-       memset(dev->priv, 0, sizeof(net_local));
-       lp = (net_local *) dev->priv;
+       memset(netdev_priv(dev), 0, sizeof(net_local));
+       lp = netdev_priv(dev);
 
        /* Back link to the device structure. */
        lp->dev = dev;
@@ -4133,17 +4128,8 @@ static int __init wavelan_config(struct net_device *dev, unsigned short ioaddr)
        /* Init spinlock */
        spin_lock_init(&lp->spinlock);
 
-       dev->open = wavelan_open;
-       dev->stop = wavelan_close;
-       dev->hard_start_xmit = wavelan_packet_xmit;
-       dev->get_stats = wavelan_get_stats;
-       dev->set_multicast_list = &wavelan_set_multicast_list;
-        dev->tx_timeout                = &wavelan_watchdog;
-        dev->watchdog_timeo    = WATCHDOG_JIFFIES;
-#ifdef SET_MAC_ADDRESS
-       dev->set_mac_address = &wavelan_set_mac_address;
-#endif                         /* SET_MAC_ADDRESS */
-
+       dev->netdev_ops = &wavelan_netdev_ops;
+       dev->watchdog_timeo = WATCHDOG_JIFFIES;
        dev->wireless_handlers = &wavelan_handler_def;
        lp->wireless_data.spy_data = &lp->spy_data;
        dev->wireless_data = &lp->wireless_data;
@@ -4284,8 +4270,7 @@ int __init init_module(void)
 
 
        /* Loop on all possible base addresses. */
-       i = -1;
-       while ((io[++i] != 0) && (i < ARRAY_SIZE(io))) {
+       for (i = 0; i < ARRAY_SIZE(io) && io[i] != 0; i++) {
                struct net_device *dev = alloc_etherdev(sizeof(net_local));
                if (!dev)
                        break;