aboutsummaryrefslogtreecommitdiff
path: root/net/mac80211/ieee80211_ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/ieee80211_ioctl.c')
-rw-r--r--net/mac80211/ieee80211_ioctl.c31
1 files changed, 5 insertions, 26 deletions
diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c
index 1d91575a0fe..5af23d31872 100644
--- a/net/mac80211/ieee80211_ioctl.c
+++ b/net/mac80211/ieee80211_ioctl.c
@@ -279,36 +279,15 @@ static int ieee80211_ioctl_giwmode(struct net_device *dev,
int ieee80211_set_freq(struct ieee80211_local *local, int freqMHz)
{
- int set = 0;
int ret = -EINVAL;
- enum ieee80211_band band;
- struct ieee80211_supported_band *sband;
- int i;
-
- for (band = 0; band < IEEE80211_NUM_BANDS; band ++) {
- sband = local->hw.wiphy->bands[band];
+ struct ieee80211_channel *chan;
- if (!sband)
- continue;
+ chan = ieee80211_get_channel(local->hw.wiphy, freqMHz);
- for (i = 0; i < sband->n_channels; i++) {
- struct ieee80211_channel *chan = &sband->channels[i];
-
- if (chan->flags & IEEE80211_CHAN_DISABLED)
- continue;
-
- if (chan->center_freq == freqMHz) {
- set = 1;
- local->oper_channel = chan;
- break;
- }
- }
- if (set)
- break;
- }
+ if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) {
+ local->oper_channel = chan;
- if (set) {
- if (local->sta_sw_scanning)
+ if (local->sta_sw_scanning || local->sta_hw_scanning)
ret = 0;
else
ret = ieee80211_hw_config(local);