libertas: remove unused 11d code
[safe/jmp/linux-2.6] / drivers / net / wireless / libertas / scan.c
index 38b0560..584ff76 100644 (file)
@@ -5,6 +5,7 @@
   *  for sending scan commands to the firmware.
   */
 #include <linux/types.h>
+#include <linux/kernel.h>
 #include <linux/etherdevice.h>
 #include <linux/if_arp.h>
 #include <asm/unaligned.h>
                              + 40)     /* 40 for WPAIE */
 
 //! Memory needed to store a max sized channel List TLV for a firmware scan
-#define CHAN_TLV_MAX_SIZE  (sizeof(struct mrvlietypesheader)    \
+#define CHAN_TLV_MAX_SIZE  (sizeof(struct mrvl_ie_header)    \
                             + (MRVDRV_MAX_CHANNELS_PER_SCAN     \
                                * sizeof(struct chanscanparamset)))
 
 //! Memory needed to store a max number/size SSID TLV for a firmware scan
-#define SSID_TLV_MAX_SIZE  (1 * sizeof(struct mrvlietypes_ssidparamset))
+#define SSID_TLV_MAX_SIZE  (1 * sizeof(struct mrvl_ie_ssid_param_set))
 
 //! Maximum memory needed for a cmd_ds_802_11_scan with all TLVs at max
 #define MAX_SCAN_CFG_ALLOC (sizeof(struct cmd_ds_802_11_scan)  \
@@ -160,31 +161,15 @@ static int lbs_scan_create_channel_list(struct lbs_private *priv,
        scantype = CMD_SCAN_TYPE_ACTIVE;
 
        for (rgnidx = 0; rgnidx < ARRAY_SIZE(priv->region_channel); rgnidx++) {
-               if (priv->enable11d && (priv->connect_status != LBS_CONNECTED)
-                   && (priv->mesh_connect_status != LBS_CONNECTED)) {
-                       /* Scan all the supported chan for the first scan */
-                       if (!priv->universal_channel[rgnidx].valid)
-                               continue;
-                       scanregion = &priv->universal_channel[rgnidx];
-
-                       /* clear the parsed_region_chan for the first scan */
-                       memset(&priv->parsed_region_chan, 0x00,
-                              sizeof(priv->parsed_region_chan));
-               } else {
-                       if (!priv->region_channel[rgnidx].valid)
-                               continue;
-                       scanregion = &priv->region_channel[rgnidx];
-               }
+               if (!priv->region_channel[rgnidx].valid)
+                       continue;
+               scanregion = &priv->region_channel[rgnidx];
 
                for (nextchan = 0; nextchan < scanregion->nrcfp; nextchan++, chanidx++) {
                        struct chanscanparamset *chan = &scanchanlist[chanidx];
 
                        cfp = scanregion->CFP + nextchan;
 
-                       if (priv->enable11d)
-                               scantype = lbs_get_scan_type_11d(cfp->channel,
-                                                                &priv->parsed_region_chan);
-
                        if (scanregion->band == BAND_B || scanregion->band == BAND_G)
                                chan->radiotype = CMD_SCAN_RADIO_TYPE_BG;
 
@@ -211,7 +196,7 @@ static int lbs_scan_create_channel_list(struct lbs_private *priv,
  */
 static int lbs_scan_add_ssid_tlv(struct lbs_private *priv, u8 *tlv)
 {
-       struct mrvlietypes_ssidparamset *ssid_tlv = (void *)tlv;
+       struct mrvl_ie_ssid_param_set *ssid_tlv = (void *)tlv;
 
        ssid_tlv->header.type = cpu_to_le16(TLV_TYPE_SSID);
        ssid_tlv->header.len = cpu_to_le16(priv->scan_ssid_len);
@@ -249,7 +234,7 @@ static int lbs_scan_add_chanlist_tlv(uint8_t *tlv,
                                     int chan_count)
 {
        size_t size = sizeof(struct chanscanparamset) *chan_count;
-       struct mrvlietypes_chanlistparamset *chan_tlv = (void *)tlv;
+       struct mrvl_ie_chanlist_param_set *chan_tlv = (void *)tlv;
 
        chan_tlv->header.type = cpu_to_le16(TLV_TYPE_CHANLIST);
        memcpy(chan_tlv->chanscanparam, chan_list, size);
@@ -270,7 +255,7 @@ static int lbs_scan_add_chanlist_tlv(uint8_t *tlv,
 static int lbs_scan_add_rates_tlv(uint8_t *tlv)
 {
        int i;
-       struct mrvlietypes_ratesparamset *rate_tlv = (void *)tlv;
+       struct mrvl_ie_rates_param_set *rate_tlv = (void *)tlv;
 
        rate_tlv->header.type = cpu_to_le16(TLV_TYPE_RATES);
        tlv += sizeof(rate_tlv->header);
@@ -518,7 +503,7 @@ static int lbs_process_bss(struct bss_descriptor *bss,
        struct ieee_ie_cf_param_set *cf;
        struct ieee_ie_ibss_param_set *ibss;
        DECLARE_SSID_BUF(ssid);
-       struct ieeetypes_countryinfoset *pcountryinfo;
+       struct ieee_ie_country_info_set *pcountryinfo;
        uint8_t *pos, *end, *p;
        uint8_t n_ex_rates = 0, got_basic_rates = 0, n_basic_rates = 0;
        uint16_t beaconsize = 0;
@@ -642,20 +627,23 @@ static int lbs_process_bss(struct bss_descriptor *bss,
                        break;
 
                case WLAN_EID_COUNTRY:
-                       pcountryinfo = (struct ieeetypes_countryinfoset *) pos;
+                       pcountryinfo = (struct ieee_ie_country_info_set *) pos;
                        lbs_deb_scan("got COUNTRY IE\n");
-                       if (pcountryinfo->len < sizeof(pcountryinfo->countrycode)
-                           || pcountryinfo->len > 254) {
-                               lbs_deb_scan("process_bss: 11D- Err CountryInfo len %d, min %zd, max 254\n",
-                                            pcountryinfo->len, sizeof(pcountryinfo->countrycode));
+                       if (pcountryinfo->header.len < sizeof(pcountryinfo->countrycode)
+                           || pcountryinfo->header.len > 254) {
+                               lbs_deb_scan("%s: 11D- Err CountryInfo len %d, min %zd, max 254\n",
+                                            __func__,
+                                            pcountryinfo->header.len,
+                                            sizeof(pcountryinfo->countrycode));
                                ret = -1;
                                goto done;
                        }
 
-                       memcpy(&bss->countryinfo, pcountryinfo, pcountryinfo->len + 2);
+                       memcpy(&bss->countryinfo, pcountryinfo,
+                               pcountryinfo->header.len + 2);
                        lbs_deb_hex(LBS_DEB_SCAN, "process_bss: 11d countryinfo",
                                    (uint8_t *) pcountryinfo,
-                                   (int) (pcountryinfo->len + 2));
+                                   (int) (pcountryinfo->header.len + 2));
                        break;
 
                case WLAN_EID_EXT_SUPP_RATES:
@@ -873,7 +861,7 @@ static inline char *lbs_translate_scan(struct lbs_private *priv,
        iwe.u.bitrate.disabled = 0;
        iwe.u.bitrate.value = 0;
 
-       for (j = 0; bss->rates[j] && (j < sizeof(bss->rates)); j++) {
+       for (j = 0; j < ARRAY_SIZE(bss->rates) && bss->rates[j]; j++) {
                /* Bit rate given in 500 kb/s units */
                iwe.u.bitrate.value = bss->rates[j] * 500000;
                current_val = iwe_stream_add_value(info, start, current_val,
@@ -1018,9 +1006,12 @@ int lbs_get_scan(struct net_device *dev, struct iw_request_info *info,
                return -EAGAIN;
 
        /* Update RSSI if current BSS is a locally created ad-hoc BSS */
-       if ((priv->mode == IW_MODE_ADHOC) && priv->adhoccreate)
-               lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0,
-                                            CMD_OPTION_WAITFORRSP, 0, NULL);
+       if ((priv->mode == IW_MODE_ADHOC) && priv->adhoccreate) {
+               err = lbs_prepare_and_send_command(priv, CMD_802_11_RSSI, 0,
+                               CMD_OPTION_WAITFORRSP, 0, NULL);
+               if (err)
+                       goto out;
+       }
 
        mutex_lock(&priv->lock);
        list_for_each_entry_safe (iter_bss, safe, &priv->network_list, list) {
@@ -1054,7 +1045,7 @@ int lbs_get_scan(struct net_device *dev, struct iw_request_info *info,
 
        dwrq->length = (ev - extra);
        dwrq->flags = 0;
-
+out:
        lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", err);
        return err;
 }
@@ -1126,7 +1117,7 @@ static int lbs_ret_80211_scan(struct lbs_private *priv, unsigned long dummy,
                goto done;
        }
 
-       bytesleft = le16_to_cpu(scanresp->bssdescriptsize);
+       bytesleft = get_unaligned_le16(&scanresp->bssdescriptsize);
        lbs_deb_scan("SCAN_RESP: bssdescriptsize %d\n", bytesleft);
 
        scanrespsize = le16_to_cpu(resp->size);