diff options
author | Johannes Berg <johannes.berg@intel.com> | 2012-11-08 15:25:48 -0500 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2012-11-26 06:42:58 -0500 |
commit | 683b6d3b31a51956ea540df00abb0b78894924c1 (patch) | |
tree | 558e0f316b56368ab259755cb4eeaeb40331853d /drivers/net/wireless/mwifiex | |
parent | fe4b31810c06cc6518fb193efb9b3c3289b55832 (diff) |
cfg80211: pass a channel definition struct
Instead of passing a channel pointer and channel type
to all functions and driver methods, pass a new channel
definition struct. Right now, this struct contains just
the control channel and channel type, but for VHT this
will change.
Also, add a small inline cfg80211_get_chandef_type() so
that drivers don't need to use the _type field of the
new structure all the time, which will change.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'drivers/net/wireless/mwifiex')
-rw-r--r-- | drivers/net/wireless/mwifiex/cfg80211.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index f69190b492aa..42be612faf0f 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -1291,21 +1291,23 @@ static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy, | |||
1291 | return -EINVAL; | 1291 | return -EINVAL; |
1292 | } | 1292 | } |
1293 | 1293 | ||
1294 | bss_cfg->channel = | 1294 | bss_cfg->channel = ieee80211_frequency_to_channel( |
1295 | (u8)ieee80211_frequency_to_channel(params->channel->center_freq); | 1295 | params->chandef.chan->center_freq); |
1296 | 1296 | ||
1297 | /* Set appropriate bands */ | 1297 | /* Set appropriate bands */ |
1298 | if (params->channel->band == IEEE80211_BAND_2GHZ) { | 1298 | if (params->chandef.chan->band == IEEE80211_BAND_2GHZ) { |
1299 | bss_cfg->band_cfg = BAND_CONFIG_BG; | 1299 | bss_cfg->band_cfg = BAND_CONFIG_BG; |
1300 | 1300 | ||
1301 | if (params->channel_type == NL80211_CHAN_NO_HT) | 1301 | if (cfg80211_get_chandef_type(¶ms->chandef) == |
1302 | NL80211_CHAN_NO_HT) | ||
1302 | config_bands = BAND_B | BAND_G; | 1303 | config_bands = BAND_B | BAND_G; |
1303 | else | 1304 | else |
1304 | config_bands = BAND_B | BAND_G | BAND_GN; | 1305 | config_bands = BAND_B | BAND_G | BAND_GN; |
1305 | } else { | 1306 | } else { |
1306 | bss_cfg->band_cfg = BAND_CONFIG_A; | 1307 | bss_cfg->band_cfg = BAND_CONFIG_A; |
1307 | 1308 | ||
1308 | if (params->channel_type == NL80211_CHAN_NO_HT) | 1309 | if (cfg80211_get_chandef_type(¶ms->chandef) == |
1310 | NL80211_CHAN_NO_HT) | ||
1309 | config_bands = BAND_A; | 1311 | config_bands = BAND_A; |
1310 | else | 1312 | else |
1311 | config_bands = BAND_AN | BAND_A; | 1313 | config_bands = BAND_AN | BAND_A; |
@@ -1678,7 +1680,7 @@ static int mwifiex_set_ibss_params(struct mwifiex_private *priv, | |||
1678 | int index = 0, i; | 1680 | int index = 0, i; |
1679 | u8 config_bands = 0; | 1681 | u8 config_bands = 0; |
1680 | 1682 | ||
1681 | if (params->channel->band == IEEE80211_BAND_2GHZ) { | 1683 | if (params->chandef.chan->band == IEEE80211_BAND_2GHZ) { |
1682 | if (!params->basic_rates) { | 1684 | if (!params->basic_rates) { |
1683 | config_bands = BAND_B | BAND_G; | 1685 | config_bands = BAND_B | BAND_G; |
1684 | } else { | 1686 | } else { |
@@ -1703,10 +1705,12 @@ static int mwifiex_set_ibss_params(struct mwifiex_private *priv, | |||
1703 | } | 1705 | } |
1704 | } | 1706 | } |
1705 | 1707 | ||
1706 | if (params->channel_type != NL80211_CHAN_NO_HT) | 1708 | if (cfg80211_get_chandef_type(¶ms->chandef) != |
1709 | NL80211_CHAN_NO_HT) | ||
1707 | config_bands |= BAND_GN; | 1710 | config_bands |= BAND_GN; |
1708 | } else { | 1711 | } else { |
1709 | if (params->channel_type == NL80211_CHAN_NO_HT) | 1712 | if (cfg80211_get_chandef_type(¶ms->chandef) != |
1713 | NL80211_CHAN_NO_HT) | ||
1710 | config_bands = BAND_A; | 1714 | config_bands = BAND_A; |
1711 | else | 1715 | else |
1712 | config_bands = BAND_AN | BAND_A; | 1716 | config_bands = BAND_AN | BAND_A; |
@@ -1723,9 +1727,10 @@ static int mwifiex_set_ibss_params(struct mwifiex_private *priv, | |||
1723 | } | 1727 | } |
1724 | 1728 | ||
1725 | adapter->sec_chan_offset = | 1729 | adapter->sec_chan_offset = |
1726 | mwifiex_chan_type_to_sec_chan_offset(params->channel_type); | 1730 | mwifiex_chan_type_to_sec_chan_offset( |
1727 | priv->adhoc_channel = | 1731 | cfg80211_get_chandef_type(¶ms->chandef)); |
1728 | ieee80211_frequency_to_channel(params->channel->center_freq); | 1732 | priv->adhoc_channel = ieee80211_frequency_to_channel( |
1733 | params->chandef.chan->center_freq); | ||
1729 | 1734 | ||
1730 | wiphy_dbg(wiphy, "info: set ibss band %d, chan %d, chan offset %d\n", | 1735 | wiphy_dbg(wiphy, "info: set ibss band %d, chan %d, chan offset %d\n", |
1731 | config_bands, priv->adhoc_channel, adapter->sec_chan_offset); | 1736 | config_bands, priv->adhoc_channel, adapter->sec_chan_offset); |
@@ -1759,7 +1764,8 @@ mwifiex_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, | |||
1759 | 1764 | ||
1760 | ret = mwifiex_cfg80211_assoc(priv, params->ssid_len, params->ssid, | 1765 | ret = mwifiex_cfg80211_assoc(priv, params->ssid_len, params->ssid, |
1761 | params->bssid, priv->bss_mode, | 1766 | params->bssid, priv->bss_mode, |
1762 | params->channel, NULL, params->privacy); | 1767 | params->chandef.chan, NULL, |
1768 | params->privacy); | ||
1763 | done: | 1769 | done: |
1764 | if (!ret) { | 1770 | if (!ret) { |
1765 | cfg80211_ibss_joined(priv->netdev, priv->cfg_bssid, GFP_KERNEL); | 1771 | cfg80211_ibss_joined(priv->netdev, priv->cfg_bssid, GFP_KERNEL); |