diff options
author | Johannes Berg <johannes.berg@intel.com> | 2012-01-09 07:57:36 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-01-24 14:08:39 -0500 |
commit | e9980e6d20a5c4d3f52359142ab3569171759a5b (patch) | |
tree | d117e03b078a089a6554ebe8c28f1e4c545102f8 /net/mac80211 | |
parent | 75ac9a28a0c6b818ba1aba874b6b3ae17241552c (diff) |
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')
-rw-r--r-- | net/mac80211/chan.c | 28 |
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, | |||
20 | if (!ieee80211_sdata_running(sdata)) | 20 | if (!ieee80211_sdata_running(sdata)) |
21 | continue; | 21 | continue; |
22 | 22 | ||
23 | if (sdata->vif.type == NL80211_IFTYPE_MONITOR) | 23 | switch (sdata->vif.type) { |
24 | case NL80211_IFTYPE_MONITOR: | ||
24 | continue; | 25 | continue; |
25 | 26 | case NL80211_IFTYPE_STATION: | |
26 | if (sdata->vif.type == NL80211_IFTYPE_STATION && | 27 | if (!sdata->u.mgd.associated) |
27 | !sdata->u.mgd.associated) | 28 | continue; |
28 | continue; | 29 | break; |
29 | 30 | case NL80211_IFTYPE_ADHOC: | |
30 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC) { | ||
31 | if (!sdata->u.ibss.ssid_len) | 31 | if (!sdata->u.ibss.ssid_len) |
32 | continue; | 32 | continue; |
33 | if (!sdata->u.ibss.fixed_channel) | 33 | if (!sdata->u.ibss.fixed_channel) |
34 | return CHAN_MODE_HOPPING; | 34 | return CHAN_MODE_HOPPING; |
35 | } | 35 | break; |
36 | 36 | case NL80211_IFTYPE_AP_VLAN: | |
37 | if (sdata->vif.type == NL80211_IFTYPE_AP && | 37 | /* will also have _AP interface */ |
38 | !sdata->u.ap.beacon) | ||
39 | continue; | 38 | continue; |
39 | case NL80211_IFTYPE_AP: | ||
40 | if (!sdata->u.ap.beacon) | ||
41 | continue; | ||
42 | break; | ||
43 | default: | ||
44 | break; | ||
45 | } | ||
40 | 46 | ||
41 | return CHAN_MODE_FIXED; | 47 | return CHAN_MODE_FIXED; |
42 | } | 48 | } |