Ath5k: unify resets
[safe/jmp/linux-2.6] / drivers / net / wireless / airo.c
index e30f8b7..b5cd850 100644 (file)
@@ -85,10 +85,10 @@ static struct pci_driver airo_driver = {
 
 /* Include Wireless Extension definition and check version - Jean II */
 #include <linux/wireless.h>
-#define WIRELESS_SPY           // enable iwspy support
-#include <net/iw_handler.h>    // New driver API
+#define WIRELESS_SPY           /* enable iwspy support */
+#include <net/iw_handler.h>    /* New driver API */
 
-#define CISCO_EXT              // enable Cisco extensions
+#define CISCO_EXT              /* enable Cisco extensions */
 #ifdef CISCO_EXT
 #include <linux/delay.h>
 #endif
@@ -281,7 +281,7 @@ MODULE_PARM_DESC(proc_perm, "The permission bits of the files in /proc");
 /* This is a kind of sloppy hack to get this information to OUT4500 and
    IN4500.  I would be extremely interested in the situation where this
    doesn't work though!!! */
-static int do8bitIO = 0;
+static int do8bitIO /* = 0 */;
 
 /* Return codes */
 #define SUCCESS 0
@@ -398,8 +398,8 @@ static int do8bitIO = 0;
 #define MAXTXQ 64
 
 /* BAP selectors */
-#define BAP0 0 // Used for receiving packets
-#define BAP1 2 // Used for xmiting packets and working with RIDS
+#define BAP0 0 /* Used for receiving packets */
+#define BAP1 2 /* Used for xmiting packets and working with RIDS */
 
 /* Flags */
 #define COMMAND_BUSY 0x8000
@@ -5522,11 +5522,13 @@ static int airo_pci_suspend(struct pci_dev *pdev, pm_message_t state)
        Cmd cmd;
        Resp rsp;
 
-       if ((ai->APList == NULL) &&
-               (ai->APList = kmalloc(sizeof(APListRid), GFP_KERNEL)) == NULL)
+       if (!ai->APList)
+               ai->APList = kmalloc(sizeof(APListRid), GFP_KERNEL);
+       if (!ai->APList)
                return -ENOMEM;
-       if ((ai->SSID == NULL) &&
-               (ai->SSID = kmalloc(sizeof(SsidRid), GFP_KERNEL)) == NULL)
+       if (!ai->SSID)
+               ai->SSID = kmalloc(sizeof(SsidRid), GFP_KERNEL);
+       if (!ai->SSID)
                return -ENOMEM;
        readAPListRid(ai, ai->APList);
        readSsidRid(ai, ai->SSID);
@@ -5537,7 +5539,7 @@ static int airo_pci_suspend(struct pci_dev *pdev, pm_message_t state)
        disable_MAC(ai, 0);
        netif_device_detach(dev);
        ai->power = state;
-       cmd.cmd=HOSTSLEEP;
+       cmd.cmd = HOSTSLEEP;
        issuecommand(ai, &cmd, &rsp);
 
        pci_enable_wake(pdev, pci_choose_state(pdev, state), 1);
@@ -5567,7 +5569,7 @@ static int airo_pci_resume(struct pci_dev *pdev)
                msleep(100);
        }
 
-       set_bit (FLAG_COMMIT, &ai->flags);
+       set_bit(FLAG_COMMIT, &ai->flags);
        disable_MAC(ai, 0);
         msleep(200);
        if (ai->SSID) {
@@ -5594,9 +5596,6 @@ static int airo_pci_resume(struct pci_dev *pdev)
 static int __init airo_init_module( void )
 {
        int i;
-#if 0
-       int have_isa_dev = 0;
-#endif
 
        airo_entry = create_proc_entry("driver/aironet",
                                       S_IFDIR | airo_perm,
@@ -5607,15 +5606,11 @@ static int __init airo_init_module( void )
                airo_entry->gid = proc_gid;
        }
 
-       for( i = 0; i < 4 && io[i] && irq[i]; i++ ) {
+       for (i = 0; i < 4 && io[i] && irq[i]; i++) {
                airo_print_info("", "Trying to configure ISA adapter at irq=%d "
                        "io=0x%x", irq[i], io[i] );
                if (init_airo_card( irq[i], io[i], 0, NULL ))
-#if 0
-                       have_isa_dev = 1;
-#else
                        /* do nothing */ ;
-#endif
        }
 
 #ifdef CONFIG_PCI
@@ -5661,7 +5656,7 @@ static void __exit airo_cleanup_module( void )
 
 static u8 airo_rssi_to_dbm (tdsRssiEntry *rssi_rid, u8 rssi)
 {
-       if( !rssi_rid )
+       if (!rssi_rid)
                return 0;
 
        return (0x100 - rssi_rid[rssi].rssidBm);
@@ -5671,10 +5666,10 @@ static u8 airo_dbm_to_pct (tdsRssiEntry *rssi_rid, u8 dbm)
 {
        int i;
 
-       if( !rssi_rid )
+       if (!rssi_rid)
                return 0;
 
-       for( i = 0; i < 256; i++ )
+       for (i = 0; i < 256; i++)
                if (rssi_rid[i].rssidBm == dbm)
                        return rssi_rid[i].rssipct;
 
@@ -7156,6 +7151,7 @@ out:
  * format that the Wireless Tools will understand - Jean II
  */
 static inline char *airo_translate_scan(struct net_device *dev,
+                                       struct iw_request_info *info,
                                        char *current_ev,
                                        char *end_buf,
                                        BSSListRid *bss)
@@ -7172,7 +7168,8 @@ static inline char *airo_translate_scan(struct net_device *dev,
        iwe.cmd = SIOCGIWAP;
        iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
        memcpy(iwe.u.ap_addr.sa_data, bss->bssid, ETH_ALEN);
-       current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_ADDR_LEN);
+       current_ev = iwe_stream_add_event(info, current_ev, end_buf,
+                                         &iwe, IW_EV_ADDR_LEN);
 
        /* Other entries will be displayed in the order we give them */
 
@@ -7182,7 +7179,8 @@ static inline char *airo_translate_scan(struct net_device *dev,
                iwe.u.data.length = 32;
        iwe.cmd = SIOCGIWESSID;
        iwe.u.data.flags = 1;
-       current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, bss->ssid);
+       current_ev = iwe_stream_add_point(info, current_ev, end_buf,
+                                         &iwe, bss->ssid);
 
        /* Add mode */
        iwe.cmd = SIOCGIWMODE;
@@ -7192,7 +7190,8 @@ static inline char *airo_translate_scan(struct net_device *dev,
                        iwe.u.mode = IW_MODE_MASTER;
                else
                        iwe.u.mode = IW_MODE_ADHOC;
-               current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_UINT_LEN);
+               current_ev = iwe_stream_add_event(info, current_ev, end_buf,
+                                                 &iwe, IW_EV_UINT_LEN);
        }
 
        /* Add frequency */
@@ -7203,7 +7202,8 @@ static inline char *airo_translate_scan(struct net_device *dev,
         */
        iwe.u.freq.m = frequency_list[iwe.u.freq.m - 1] * 100000;
        iwe.u.freq.e = 1;
-       current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_FREQ_LEN);
+       current_ev = iwe_stream_add_event(info, current_ev, end_buf,
+                                         &iwe, IW_EV_FREQ_LEN);
 
        dBm = le16_to_cpu(bss->dBm);
 
@@ -7223,7 +7223,8 @@ static inline char *airo_translate_scan(struct net_device *dev,
                                | IW_QUAL_DBM;
        }
        iwe.u.qual.noise = ai->wstats.qual.noise;
-       current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_QUAL_LEN);
+       current_ev = iwe_stream_add_event(info, current_ev, end_buf,
+                                         &iwe, IW_EV_QUAL_LEN);
 
        /* Add encryption capability */
        iwe.cmd = SIOCGIWENCODE;
@@ -7232,11 +7233,12 @@ static inline char *airo_translate_scan(struct net_device *dev,
        else
                iwe.u.data.flags = IW_ENCODE_DISABLED;
        iwe.u.data.length = 0;
-       current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, bss->ssid);
+       current_ev = iwe_stream_add_point(info, current_ev, end_buf,
+                                         &iwe, bss->ssid);
 
        /* Rate : stuffing multiple values in a single event require a bit
         * more of magic - Jean II */
-       current_val = current_ev + IW_EV_LCP_LEN;
+       current_val = current_ev + iwe_stream_lcp_len(info);
 
        iwe.cmd = SIOCGIWRATE;
        /* Those two flags are ignored... */
@@ -7249,10 +7251,12 @@ static inline char *airo_translate_scan(struct net_device *dev,
                /* Bit rate given in 500 kb/s units (+ 0x80) */
                iwe.u.bitrate.value = ((bss->rates[i] & 0x7f) * 500000);
                /* Add new value to event */
-               current_val = iwe_stream_add_value(current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN);
+               current_val = iwe_stream_add_value(info, current_ev,
+                                                  current_val, end_buf,
+                                                  &iwe, IW_EV_PARAM_LEN);
        }
        /* Check if we added any event */
-       if((current_val - current_ev) > IW_EV_LCP_LEN)
+       if ((current_val - current_ev) > iwe_stream_lcp_len(info))
                current_ev = current_val;
 
        /* Beacon interval */
@@ -7261,7 +7265,8 @@ static inline char *airo_translate_scan(struct net_device *dev,
                iwe.cmd = IWEVCUSTOM;
                sprintf(buf, "bcn_int=%d", bss->beaconInterval);
                iwe.u.data.length = strlen(buf);
-               current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe, buf);
+               current_ev = iwe_stream_add_point(info, current_ev, end_buf,
+                                                 &iwe, buf);
                kfree(buf);
        }
 
@@ -7295,8 +7300,10 @@ static inline char *airo_translate_scan(struct net_device *dev,
                                        iwe.cmd = IWEVGENIE;
                                        iwe.u.data.length = min(info_element->len + 2,
                                                                  MAX_WPA_IE_LEN);
-                                       current_ev = iwe_stream_add_point(current_ev, end_buf,
-                                                       &iwe, (char *) info_element);
+                                       current_ev = iwe_stream_add_point(
+                                                       info, current_ev,
+                                                       end_buf, &iwe,
+                                                       (char *) info_element);
                                }
                                break;
 
@@ -7304,8 +7311,9 @@ static inline char *airo_translate_scan(struct net_device *dev,
                                iwe.cmd = IWEVGENIE;
                                iwe.u.data.length = min(info_element->len + 2,
                                                          MAX_WPA_IE_LEN);
-                               current_ev = iwe_stream_add_point(current_ev, end_buf,
-                                               &iwe, (char *) info_element);
+                               current_ev = iwe_stream_add_point(
+                                       info, current_ev, end_buf,
+                                       &iwe, (char *) info_element);
                                break;
 
                        default:
@@ -7344,7 +7352,7 @@ static int airo_get_scan(struct net_device *dev,
 
        list_for_each_entry (net, &ai->network_list, list) {
                /* Translate to WE format this entry */
-               current_ev = airo_translate_scan(dev, current_ev,
+               current_ev = airo_translate_scan(dev, info, current_ev,
                                                 extra + dwrq->length,
                                                 &net->bss);