Commit d9b9d940 authored by Johannes Berg's avatar Johannes Berg

iwlwifi: use mac80211 channels for reset scan

Instead of iterating our own channel list,
use the mac80211 channel list since that's
already processed per band and thus makes
for less code.
Reviewed-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 9dc216d7
...@@ -447,27 +447,17 @@ static u16 iwl_get_passive_dwell_time(struct iwl_priv *priv, ...@@ -447,27 +447,17 @@ static u16 iwl_get_passive_dwell_time(struct iwl_priv *priv,
/* Return valid, unused, channel for a passive scan to reset the RF */ /* Return valid, unused, channel for a passive scan to reset the RF */
static u8 iwl_get_single_channel_number(struct iwl_priv *priv, static u8 iwl_get_single_channel_number(struct iwl_priv *priv,
enum ieee80211_band band) enum ieee80211_band band)
{ {
const struct iwl_channel_info *ch_info; struct ieee80211_supported_band *sband = priv->hw->wiphy->bands[band];
int i;
u8 channel = 0;
u8 min, max;
struct iwl_rxon_context *ctx; struct iwl_rxon_context *ctx;
int i;
if (band == IEEE80211_BAND_5GHZ) { for (i = 0; i < sband->n_channels; i++) {
min = 14;
max = priv->channel_count;
} else {
min = 0;
max = 14;
}
for (i = min; i < max; i++) {
bool busy = false; bool busy = false;
for_each_context(priv, ctx) { for_each_context(priv, ctx) {
busy = priv->channel_info[i].channel == busy = sband->channels[i].hw_value ==
le16_to_cpu(ctx->staging.channel); le16_to_cpu(ctx->staging.channel);
if (busy) if (busy)
break; break;
...@@ -476,13 +466,11 @@ static u8 iwl_get_single_channel_number(struct iwl_priv *priv, ...@@ -476,13 +466,11 @@ static u8 iwl_get_single_channel_number(struct iwl_priv *priv,
if (busy) if (busy)
continue; continue;
channel = priv->channel_info[i].channel; if (!(sband->channels[i].flags & IEEE80211_CHAN_DISABLED))
ch_info = iwl_get_channel_info(priv, band, channel); return sband->channels[i].hw_value;
if (is_channel_valid(ch_info))
break;
} }
return channel; return 0;
} }
static int iwl_get_single_channel_for_scan(struct iwl_priv *priv, static int iwl_get_single_channel_for_scan(struct iwl_priv *priv,
......
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