mac80211: rename files
[safe/jmp/linux-2.6] / drivers / net / wireless / wavelan.c
index 1cf090d..03384a4 100644 (file)
@@ -49,27 +49,6 @@ static int __init wv_psa_to_irq(u8 irqval)
        return -1;
 }
 
-#ifdef STRUCT_CHECK
-/*------------------------------------------------------------------*/
-/*
- * Sanity routine to verify the sizes of the various WaveLAN interface
- * structures.
- */
-static char *wv_struct_check(void)
-{
-#define        SC(t,s,n)       if (sizeof(t) != s) return(n);
-
-       SC(psa_t, PSA_SIZE, "psa_t");
-       SC(mmw_t, MMW_SIZE, "mmw_t");
-       SC(mmr_t, MMR_SIZE, "mmr_t");
-       SC(ha_t, HA_SIZE, "ha_t");
-
-#undef SC
-
-       return ((char *) NULL);
-}                              /* wv_struct_check */
-#endif                         /* STRUCT_CHECK */
-
 /********************* HOST ADAPTER SUBROUTINES *********************/
 /*
  * Useful subroutines to manage the WaveLAN ISA interface
@@ -880,6 +859,8 @@ 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,
@@ -891,22 +872,13 @@ 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[]: %02X:%02X:%02X:%02X:%02X:%02X:%02X\n",
-              p->psa_unused0[0], p->psa_unused0[1], p->psa_unused0[2],
-              p->psa_unused0[3], p->psa_unused0[4], p->psa_unused0[5],
-              p->psa_unused0[6]);
+       printk(KERN_DEBUG "psa_unused0[]: %s\n",
+              print_mac(mac, p->psa_unused0));
 #endif                         /* DEBUG_SHOW_UNUSED */
-       printk(KERN_DEBUG
-              "psa_univ_mac_addr[]: %02x:%02x:%02x:%02x:%02x:%02x\n",
-              p->psa_univ_mac_addr[0], p->psa_univ_mac_addr[1],
-              p->psa_univ_mac_addr[2], p->psa_univ_mac_addr[3],
-              p->psa_univ_mac_addr[4], p->psa_univ_mac_addr[5]);
-       printk(KERN_DEBUG
-              "psa_local_mac_addr[]: %02x:%02x:%02x:%02x:%02x:%02x\n",
-              p->psa_local_mac_addr[0], p->psa_local_mac_addr[1],
-              p->psa_local_mac_addr[2], p->psa_local_mac_addr[3],
-              p->psa_local_mac_addr[4], p->psa_local_mac_addr[5]);
+       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_local_sel: %d, ",
               p->psa_univ_local_sel);
        printk("psa_comp_number: %d, ", p->psa_comp_number);
@@ -1248,14 +1220,14 @@ 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 %02X:%02X:%02X:%02X:%02X:%02X, length %d\n",
-              msg1, msg2, p[0], p[1], p[2], p[3], p[4], p[5], length);
+              "%s: %s(): dest %s, length %d\n",
+              msg1, msg2, print_mac(mac, p), length);
        printk(KERN_DEBUG
-              "%s: %s(): src %02X:%02X:%02X:%02X:%02X:%02X, type 0x%02X%02X\n",
-              msg1, msg2, p[6], p[7], p[8], p[9], p[10], p[11], p[12],
-              p[13]);
+              "%s: %s(): src %s, type 0x%02X%02X\n",
+              msg1, msg2, print_mac(mac, &p[6]), p[12], p[13]);
 
 #ifdef DEBUG_PACKET_DUMP
 
@@ -1286,7 +1258,9 @@ static void wv_init_info(struct net_device * dev)
        short ioaddr = dev->base_addr;
        net_local *lp = (net_local *) dev->priv;
        psa_t psa;
-       int i;
+#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));
@@ -1303,10 +1277,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,", dev->name, ioaddr);
-       for (i = 0; i < WAVELAN_ADDR_SIZE; i++)
-               printk("%s%02X", (i == 0) ? " " : ":", dev->dev_addr[i]);
-       printk(", IRQ %d", dev->irq);
+       printk(KERN_NOTICE "%s: WaveLAN at %#x, %s, IRQ %d",
+              dev->name, ioaddr, print_mac(mac, dev->dev_addr), dev->irq);
 
        /* Print current network ID. */
        if (psa.psa_nwid_select)
@@ -2400,9 +2372,9 @@ static const struct iw_priv_args wavelan_private_args[] = {
 
 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),
+       .num_standard   = ARRAY_SIZE(wavelan_handler),
+       .num_private    = ARRAY_SIZE(wavelan_private_handler),
+       .num_private_args = ARRAY_SIZE(wavelan_private_args),
        .standard       = wavelan_handler,
        .private        = wavelan_private_handler,
        .private_args   = wavelan_private_args,
@@ -3596,15 +3568,15 @@ 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
-                              " %02x:%02x:%02x:%02x:%02x:%02x\n",
-                              dmi->dmi_addr[0], dmi->dmi_addr[1],
-                              dmi->dmi_addr[2], dmi->dmi_addr[3],
-                              dmi->dmi_addr[4], dmi->dmi_addr[5]);
+                       printk(KERN_DEBUG " %s\n",
+                              print_mac(mac, dmi->dmi_addr));
+ }
 #endif
        }
 
@@ -3747,7 +3719,7 @@ static int wv_check_ioaddr(unsigned long ioaddr, u8 * mac)
         * non-NCR/AT&T/Lucent ISA card.  See wavelan.p.h for detail on
         * how to configure your card.
         */
-       for (i = 0; i < (sizeof(MAC_ADDRESSES) / sizeof(char) / 3); i++)
+       for (i = 0; i < ARRAY_SIZE(MAC_ADDRESSES); i++)
                if ((mac[0] == MAC_ADDRESSES[i][0]) &&
                    (mac[1] == MAC_ADDRESSES[i][1]) &&
                    (mac[2] == MAC_ADDRESSES[i][2]))
@@ -4177,7 +4149,6 @@ static int __init wavelan_config(struct net_device *dev, unsigned short ioaddr)
        /* Init spinlock */
        spin_lock_init(&lp->spinlock);
 
-       SET_MODULE_OWNER(dev);
        dev->open = wavelan_open;
        dev->stop = wavelan_close;
        dev->hard_start_xmit = wavelan_packet_xmit;
@@ -4223,14 +4194,11 @@ struct net_device * __init wavelan_probe(int unit)
        int i;
        int r = 0;
 
-#ifdef STRUCT_CHECK
-       if (wv_struct_check() != (char *) NULL) {
-               printk(KERN_WARNING
-                      "%s: wavelan_probe(): structure/compiler botch: \"%s\"\n",
-                      dev->name, wv_struct_check());
-               return -ENODEV;
-       }
-#endif                         /* STRUCT_CHECK */
+       /* compile-time check the sizes of structures */
+       BUILD_BUG_ON(sizeof(psa_t) != PSA_SIZE);
+       BUILD_BUG_ON(sizeof(mmw_t) != MMW_SIZE);
+       BUILD_BUG_ON(sizeof(mmr_t) != MMR_SIZE);
+       BUILD_BUG_ON(sizeof(ha_t) != HA_SIZE);
 
        dev = alloc_etherdev(sizeof(net_local));
        if (!dev)