Commit e9980e6d authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

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: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 75ac9a28
...@@ -20,23 +20,29 @@ __ieee80211_get_channel_mode(struct ieee80211_local *local, ...@@ -20,23 +20,29 @@ __ieee80211_get_channel_mode(struct ieee80211_local *local,
if (!ieee80211_sdata_running(sdata)) if (!ieee80211_sdata_running(sdata))
continue; continue;
if (sdata->vif.type == NL80211_IFTYPE_MONITOR) switch (sdata->vif.type) {
case NL80211_IFTYPE_MONITOR:
continue; continue;
case NL80211_IFTYPE_STATION:
if (sdata->vif.type == NL80211_IFTYPE_STATION && if (!sdata->u.mgd.associated)
!sdata->u.mgd.associated) continue;
continue; break;
case NL80211_IFTYPE_ADHOC:
if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {
if (!sdata->u.ibss.ssid_len) if (!sdata->u.ibss.ssid_len)
continue; continue;
if (!sdata->u.ibss.fixed_channel) if (!sdata->u.ibss.fixed_channel)
return CHAN_MODE_HOPPING; return CHAN_MODE_HOPPING;
} break;
case NL80211_IFTYPE_AP_VLAN:
if (sdata->vif.type == NL80211_IFTYPE_AP && /* will also have _AP interface */
!sdata->u.ap.beacon)
continue; continue;
case NL80211_IFTYPE_AP:
if (!sdata->u.ap.beacon)
continue;
break;
default:
break;
}
return CHAN_MODE_FIXED; return CHAN_MODE_FIXED;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment