aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-05-16 17:50:17 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-06-05 15:32:16 -0400
commitd58e7e37aac0465b08527adadc8016421bd4060e (patch)
treee0a06894e131012e97a892704970ab0b8b1141f2 /net
parent3d9e6e12077d2611749ba3145bc4934aae461425 (diff)
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')
-rw-r--r--net/mac80211/ibss.c3
-rw-r--r--net/wireless/chan.c22
2 files changed, 7 insertions, 18 deletions
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 0bc47a825692..725cb4be229d 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -82,8 +82,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
82 82
83 local->oper_channel = chan; 83 local->oper_channel = chan;
84 channel_type = ifibss->channel_type; 84 channel_type = ifibss->channel_type;
85 if (channel_type > NL80211_CHAN_HT20 && 85 if (!cfg80211_can_beacon_sec_chan(local->hw.wiphy, chan, channel_type))
86 !cfg80211_can_beacon_sec_chan(local->hw.wiphy, chan, channel_type))
87 channel_type = NL80211_CHAN_HT20; 86 channel_type = NL80211_CHAN_HT20;
88 if (!ieee80211_set_channel_type(local, sdata, channel_type)) { 87 if (!ieee80211_set_channel_type(local, sdata, channel_type)) {
89 /* can only fail due to HT40+/- mismatch */ 88 /* can only fail due to HT40+/- mismatch */
diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index 884801ac4dd0..20b87d895722 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -60,7 +60,7 @@ bool cfg80211_can_beacon_sec_chan(struct wiphy *wiphy,
60 diff = -20; 60 diff = -20;
61 break; 61 break;
62 default: 62 default:
63 return false; 63 return true;
64 } 64 }
65 65
66 sec_chan = ieee80211_get_channel(wiphy, chan->center_freq + diff); 66 sec_chan = ieee80211_get_channel(wiphy, chan->center_freq + diff);
@@ -107,21 +107,11 @@ int cfg80211_set_freq(struct cfg80211_registered_device *rdev,
107 wdev->iftype == NL80211_IFTYPE_AP || 107 wdev->iftype == NL80211_IFTYPE_AP ||
108 wdev->iftype == NL80211_IFTYPE_AP_VLAN || 108 wdev->iftype == NL80211_IFTYPE_AP_VLAN ||
109 wdev->iftype == NL80211_IFTYPE_MESH_POINT || 109 wdev->iftype == NL80211_IFTYPE_MESH_POINT ||
110 wdev->iftype == NL80211_IFTYPE_P2P_GO)) { 110 wdev->iftype == NL80211_IFTYPE_P2P_GO) &&
111 switch (channel_type) { 111 !cfg80211_can_beacon_sec_chan(&rdev->wiphy, chan, channel_type)) {
112 case NL80211_CHAN_HT40PLUS: 112 printk(KERN_DEBUG
113 case NL80211_CHAN_HT40MINUS: 113 "cfg80211: Secondary channel not allowed to beacon\n");
114 if (!cfg80211_can_beacon_sec_chan(&rdev->wiphy, chan, 114 return -EINVAL;
115 channel_type)) {
116 printk(KERN_DEBUG
117 "cfg80211: Secondary channel not "
118 "allowed to initiate communication\n");
119 return -EINVAL;
120 }
121 break;
122 default:
123 break;
124 }
125 } 115 }
126 116
127 result = rdev->ops->set_channel(&rdev->wiphy, 117 result = rdev->ops->set_channel(&rdev->wiphy,