netdevice: safe convert to netdev_priv() #part-4
[safe/jmp/linux-2.6] / drivers / net / wireless / wavelan.c
index 49ae970..8326793 100644 (file)
@@ -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;
@@ -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() */
@@ -859,8 +859,6 @@ static void wv_82586_reconfig(struct net_device * dev)
  */
 static void wv_psa_show(psa_t * p)
 {
-       DECLARE_MAC_BUF(mac);
-
        printk(KERN_DEBUG "##### WaveLAN PSA contents: #####\n");
        printk(KERN_DEBUG "psa_io_base_addr_1: 0x%02X %02X %02X %02X\n",
               p->psa_io_base_addr_1,
@@ -872,13 +870,10 @@ static void wv_psa_show(psa_t * p)
        printk(KERN_DEBUG "psa_holi_params: 0x%02x, ", p->psa_holi_params);
        printk("psa_int_req_no: %d\n", p->psa_int_req_no);
 #ifdef DEBUG_SHOW_UNUSED
-       printk(KERN_DEBUG "psa_unused0[]: %s\n",
-              print_mac(mac, p->psa_unused0));
+       printk(KERN_DEBUG "psa_unused0[]: %pM\n", p->psa_unused0);
 #endif                         /* DEBUG_SHOW_UNUSED */
-       printk(KERN_DEBUG "psa_univ_mac_addr[]: %s\n",
-              print_mac(mac, p->psa_univ_mac_addr));
-       printk(KERN_DEBUG "psa_local_mac_addr[]: %s\n",
-              print_mac(mac, p->psa_local_mac_addr));
+       printk(KERN_DEBUG "psa_univ_mac_addr[]: %pM\n", p->psa_univ_mac_addr);
+       printk(KERN_DEBUG "psa_local_mac_addr[]: %pM\n", p->psa_local_mac_addr);
        printk(KERN_DEBUG "psa_univ_local_sel: %d, ",
               p->psa_univ_local_sel);
        printk("psa_comp_number: %d, ", p->psa_comp_number);
@@ -927,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 */
@@ -1107,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:");
@@ -1153,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;
 
@@ -1195,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);
@@ -1220,14 +1213,13 @@ static inline void wv_packet_info(u8 * p,       /* Packet to dump */
 {                              /* Name of the function */
        int i;
        int maxi;
-       DECLARE_MAC_BUF(mac);
 
        printk(KERN_DEBUG
-              "%s: %s(): dest %s, length %d\n",
-              msg1, msg2, print_mac(mac, p), length);
+              "%s: %s(): dest %pM, length %d\n",
+              msg1, msg2, p, length);
        printk(KERN_DEBUG
-              "%s: %s(): src %s, type 0x%02X%02X\n",
-              msg1, msg2, print_mac(mac, &p[6]), p[12], p[13]);
+              "%s: %s(): src %pM, type 0x%02X%02X\n",
+              msg1, msg2, &p[6], p[12], p[13]);
 
 #ifdef DEBUG_PACKET_DUMP
 
@@ -1256,11 +1248,8 @@ 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;
-#ifdef DEBUG_BASIC_SHOW
-       DECLARE_MAC_BUF(mac);
-#endif
 
        /* Read the parameter storage area */
        psa_read(ioaddr, lp->hacr, 0, (unsigned char *) &psa, sizeof(psa));
@@ -1277,8 +1266,8 @@ static void wv_init_info(struct net_device * dev)
 
 #ifdef DEBUG_BASIC_SHOW
        /* Now, let's go for the basic stuff. */
-       printk(KERN_NOTICE "%s: WaveLAN at %#x, %s, IRQ %d",
-              dev->name, ioaddr, print_mac(mac, dev->dev_addr), dev->irq);
+       printk(KERN_NOTICE "%s: WaveLAN at %#x, %pM, IRQ %d",
+              dev->name, ioaddr, dev->dev_addr, dev->irq);
 
        /* Print current network ID. */
        if (psa.psa_nwid_select)
@@ -1369,7 +1358,7 @@ static en_stats *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;
 }
 
 /*------------------------------------------------------------------*/
@@ -1382,7 +1371,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",
@@ -1409,9 +1398,6 @@ static void wavelan_set_multicast_list(struct net_device * dev)
                        lp->mc_count = 0;
 
                        wv_82586_reconfig(dev);
-
-                       /* Tell the kernel that we are doing a really bad job. */
-                       dev->flags |= IFF_PROMISC;
                }
        } else
                /* Are there multicast addresses to send? */
@@ -1719,7 +1705,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;
 
@@ -1756,7 +1742,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;
@@ -1815,7 +1801,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;
@@ -1847,7 +1833,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;
 
@@ -1877,7 +1863,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;
@@ -1923,7 +1909,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;
@@ -1959,7 +1945,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;
@@ -1990,7 +1976,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;
@@ -2060,7 +2046,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;
@@ -2107,7 +2093,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;
@@ -2182,7 +2168,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;
 
@@ -2214,7 +2200,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;
 
@@ -2242,7 +2228,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) {
@@ -2285,7 +2271,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;
@@ -2389,7 +2375,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;
@@ -2464,7 +2450,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;
 
@@ -2540,7 +2526,6 @@ 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;
 
@@ -2559,7 +2544,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;
@@ -2741,7 +2726,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;
@@ -2872,7 +2857,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];
 
@@ -2940,7 +2925,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;
@@ -3111,7 +3096,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;
@@ -3203,7 +3188,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;
@@ -3304,7 +3289,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 */
@@ -3436,7 +3421,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;
@@ -3568,15 +3553,11 @@ static void wv_82586_config(struct net_device * dev)
                              WAVELAN_ADDR_SIZE >> 1);
 
 #ifdef DEBUG_CONFIG_INFO
- {
-               DECLARE_MAC_BUF(mac);
                printk(KERN_DEBUG
                       "%s: wv_82586_config(): set %d multicast addresses:\n",
                       dev->name, lp->mc_count);
                for (dmi = dev->mc_list; dmi; dmi = dmi->next)
-                       printk(KERN_DEBUG " %s\n",
-                              print_mac(mac, dmi->dmi_addr));
- }
+                       printk(KERN_DEBUG " %pM\n", dmi->dmi_addr);
 #endif
        }
 
@@ -3616,7 +3597,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;
 
@@ -3653,7 +3634,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
@@ -3754,7 +3735,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
@@ -3897,7 +3878,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;
@@ -3977,7 +3958,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
@@ -4032,7 +4013,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
@@ -4131,8 +4112,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;
@@ -4390,7 +4371,7 @@ MODULE_LICENSE("GPL");
  *
  * Thanks go also to:
  *     James Ashton (jaa101@syseng.anu.edu.au),
- *     Alan Cox (alan@redhat.com),
+ *     Alan Cox (alan@lxorguk.ukuu.org.uk),
  *     Allan Creighton (allanc@cs.usyd.edu.au),
  *     Matthew Geier (matthew@cs.usyd.edu.au),
  *     Remo di Giovanni (remo@cs.usyd.edu.au),