aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/chan.c
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/wireless/chan.c
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/wireless/chan.c')
-rw-r--r--net/wireless/chan.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index 884801ac4dd..20b87d89572 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,