summaryrefslogtreecommitdiff
path: root/net/mac80211/chan.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-01-09 16:57:36 +0400
committerJohn W. Linville <linville@tuxdriver.com>2012-01-24 23:08:39 +0400
commite9980e6d20a5c4d3f52359142ab3569171759a5b (patch)
treed117e03b078a089a6554ebe8c28f1e4c545102f8 /net/mac80211/chan.c
parent75ac9a28a0c6b818ba1aba874b6b3ae17241552c (diff)
downloadlinux-e9980e6d20a5c4d3f52359142ab3569171759a5b.tar.xz
mac80211: refactor __ieee80211_get_channel_mode
Use a switch statement instead of a list of if statements. Also include AP_VLAN in the list and skip them since the AP interface will also be looked at. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/chan.c')
-rw-r--r--net/mac80211/chan.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index 889c3e93e0f4..d1f7abddb182 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -20,23 +20,29 @@ __ieee80211_get_channel_mode(struct ieee80211_local *local,
if (!ieee80211_sdata_running(sdata))
continue;
- if (sdata->vif.type == NL80211_IFTYPE_MONITOR)
+ switch (sdata->vif.type) {
+ case NL80211_IFTYPE_MONITOR:
continue;
-
- if (sdata->vif.type == NL80211_IFTYPE_STATION &&
- !sdata->u.mgd.associated)
- continue;
-
- if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {
+ case NL80211_IFTYPE_STATION:
+ if (!sdata->u.mgd.associated)
+ continue;
+ break;
+ case NL80211_IFTYPE_ADHOC:
if (!sdata->u.ibss.ssid_len)
continue;
if (!sdata->u.ibss.fixed_channel)
return CHAN_MODE_HOPPING;
- }
-
- if (sdata->vif.type == NL80211_IFTYPE_AP &&
- !sdata->u.ap.beacon)
+ break;
+ case NL80211_IFTYPE_AP_VLAN:
+ /* will also have _AP interface */
continue;
+ case NL80211_IFTYPE_AP:
+ if (!sdata->u.ap.beacon)
+ continue;
+ break;
+ default:
+ break;
+ }
return CHAN_MODE_FIXED;
}