mwifiex: use IEEE80211_HT_PARAM_CHA_SEC_* macros
authorAmitkumar Karwar <akarwar@marvell.com>
Wed, 21 Dec 2011 07:47:21 +0000 (23:47 -0800)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 21 Dec 2011 20:06:13 +0000 (15:06 -0500)
Replace driver specific macros with the corresponding
IEEE80211_HT_PARAM_CHA_SEC_* macros defined in ieee80211.h.
Also, rename 'adapter->chan_offset' to 'adapter->sec_chan_offset'
for consistency.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/mwifiex/cfg80211.c
drivers/net/wireless/mwifiex/fw.h
drivers/net/wireless/mwifiex/init.c
drivers/net/wireless/mwifiex/ioctl.h
drivers/net/wireless/mwifiex/join.c
drivers/net/wireless/mwifiex/main.h
drivers/net/wireless/mwifiex/sta_cmd.c

index 64bf64051aa9bf218b0df7bed04a7000975fc08d..0723f610694f597e4d62f1fdfd7dc09819110b3b 100644 (file)
  * This function maps the nl802.11 channel type into driver channel type.
  *
  * The mapping is as follows -
- *      NL80211_CHAN_NO_HT     -> NO_SEC_CHANNEL
- *      NL80211_CHAN_HT20      -> NO_SEC_CHANNEL
- *      NL80211_CHAN_HT40PLUS  -> SEC_CHANNEL_ABOVE
- *      NL80211_CHAN_HT40MINUS -> SEC_CHANNEL_BELOW
- *      Others                 -> NO_SEC_CHANNEL
+ *      NL80211_CHAN_NO_HT     -> IEEE80211_HT_PARAM_CHA_SEC_NONE
+ *      NL80211_CHAN_HT20      -> IEEE80211_HT_PARAM_CHA_SEC_NONE
+ *      NL80211_CHAN_HT40PLUS  -> IEEE80211_HT_PARAM_CHA_SEC_ABOVE
+ *      NL80211_CHAN_HT40MINUS -> IEEE80211_HT_PARAM_CHA_SEC_BELOW
+ *      Others                 -> IEEE80211_HT_PARAM_CHA_SEC_NONE
  */
-static int
-mwifiex_cfg80211_channel_type_to_mwifiex_channels(enum nl80211_channel_type
-                                                 channel_type)
+static u8
+mwifiex_cfg80211_channel_type_to_sec_chan_offset(enum nl80211_channel_type
+                                                channel_type)
 {
        switch (channel_type) {
        case NL80211_CHAN_NO_HT:
        case NL80211_CHAN_HT20:
-               return NO_SEC_CHANNEL;
+               return IEEE80211_HT_PARAM_CHA_SEC_NONE;
        case NL80211_CHAN_HT40PLUS:
-               return SEC_CHANNEL_ABOVE;
+               return IEEE80211_HT_PARAM_CHA_SEC_ABOVE;
        case NL80211_CHAN_HT40MINUS:
-               return SEC_CHANNEL_BELOW;
+               return IEEE80211_HT_PARAM_CHA_SEC_BELOW;
        default:
-               return NO_SEC_CHANNEL;
+               return IEEE80211_HT_PARAM_CHA_SEC_NONE;
        }
 }
 
@@ -51,20 +51,20 @@ mwifiex_cfg80211_channel_type_to_mwifiex_channels(enum nl80211_channel_type
  * This function maps the driver channel type into nl802.11 channel type.
  *
  * The mapping is as follows -
- *      NO_SEC_CHANNEL      -> NL80211_CHAN_HT20
- *      SEC_CHANNEL_ABOVE   -> NL80211_CHAN_HT40PLUS
- *      SEC_CHANNEL_BELOW   -> NL80211_CHAN_HT40MINUS
- *      Others              -> NL80211_CHAN_HT20
+ *      IEEE80211_HT_PARAM_CHA_SEC_NONE    -> NL80211_CHAN_HT20
+ *      IEEE80211_HT_PARAM_CHA_SEC_ABOVE   -> NL80211_CHAN_HT40PLUS
+ *      IEEE80211_HT_PARAM_CHA_SEC_BELOW   -> NL80211_CHAN_HT40MINUS
+ *      Others                             -> NL80211_CHAN_HT20
  */
 static enum nl80211_channel_type
 mwifiex_channels_to_cfg80211_channel_type(int channel_type)
 {
        switch (channel_type) {
-       case NO_SEC_CHANNEL:
+       case IEEE80211_HT_PARAM_CHA_SEC_NONE:
                return NL80211_CHAN_HT20;
-       case SEC_CHANNEL_ABOVE:
+       case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
                return NL80211_CHAN_HT40PLUS;
-       case SEC_CHANNEL_BELOW:
+       case IEEE80211_HT_PARAM_CHA_SEC_BELOW:
                return NL80211_CHAN_HT40MINUS;
        default:
                return NL80211_CHAN_HT20;
@@ -354,15 +354,15 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv,
                                        adapter->adhoc_11n_enabled = false;
                        }
                }
-               adapter->chan_offset =
-                       mwifiex_cfg80211_channel_type_to_mwifiex_channels
+               adapter->sec_chan_offset =
+                       mwifiex_cfg80211_channel_type_to_sec_chan_offset
                        (channel_type);
 
                mwifiex_send_domain_info_cmd_fw(wiphy);
        }
 
        wiphy_dbg(wiphy, "info: setting band %d, channel offset %d and "
-               "mode %d\n", config_bands, adapter->chan_offset,
+               "mode %d\n", config_bands, adapter->sec_chan_offset,
                priv->bss_mode);
        if (!chan)
                return 0;
@@ -729,7 +729,7 @@ static int mwifiex_cfg80211_set_bitrate_mask(struct wiphy *wiphy,
                        adapter->adhoc_11n_enabled = false;
                }
        }
-       adapter->chan_offset = NO_SEC_CHANNEL;
+       adapter->sec_chan_offset = IEEE80211_HT_PARAM_CHA_SEC_NONE;
 
        wiphy_debug(wiphy, "info: device configured in 802.11%s%s mode\n",
                                (mode & BAND_B) ? "b" : "",
@@ -850,7 +850,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid,
        if (channel)
                ret = mwifiex_set_rf_channel(priv, channel,
                                mwifiex_channels_to_cfg80211_channel_type
-                               (priv->adapter->chan_offset));
+                               (priv->adapter->sec_chan_offset));
 
        ret = mwifiex_set_encode(priv, NULL, 0, 0, 1);  /* Disable keys */
 
index 62b863907698028f07a5abb51d33bde8c3a96681..51c5417c569c42570e0a3300c59529c2c6af767c 100644 (file)
@@ -376,8 +376,6 @@ enum mwifiex_chan_scan_mode_bitmasks {
        MWIFIEX_DISABLE_CHAN_FILT = BIT(1),
 };
 
-#define SECOND_CHANNEL_BELOW    0x30
-#define SECOND_CHANNEL_ABOVE    0x10
 struct mwifiex_chan_scan_param_set {
        u8 radio_type;
        u8 chan_number;
index 244c728ef9dcc63f968617e7e557874d8f4f4977..e05b417a3fae8b54d5e632f477dc5885c8a2697f 100644 (file)
@@ -246,7 +246,7 @@ static void mwifiex_init_adapter(struct mwifiex_adapter *adapter)
        memset(adapter->event_body, 0, sizeof(adapter->event_body));
        adapter->hw_dot_11n_dev_cap = 0;
        adapter->hw_dev_mcs_support = 0;
-       adapter->chan_offset = 0;
+       adapter->sec_chan_offset = 0;
        adapter->adhoc_11n_enabled = false;
 
        mwifiex_wmm_init(adapter);
index eb76b7b749ad1261a0040132a81e01f431359a7a..d5d81f1fe41c9c5b310e21cf0778284a43478f86 100644 (file)
@@ -62,10 +62,6 @@ enum {
        BAND_AN = 16,
 };
 
-#define NO_SEC_CHANNEL               0
-#define SEC_CHANNEL_ABOVE            1
-#define SEC_CHANNEL_BELOW            3
-
 enum {
        ADHOC_IDLE,
        ADHOC_STARTED,
index 1c4981367e508fbaa45fd6e5648452e75da5ee7c..0b0eb5efba9dd4206d08b8f79c817319ab4c8037 100644 (file)
@@ -885,12 +885,14 @@ mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv,
                       = mwifiex_band_to_radio_type(priv->curr_bss_params.band);
                if (adapter->adhoc_start_band & BAND_GN
                    || adapter->adhoc_start_band & BAND_AN) {
-                       if (adapter->chan_offset == SEC_CHANNEL_ABOVE)
+                       if (adapter->sec_chan_offset ==
+                                           IEEE80211_HT_PARAM_CHA_SEC_ABOVE)
                                chan_tlv->chan_scan_param[0].radio_type |=
-                                       SECOND_CHANNEL_ABOVE;
-                       else if (adapter->chan_offset == SEC_CHANNEL_BELOW)
+                                       (IEEE80211_HT_PARAM_CHA_SEC_ABOVE << 4);
+                       else if (adapter->sec_chan_offset ==
+                                           IEEE80211_HT_PARAM_CHA_SEC_ABOVE)
                                chan_tlv->chan_scan_param[0].radio_type |=
-                                       SECOND_CHANNEL_BELOW;
+                                       (IEEE80211_HT_PARAM_CHA_SEC_BELOW << 4);
                }
                dev_dbg(adapter->dev, "info: ADHOC_S_CMD: TLV Band = %d\n",
                       chan_tlv->chan_scan_param[0].radio_type);
@@ -936,8 +938,8 @@ mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv,
 
                ht_info->ht_info.control_chan =
                        (u8) priv->curr_bss_params.bss_descriptor.channel;
-               if (adapter->chan_offset) {
-                       ht_info->ht_info.ht_param = adapter->chan_offset;
+               if (adapter->sec_chan_offset) {
+                       ht_info->ht_info.ht_param = adapter->sec_chan_offset;
                        ht_info->ht_info.ht_param |=
                                        IEEE80211_HT_PARAM_CHAN_WIDTH_ANY;
                }
index d659650a1379ef78d91b4c12dfec156ff3169287..2287643b5f874fa412cc336e42b3b85b2b389702 100644 (file)
@@ -640,7 +640,7 @@ struct mwifiex_adapter {
        u32 hw_dot_11n_dev_cap;
        u8 hw_dev_mcs_support;
        u8 adhoc_11n_enabled;
-       u8 chan_offset;
+       u8 sec_chan_offset;
        struct mwifiex_dbg dbg;
        u8 arp_filter[ARP_FILTER_MAX_BUF_SIZE];
        u32 arp_filter_size;
index ea6518d1c9e323c3adec7a28996b8f0fa3e71898..6e443ffa0465c7ecb93a0ab8165f90fe6127bd0f 100644 (file)
@@ -748,7 +748,7 @@ static int mwifiex_cmd_802_11_rf_channel(struct mwifiex_private *priv,
                                cpu_to_le16(HostCmd_SCAN_RADIO_TYPE_A);
 
                rf_type = le16_to_cpu(rf_chan->rf_type);
-               SET_SECONDARYCHAN(rf_type, priv->adapter->chan_offset);
+               SET_SECONDARYCHAN(rf_type, priv->adapter->sec_chan_offset);
                rf_chan->current_channel = cpu_to_le16(*channel);
        }
        rf_chan->action = cpu_to_le16(cmd_action);