vserver 1.9.5.x5
[linux-2.6.git] / drivers / net / wireless / wavelan_cs.c
index 5eb32a9..ec83297 100644 (file)
@@ -136,7 +136,8 @@ psa_read(struct net_device *        dev,
         u_char *       b,      /* buffer to fill */
         int            n)      /* size to read */
 {
-  u_char *     ptr = ((u_char *)dev->mem_start) + PSA_ADDR + (o << 1);
+  net_local *lp = netdev_priv(dev);
+  u_char __iomem *ptr = lp->mem + PSA_ADDR + (o << 1);
 
   while(n-- > 0)
     {
@@ -160,12 +161,13 @@ psa_write(struct net_device *     dev,
          u_char *      b,      /* Buffer in memory */
          int           n)      /* Length of buffer */
 {
-  u_char *     ptr = ((u_char *) dev->mem_start) + PSA_ADDR + (o << 1);
+  net_local *lp = netdev_priv(dev);
+  u_char __iomem *ptr = lp->mem + PSA_ADDR + (o << 1);
   int          count = 0;
-  ioaddr_t     base = dev->base_addr;
+  kio_addr_t   base = dev->base_addr;
   /* As there seem to have no flag PSA_BUSY as in the ISA model, we are
    * oblige to verify this address to know when the PSA is ready... */
-  volatile u_char *    verify = ((u_char *) dev->mem_start) + PSA_ADDR +
+  volatile u_char __iomem *verify = lp->mem + PSA_ADDR +
     (psaoff(0, psa_comp_number) << 1);
 
   /* Authorize writting to PSA */
@@ -502,7 +504,7 @@ unsigned char WAVELAN_BEACON_ADDRESS[]= {0x09,0x00,0x0e,0x20,0x03,0x00};
   
 void wv_roam_init(struct net_device *dev)
 {
-  net_local  *lp= (net_local *)dev->priv;
+  net_local  *lp= netdev_priv(dev);
 
   /* Do not remove this unless you have a good reason */
   printk(KERN_NOTICE "%s: Warning, you have enabled roaming on"
@@ -532,7 +534,7 @@ void wv_roam_init(struct net_device *dev)
 void wv_roam_cleanup(struct net_device *dev)
 {
   wavepoint_history *ptr,*old_ptr;
-  net_local *lp= (net_local *)dev->priv;
+  net_local *lp= netdev_priv(dev);
   
   printk(KERN_DEBUG "WaveLAN: Roaming Disabled on device %s\n",dev->name);
   
@@ -723,7 +725,7 @@ void wl_update_history(wavepoint_history *wavepoint, unsigned char sigqual, unsi
 /* Perform a handover to a new WavePoint */
 void wv_roam_handover(wavepoint_history *wavepoint, net_local *lp)
 {
-  ioaddr_t              base = lp->dev->base_addr;  
+  kio_addr_t           base = lp->dev->base_addr;
   mm_t                  m;
   unsigned long         flags;
 
@@ -762,7 +764,7 @@ static inline void wl_roam_gather(struct net_device *  dev,
   unsigned short nwid=ntohs(beacon->nwid);  
   unsigned short sigqual=stats[2] & MMR_SGNL_QUAL;   /* SNR of beacon */
   wavepoint_history *wavepoint=NULL;                /* WavePoint table entry */
-  net_local *lp=(net_local *)dev->priv;              /* Device info */
+  net_local *lp = netdev_priv(dev);              /* Device info */
 
 #ifdef I_NEED_THIS_FEATURE
   /* Some people don't need this, some other may need it */
@@ -836,7 +838,7 @@ wv_82593_cmd(struct net_device *    dev,
             int        cmd,
             int        result)
 {
-  ioaddr_t     base = dev->base_addr;
+  kio_addr_t   base = dev->base_addr;
   int          status;
   int          wait_completed;
   long         spin;
@@ -950,7 +952,7 @@ wv_diag(struct net_device * dev)
                  OP0_DIAGNOSE, SR0_DIAGNOSE_PASSED))
     ret = TRUE;
 
-#ifdef DEBUG_CONFIG_ERROR
+#ifdef DEBUG_CONFIG_ERRORS
   printk(KERN_INFO "wavelan_cs: i82593 Self Test failed!\n");
 #endif
   return(ret);
@@ -968,7 +970,7 @@ read_ringbuf(struct net_device *    dev,
             char *     buf,
             int        len)
 {
-  ioaddr_t     base = dev->base_addr;
+  kio_addr_t   base = dev->base_addr;
   int          ring_ptr = addr;
   int          chunk_len;
   char *       buf_ptr = buf;
@@ -1006,7 +1008,7 @@ read_ringbuf(struct net_device *  dev,
 static inline void
 wv_82593_reconfig(struct net_device *  dev)
 {
-  net_local *          lp = (net_local *)dev->priv;
+  net_local *          lp = netdev_priv(dev);
   dev_link_t *         link = lp->link;
   unsigned long                flags;
 
@@ -1134,8 +1136,8 @@ wv_psa_show(psa_t *       p)
 static void
 wv_mmc_show(struct net_device *        dev)
 {
-  ioaddr_t     base = dev->base_addr;
-  net_local *  lp = (net_local *)dev->priv;
+  kio_addr_t   base = dev->base_addr;
+  net_local *  lp = netdev_priv(dev);
   mmr_t                m;
 
   /* Basic check */
@@ -1224,7 +1226,7 @@ wv_mmc_show(struct net_device *   dev)
 static void
 wv_ru_show(struct net_device * dev)
 {
-  net_local *lp = (net_local *) dev->priv;
+  net_local *lp = netdev_priv(dev);
 
   printk(KERN_DEBUG "##### wavelan i82593 receiver status: #####\n");
   printk(KERN_DEBUG "ru: rfp %d stop %d", lp->rfp, lp->stop);
@@ -1258,9 +1260,7 @@ wv_dev_show(struct net_device *   dev)
 static void
 wv_local_show(struct net_device *      dev)
 {
-  net_local *lp;
-
-  lp = (net_local *)dev->priv;
+  net_local *lp = netdev_priv(dev);
 
   printk(KERN_DEBUG "local:");
   /*
@@ -1316,7 +1316,7 @@ wv_packet_info(u_char *           p,              /* Packet to dump */
 static inline void
 wv_init_info(struct net_device *       dev)
 {
-  ioaddr_t     base = dev->base_addr;
+  kio_addr_t   base = dev->base_addr;
   psa_t                psa;
   int          i;
 
@@ -1335,7 +1335,7 @@ wv_init_info(struct net_device *  dev)
 
 #ifdef DEBUG_BASIC_SHOW
   /* Now, let's go for the basic stuff */
-  printk(KERN_NOTICE "%s: WaveLAN: port %#x, irq %d, hw_addr",
+  printk(KERN_NOTICE "%s: WaveLAN: port %#lx, irq %d, hw_addr",
         dev->name, base, dev->irq);
   for(i = 0; i < WAVELAN_ADDR_SIZE; i++)
     printk("%s%02X", (i == 0) ? " " : ":", dev->dev_addr[i]);
@@ -1418,7 +1418,7 @@ wavelan_get_stats(struct net_device *     dev)
   printk(KERN_DEBUG "%s: <>wavelan_get_stats()\n", dev->name);
 #endif
 
-  return(&((net_local *) dev->priv)->stats);
+  return(&((net_local *)netdev_priv(dev))->stats);
 }
 
 /*------------------------------------------------------------------*/
@@ -1433,7 +1433,7 @@ 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", dev->name);
@@ -1550,7 +1550,6 @@ wavelan_set_mac_address(struct net_device *       dev,
 /*
  * Frequency setting (for hardware able of it)
  * It's a bit complicated and you don't really want to look into it...
- * (called in wavelan_ioctl)
  */
 static inline int
 wv_set_frequency(u_long                base,   /* i/o port of the card */
@@ -1826,7 +1825,7 @@ static inline void
 wl_his_gather(struct net_device *      dev,
              u_char *  stats)          /* Statistics to gather */
 {
-  net_local *  lp = (net_local *) dev->priv;
+  net_local *  lp = netdev_priv(dev);
   u_char       level = stats[0] & MMR_SIGNAL_LVL;
   int          i;
 
@@ -1840,28 +1839,15 @@ wl_his_gather(struct net_device *       dev,
 }
 #endif /* HISTOGRAM */
 
-static inline int
-wl_netdev_ethtool_ioctl(struct net_device *dev, void __user *useraddr)
+static void wl_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 {
-       u32 ethcmd;
-
-       if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
-               return -EFAULT;
-
-       switch (ethcmd) {
-       case ETHTOOL_GDRVINFO: {
-               struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
-
-               strncpy(info.driver, "wavelan_cs", sizeof(info.driver)-1);
-               if (copy_to_user(useraddr, &info, sizeof(info)))
-                       return -EFAULT;
-               return 0;
-       }
-       }
-
-       return -EOPNOTSUPP;
+       strncpy(info->driver, "wavelan_cs", sizeof(info->driver)-1);
 }
 
+static struct ethtool_ops ops = {
+       .get_drvinfo = wl_get_drvinfo
+};
+
 /*------------------------------------------------------------------*/
 /*
  * Wireless Handler : get protocol name
@@ -1884,8 +1870,8 @@ static int wavelan_set_nwid(struct net_device *dev,
                            union iwreq_data *wrqu,
                            char *extra)
 {
-       ioaddr_t base = dev->base_addr;
-       net_local *lp = (net_local *) dev->priv;        /* lp is not unused */
+       kio_addr_t base = dev->base_addr;
+       net_local *lp = netdev_priv(dev);
        psa_t psa;
        mm_t m;
        unsigned long flags;
@@ -1943,7 +1929,7 @@ static int wavelan_get_nwid(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);
        psa_t psa;
        unsigned long flags;
        int ret = 0;
@@ -1974,8 +1960,8 @@ static int wavelan_set_freq(struct net_device *dev,
                            union iwreq_data *wrqu,
                            char *extra)
 {
-       ioaddr_t base = dev->base_addr;
-       net_local *lp = (net_local *) dev->priv;        /* lp is not unused */
+       kio_addr_t base = dev->base_addr;
+       net_local *lp = netdev_priv(dev);
        unsigned long flags;
        int ret;
 
@@ -2004,8 +1990,8 @@ static int wavelan_get_freq(struct net_device *dev,
                            union iwreq_data *wrqu,
                            char *extra)
 {
-       ioaddr_t base = dev->base_addr;
-       net_local *lp = (net_local *) dev->priv;        /* lp is not unused */
+       kio_addr_t base = dev->base_addr;
+       net_local *lp = netdev_priv(dev);
        psa_t psa;
        unsigned long flags;
        int ret = 0;
@@ -2050,8 +2036,8 @@ static int wavelan_set_sens(struct net_device *dev,
                            union iwreq_data *wrqu,
                            char *extra)
 {
-       ioaddr_t base = dev->base_addr;
-       net_local *lp = (net_local *) dev->priv;        /* lp is not unused */
+       kio_addr_t base = dev->base_addr;
+       net_local *lp = netdev_priv(dev);
        psa_t psa;
        unsigned long flags;
        int ret = 0;
@@ -2086,7 +2072,7 @@ static int wavelan_get_sens(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);
        psa_t psa;
        unsigned long flags;
        int ret = 0;
@@ -2116,8 +2102,8 @@ static int wavelan_set_encode(struct net_device *dev,
                              union iwreq_data *wrqu,
                              char *extra)
 {
-       ioaddr_t base = dev->base_addr;
-       net_local *lp = (net_local *) dev->priv;        /* lp is not unused */
+       kio_addr_t base = dev->base_addr;
+       net_local *lp = netdev_priv(dev);
        unsigned long flags;
        psa_t psa;
        int ret = 0;
@@ -2186,8 +2172,8 @@ static int wavelan_get_encode(struct net_device *dev,
                              union iwreq_data *wrqu,
                              char *extra)
 {
-       ioaddr_t base = dev->base_addr;
-       net_local *lp = (net_local *) dev->priv;        /* lp is not unused */
+       kio_addr_t base = dev->base_addr;
+       net_local *lp = netdev_priv(dev);
        psa_t psa;
        unsigned long flags;
        int ret = 0;
@@ -2234,7 +2220,7 @@ static int wavelan_set_essid(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);
        unsigned long flags;
        int ret = 0;
 
@@ -2282,7 +2268,7 @@ static int wavelan_get_essid(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);
 
        /* Is the domain ID active ? */
        wrqu->data.flags = lp->filter_domains;
@@ -2347,7 +2333,7 @@ static int wavelan_set_mode(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);
        unsigned long flags;
        int ret = 0;
 
@@ -2405,8 +2391,8 @@ static int wavelan_get_range(struct net_device *dev,
                             union iwreq_data *wrqu,
                             char *extra)
 {
-       ioaddr_t base = dev->base_addr;
-       net_local *lp = (net_local *) dev->priv;        /* lp is not unused */
+       kio_addr_t base = dev->base_addr;
+       net_local *lp = netdev_priv(dev);
        struct iw_range *range = (struct iw_range *) extra;
        unsigned long flags;
        int ret = 0;
@@ -2438,6 +2424,12 @@ static int wavelan_get_range(struct net_device *dev,
        range->num_bitrates = 1;
        range->bitrate[0] = 2000000;    /* 2 Mb/s */
 
+       /* Event capability (kernel + driver) */
+       range->event_capa[0] = (IW_EVENT_CAPA_MASK(0x8B02) |
+                               IW_EVENT_CAPA_MASK(0x8B04) |
+                               IW_EVENT_CAPA_MASK(0x8B06));
+       range->event_capa[1] = IW_EVENT_CAPA_K_1;
+
        /* Disable interrupts and save flags. */
        spin_lock_irqsave(&lp->spinlock, flags);
        
@@ -2475,8 +2467,8 @@ static int wavelan_set_qthr(struct net_device *dev,
                            union iwreq_data *wrqu,
                            char *extra)
 {
-       ioaddr_t base = dev->base_addr;
-       net_local *lp = (net_local *) dev->priv;        /* lp is not unused */
+       kio_addr_t base = dev->base_addr;
+       net_local *lp = netdev_priv(dev);
        psa_t psa;
        unsigned long flags;
 
@@ -2507,7 +2499,7 @@ static int wavelan_get_qthr(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);
        psa_t psa;
        unsigned long flags;
 
@@ -2535,7 +2527,7 @@ static int wavelan_set_roam(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);
        unsigned long flags;
 
        /* Disable interrupts and save flags. */
@@ -2580,7 +2572,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);
 
        /* Check the number of intervals. */
        if (wrqu->data.length > 16) {
@@ -2623,7 +2615,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);
 
        /* Set the number of intervals. */
        wrqu->data.length = lp->his_number;
@@ -2737,48 +2729,12 @@ static const struct iw_handler_def      wavelan_handler_def =
        .num_standard   = sizeof(wavelan_handler)/sizeof(iw_handler),
        .num_private    = sizeof(wavelan_private_handler)/sizeof(iw_handler),
        .num_private_args = sizeof(wavelan_private_args)/sizeof(struct iw_priv_args),
-       .standard       = (iw_handler *) wavelan_handler,
-       .private        = (iw_handler *) wavelan_private_handler,
-       .private_args   = (struct iw_priv_args *) wavelan_private_args,
-       .spy_offset     = ((void *) (&((net_local *) NULL)->spy_data) -
-                          (void *) NULL),
+       .standard       = wavelan_handler,
+       .private        = wavelan_private_handler,
+       .private_args   = wavelan_private_args,
+       .get_wireless_stats = wavelan_get_wireless_stats,
 };
 
-/*------------------------------------------------------------------*/
-/*
- * Perform ioctl : config & info stuff
- * This is here that are treated the wireless extensions (iwconfig)
- */
-static int
-wavelan_ioctl(struct net_device *      dev,    /* Device on wich the ioctl apply */
-             struct ifreq *    rq,     /* Data passed */
-             int               cmd)    /* Ioctl number */
-{
-  int                  ret = 0;
-
-#ifdef DEBUG_IOCTL_TRACE
-  printk(KERN_DEBUG "%s: ->wavelan_ioctl(cmd=0x%X)\n", dev->name, cmd);
-#endif
-
-  /* Look what is the request */
-  switch(cmd)
-    {
-    case SIOCETHTOOL:
-      ret = wl_netdev_ethtool_ioctl(dev, rq->ifr_data);
-      break;
-
-      /* ------------------- OTHER IOCTL ------------------- */
-
-    default:
-      ret = -EOPNOTSUPP;
-    }
-
-#ifdef DEBUG_IOCTL_TRACE
-  printk(KERN_DEBUG "%s: <-wavelan_ioctl()\n", dev->name);
-#endif
-  return ret;
-}
-
 /*------------------------------------------------------------------*/
 /*
  * Get wireless statistics
@@ -2787,8 +2743,8 @@ wavelan_ioctl(struct net_device * dev,    /* Device on wich the ioctl apply */
 static iw_stats *
 wavelan_get_wireless_stats(struct net_device * dev)
 {
-  ioaddr_t             base = dev->base_addr;
-  net_local *          lp = (net_local *) dev->priv;
+  kio_addr_t           base = dev->base_addr;
+  net_local *          lp = netdev_priv(dev);
   mmr_t                        m;
   iw_stats *           wstats;
   unsigned long                flags;
@@ -2851,7 +2807,7 @@ wv_start_of_frame(struct net_device *     dev,
                  int           rfp,    /* end of frame */
                  int           wrap)   /* start of buffer */
 {
-  ioaddr_t     base = dev->base_addr;
+  kio_addr_t   base = dev->base_addr;
   int          rp;
   int          len;
 
@@ -2913,7 +2869,7 @@ wv_packet_read(struct net_device *                dev,
               int              fd_p,
               int              sksize)
 {
-  net_local *          lp = (net_local *) dev->priv;
+  net_local *          lp = netdev_priv(dev);
   struct sk_buff *     skb;
 
 #ifdef DEBUG_RX_TRACE
@@ -3014,8 +2970,8 @@ wv_packet_read(struct net_device *                dev,
 static inline void
 wv_packet_rcv(struct net_device *      dev)
 {
-  ioaddr_t     base = dev->base_addr;
-  net_local *  lp = (net_local *) dev->priv;
+  kio_addr_t   base = dev->base_addr;
+  net_local *  lp = netdev_priv(dev);
   int          newrfp;
   int          rp;
   int          len;
@@ -3150,8 +3106,8 @@ wv_packet_write(struct net_device *       dev,
                void *          buf,
                short           length)
 {
-  net_local *          lp = (net_local *) dev->priv;
-  ioaddr_t             base = dev->base_addr;
+  net_local *          lp = netdev_priv(dev);
+  kio_addr_t           base = dev->base_addr;
   unsigned long                flags;
   int                  clen = length;
   register u_short     xmtdata_base = TX_BASE;
@@ -3211,7 +3167,7 @@ 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;
 
 #ifdef DEBUG_TX_TRACE
@@ -3275,7 +3231,7 @@ wavelan_packet_xmit(struct sk_buff *      skb,
 static inline int
 wv_mmc_init(struct net_device *        dev)
 {
-  ioaddr_t     base = dev->base_addr;
+  kio_addr_t   base = dev->base_addr;
   psa_t                psa;
   mmw_t                m;
   int          configured;
@@ -3469,8 +3425,8 @@ wv_mmc_init(struct net_device *   dev)
 static int
 wv_ru_stop(struct net_device * dev)
 {
-  ioaddr_t     base = dev->base_addr;
-  net_local *  lp = (net_local *) dev->priv;
+  kio_addr_t   base = dev->base_addr;
+  net_local *  lp = netdev_priv(dev);
   unsigned long        flags;
   int          status;
   int          spin;
@@ -3509,7 +3465,7 @@ wv_ru_stop(struct net_device *    dev)
   /* If there was a problem */
   if(spin <= 0)
     {
-#ifdef DEBUG_CONFIG_ERROR
+#ifdef DEBUG_CONFIG_ERRORS
       printk(KERN_INFO "%s: wv_ru_stop(): The chip doesn't want to stop...\n",
             dev->name);
 #endif
@@ -3532,8 +3488,8 @@ wv_ru_stop(struct net_device *    dev)
 static int
 wv_ru_start(struct net_device *        dev)
 {
-  ioaddr_t     base = dev->base_addr;
-  net_local *  lp = (net_local *) dev->priv;
+  kio_addr_t   base = dev->base_addr;
+  net_local *  lp = netdev_priv(dev);
   unsigned long        flags;
 
 #ifdef DEBUG_CONFIG_TRACE
@@ -3620,8 +3576,8 @@ wv_ru_start(struct net_device *   dev)
 static int
 wv_82593_config(struct net_device *    dev)
 {
-  ioaddr_t                     base = dev->base_addr;
-  net_local *                  lp = (net_local *) dev->priv;
+  kio_addr_t                   base = dev->base_addr;
+  net_local *                  lp = netdev_priv(dev);
   struct i82593_conf_block     cfblk;
   int                          ret = TRUE;
 
@@ -3796,7 +3752,7 @@ wv_pcmcia_reset(struct net_device *       dev)
 {
   int          i;
   conf_reg_t   reg = { 0, CS_READ, CISREG_COR, 0 };
-  dev_link_t * link = ((net_local *) dev->priv)->link;
+  dev_link_t * link = ((net_local *)netdev_priv(dev))->link;
 
 #ifdef DEBUG_CONFIG_TRACE
   printk(KERN_DEBUG "%s: ->wv_pcmcia_reset()\n", dev->name);
@@ -3856,8 +3812,8 @@ wv_pcmcia_reset(struct net_device *       dev)
 static int
 wv_hw_config(struct net_device *       dev)
 {
-  net_local *          lp = (net_local *) dev->priv;
-  ioaddr_t             base = dev->base_addr;
+  net_local *          lp = netdev_priv(dev);
+  kio_addr_t           base = dev->base_addr;
   unsigned long                flags;
   int                  ret = FALSE;
 
@@ -3963,7 +3919,7 @@ wv_hw_config(struct net_device *  dev)
 static inline void
 wv_hw_reset(struct net_device *        dev)
 {
-  net_local *  lp = (net_local *) dev->priv;
+  net_local *  lp = netdev_priv(dev);
 
 #ifdef DEBUG_CONFIG_TRACE
   printk(KERN_DEBUG "%s: ->wv_hw_reset()\n", dev->name);
@@ -3994,17 +3950,16 @@ wv_hw_reset(struct net_device * dev)
 static inline int
 wv_pcmcia_config(dev_link_t *  link)
 {
-  client_handle_t      handle;
+  client_handle_t      handle = link->handle;
   tuple_t              tuple;
   cisparse_t           parse;
-  struct net_device *  dev;
+  struct net_device *  dev = (struct net_device *) link->priv;
   int                  i;
   u_char               buf[64];
   win_req_t            req;
   memreq_t             mem;
+  net_local *          lp = netdev_priv(dev);
 
-  handle = link->handle;
-  dev = (struct net_device *) link->priv;
 
 #ifdef DEBUG_CONFIG_TRACE
   printk(KERN_DEBUG "->wv_pcmcia_config(0x%p)\n", link);
@@ -4091,7 +4046,8 @@ wv_pcmcia_config(dev_link_t *     link)
          break;
        }
 
-      dev->mem_start = (u_long)ioremap(req.Base, req.Size);
+      lp->mem = ioremap(req.Base, req.Size);
+      dev->mem_start = (u_long)lp->mem;
       dev->mem_end = dev->mem_start + req.Size;
 
       mem.CardOffset = 0; mem.Page = 0;
@@ -4108,10 +4064,11 @@ wv_pcmcia_config(dev_link_t *   link)
       netif_start_queue(dev);
 
 #ifdef DEBUG_CONFIG_INFO
-      printk(KERN_DEBUG "wv_pcmcia_config: MEMSTART 0x%x IRQ %d IOPORT 0x%x\n",
-            (u_int) dev->mem_start, dev->irq, (u_int) dev->base_addr);
+      printk(KERN_DEBUG "wv_pcmcia_config: MEMSTART %p IRQ %d IOPORT 0x%x\n",
+            lp->mem, dev->irq, (u_int) dev->base_addr);
 #endif
 
+      SET_NETDEV_DEV(dev, &handle_to_dev(handle));
       i = register_netdev(dev);
       if(i != 0)
        {
@@ -4131,8 +4088,8 @@ wv_pcmcia_config(dev_link_t *     link)
       return FALSE;
     }
 
-  strcpy(((net_local *) dev->priv)->node.dev_name, dev->name);
-  link->dev = &((net_local *) dev->priv)->node;
+  strcpy(((net_local *) netdev_priv(dev))->node.dev_name, dev->name);
+  link->dev = &((net_local *) netdev_priv(dev))->node;
 
 #ifdef DEBUG_CONFIG_TRACE
   printk(KERN_DEBUG "<-wv_pcmcia_config()\n");
@@ -4150,13 +4107,14 @@ static void
 wv_pcmcia_release(dev_link_t *link)
 {
   struct net_device *  dev = (struct net_device *) link->priv;
+  net_local *          lp = netdev_priv(dev);
 
 #ifdef DEBUG_CONFIG_TRACE
   printk(KERN_DEBUG "%s: -> wv_pcmcia_release(0x%p)\n", dev->name, link);
 #endif
 
   /* Don't bother checking to see if these succeed or not */
-  iounmap((u_char *)dev->mem_start);
+  iounmap(lp->mem);
   pcmcia_release_window(link->win);
   pcmcia_release_configuration(link->handle);
   pcmcia_release_io(link->handle, &link->io);
@@ -4186,7 +4144,7 @@ wavelan_interrupt(int             irq,
 {
   struct net_device *  dev;
   net_local *  lp;
-  ioaddr_t     base;
+  kio_addr_t   base;
   int          status0;
   u_int                tx_status;
 
@@ -4203,7 +4161,7 @@ wavelan_interrupt(int             irq,
   printk(KERN_DEBUG "%s: ->wavelan_interrupt()\n", dev->name);
 #endif
 
-  lp = (net_local *) dev->priv;
+  lp = netdev_priv(dev);
   base = dev->base_addr;
 
 #ifdef DEBUG_INTERRUPT_INFO
@@ -4453,8 +4411,8 @@ wavelan_interrupt(int             irq,
 static void
 wavelan_watchdog(struct net_device *   dev)
 {
-  net_local *          lp = (net_local *) dev->priv;
-  ioaddr_t             base = dev->base_addr;
+  net_local *          lp = netdev_priv(dev);
+  kio_addr_t           base = dev->base_addr;
   unsigned long                flags;
   int                  aborted = FALSE;
 
@@ -4528,9 +4486,9 @@ wavelan_watchdog(struct net_device *      dev)
 static int
 wavelan_open(struct net_device *       dev)
 {
-  dev_link_t * link = ((net_local *) dev->priv)->link;
-  net_local *  lp = (net_local *)dev->priv;
-  ioaddr_t     base = dev->base_addr;
+  net_local *  lp = netdev_priv(dev);
+  dev_link_t * link = lp->link;
+  kio_addr_t   base = dev->base_addr;
 
 #ifdef DEBUG_CALLBACK_TRACE
   printk(KERN_DEBUG "%s: ->wavelan_open(dev=0x%x)\n", dev->name,
@@ -4583,8 +4541,8 @@ wavelan_open(struct net_device *  dev)
 static int
 wavelan_close(struct net_device *      dev)
 {
-  dev_link_t * link = ((net_local *) dev->priv)->link;
-  ioaddr_t     base = dev->base_addr;
+  dev_link_t * link = ((net_local *)netdev_priv(dev))->link;
+  kio_addr_t   base = dev->base_addr;
 
 #ifdef DEBUG_CALLBACK_TRACE
   printk(KERN_DEBUG "%s: ->wavelan_close(dev=0x%x)\n", dev->name,
@@ -4643,7 +4601,7 @@ wavelan_attach(void)
   dev_link_t * link;           /* Info for cardmgr */
   struct net_device *  dev;            /* Interface generic data */
   net_local *  lp;             /* Interface specific data */
-  int          i, ret;
+  int          ret;
 
 #ifdef DEBUG_CALLBACK_TRACE
   printk(KERN_DEBUG "-> wavelan_attach()\n");
@@ -4661,12 +4619,7 @@ wavelan_attach(void)
 
   /* Interrupt setup */
   link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT;
-  link->irq.IRQInfo1 = IRQ_INFO2_VALID | IRQ_LEVEL_ID;
-  if (irq_list[0] == -1)
-    link->irq.IRQInfo2 = irq_mask;
-  else
-    for (i = 0; i < 4; i++)
-      link->irq.IRQInfo2 |= 1 << irq_list[i];
+  link->irq.IRQInfo1 = IRQ_LEVEL_ID;
   link->irq.Handler = wavelan_interrupt;
 
   /* General socket configuration */
@@ -4686,7 +4639,7 @@ wavelan_attach(void)
   }
   link->priv = link->irq.Instance = dev;
 
-  lp = dev->priv;
+  lp = netdev_priv(dev);
 
   /* Init specific data */
   lp->configured = 0;
@@ -4718,11 +4671,12 @@ wavelan_attach(void)
   /* Set the watchdog timer */
   dev->tx_timeout      = &wavelan_watchdog;
   dev->watchdog_timeo  = WATCHDOG_JIFFIES;
+  SET_ETHTOOL_OPS(dev, &ops);
 
 #ifdef WIRELESS_EXT    /* If wireless extension exist in the kernel */
-  dev->wireless_handlers = (struct iw_handler_def *)&wavelan_handler_def;
-  dev->do_ioctl = wavelan_ioctl;       /* old wireless extensions */
-  dev->get_wireless_stats = wavelan_get_wireless_stats;
+  dev->wireless_handlers = &wavelan_handler_def;
+  lp->wireless_data.spy_data = &lp->spy_data;
+  dev->wireless_data = &lp->wireless_data;
 #endif
 
   /* Other specific data */
@@ -4730,7 +4684,6 @@ wavelan_attach(void)
 
   /* Register with Card Services */
   client_reg.dev_info = &dev_info;
-  client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE;
   client_reg.EventMask = 
     CS_EVENT_REGISTRATION_COMPLETE |
     CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL |
@@ -4820,8 +4773,8 @@ wavelan_detach(dev_link_t *       link)
       if (link->dev)
        unregister_netdev(dev);
       link->dev = NULL;
-      ((net_local *) dev->priv)->link = NULL;
-      ((net_local *) dev->priv)->dev = NULL;
+      ((net_local *)netdev_priv(dev))->link = NULL;
+      ((net_local *)netdev_priv(dev))->dev = NULL;
       free_netdev(dev);
     }
   kfree(link);