diff options
author | Johannes Berg <johannes.berg@intel.com> | 2012-05-16 23:50:17 +0200 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-06-05 15:32:16 -0400 |
commit | d58e7e37aac0465b08527adadc8016421bd4060e (patch) | |
tree | e0a06894e131012e97a892704970ab0b8b1141f2 /net/wireless/chan.c | |
parent | 3d9e6e12077d2611749ba3145bc4934aae461425 (diff) | |
download | op-kernel-dev-d58e7e37aac0465b08527adadc8016421bd4060e.zip op-kernel-dev-d58e7e37aac0465b08527adadc8016421bd4060e.tar.gz |
cfg80211: simplify cfg80211_can_beacon_sec_chan API
Change cfg80211_can_beacon_sec_chan() to return true
if there is no secondary channel to simplify all the
current users of it. They all check the channel type
before calling the function because it returns false
if there's no secondary channel.
Also actually document the return value.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/chan.c')
-rw-r--r-- | net/wireless/chan.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/net/wireless/chan.c b/net/wireless/chan.c index 884801a..20b87d8 100644 --- a/net/wireless/chan.c +++ b/net/wireless/chan.c @@ -60,7 +60,7 @@ bool cfg80211_can_beacon_sec_chan(struct wiphy *wiphy, diff = -20; break; default: - return false; + return true; } sec_chan = ieee80211_get_channel(wiphy, chan->center_freq + diff); @@ -107,21 +107,11 @@ int cfg80211_set_freq(struct cfg80211_registered_device *rdev, wdev->iftype == NL80211_IFTYPE_AP || wdev->iftype == NL80211_IFTYPE_AP_VLAN || wdev->iftype == NL80211_IFTYPE_MESH_POINT || - wdev->iftype == NL80211_IFTYPE_P2P_GO)) { - switch (channel_type) { - case NL80211_CHAN_HT40PLUS: - case NL80211_CHAN_HT40MINUS: - if (!cfg80211_can_beacon_sec_chan(&rdev->wiphy, chan, - channel_type)) { - printk(KERN_DEBUG - "cfg80211: Secondary channel not " - "allowed to initiate communication\n"); - return -EINVAL; - } - break; - default: - break; - } + wdev->iftype == NL80211_IFTYPE_P2P_GO) && + !cfg80211_can_beacon_sec_chan(&rdev->wiphy, chan, channel_type)) { + printk(KERN_DEBUG + "cfg80211: Secondary channel not allowed to beacon\n"); + return -EINVAL; } result = rdev->ops->set_channel(&rdev->wiphy, |