提交 7f1f9742 编写于 作者: S Stanislaw Gruszka 提交者: John W. Linville

iwlegacy: refactor iwl4965_mac_channel_switch

Use less indentions and remove uneeded irq-save flags.
Signed-off-by: NStanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 0d01550f
...@@ -2510,7 +2510,6 @@ void iwl4965_mac_channel_switch(struct ieee80211_hw *hw, ...@@ -2510,7 +2510,6 @@ void iwl4965_mac_channel_switch(struct ieee80211_hw *hw,
struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
u16 ch; u16 ch;
unsigned long flags = 0;
IWL_DEBUG_MAC80211(priv, "enter\n"); IWL_DEBUG_MAC80211(priv, "enter\n");
...@@ -2527,64 +2526,64 @@ void iwl4965_mac_channel_switch(struct ieee80211_hw *hw, ...@@ -2527,64 +2526,64 @@ void iwl4965_mac_channel_switch(struct ieee80211_hw *hw,
if (!iwl_legacy_is_associated_ctx(ctx)) if (!iwl_legacy_is_associated_ctx(ctx))
goto out; goto out;
if (priv->cfg->ops->lib->set_channel_switch) { if (priv->cfg->ops->lib->set_channel_switch)
goto out;
ch = channel->hw_value; ch = channel->hw_value;
if (le16_to_cpu(ctx->active.channel) != ch) { if (le16_to_cpu(ctx->active.channel) == ch)
ch_info = iwl_legacy_get_channel_info(priv, goto out;
channel->band,
ch); ch_info = iwl_legacy_get_channel_info(priv, channel->band, ch);
if (!iwl_legacy_is_channel_valid(ch_info)) { if (!iwl_legacy_is_channel_valid(ch_info)) {
IWL_DEBUG_MAC80211(priv, "invalid channel\n"); IWL_DEBUG_MAC80211(priv, "invalid channel\n");
goto out; goto out;
} }
spin_lock_irqsave(&priv->lock, flags);
spin_lock(&priv->lock);
priv->current_ht_config.smps = conf->smps_mode;
priv->current_ht_config.smps = conf->smps_mode;
/* Configure HT40 channels */
ctx->ht.enabled = conf_is_ht(conf); /* Configure HT40 channels */
if (ctx->ht.enabled) { ctx->ht.enabled = conf_is_ht(conf);
if (conf_is_ht40_minus(conf)) { if (ctx->ht.enabled) {
ctx->ht.extension_chan_offset = if (conf_is_ht40_minus(conf)) {
IEEE80211_HT_PARAM_CHA_SEC_BELOW; ctx->ht.extension_chan_offset =
ctx->ht.is_40mhz = true; IEEE80211_HT_PARAM_CHA_SEC_BELOW;
} else if (conf_is_ht40_plus(conf)) { ctx->ht.is_40mhz = true;
ctx->ht.extension_chan_offset = } else if (conf_is_ht40_plus(conf)) {
IEEE80211_HT_PARAM_CHA_SEC_ABOVE; ctx->ht.extension_chan_offset =
ctx->ht.is_40mhz = true; IEEE80211_HT_PARAM_CHA_SEC_ABOVE;
} else { ctx->ht.is_40mhz = true;
ctx->ht.extension_chan_offset = } else {
IEEE80211_HT_PARAM_CHA_SEC_NONE; ctx->ht.extension_chan_offset =
ctx->ht.is_40mhz = false; IEEE80211_HT_PARAM_CHA_SEC_NONE;
} ctx->ht.is_40mhz = false;
} else
ctx->ht.is_40mhz = false;
if ((le16_to_cpu(ctx->staging.channel) != ch))
ctx->staging.flags = 0;
iwl_legacy_set_rxon_channel(priv, channel, ctx);
iwl_legacy_set_rxon_ht(priv, ht_conf);
iwl_legacy_set_flags_for_band(priv, ctx, channel->band,
ctx->vif);
spin_unlock_irqrestore(&priv->lock, flags);
iwl_legacy_set_rate(priv);
/*
* at this point, staging_rxon has the
* configuration for channel switch
*/
set_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status);
priv->switch_channel = cpu_to_le16(ch);
if (priv->cfg->ops->lib->set_channel_switch(priv, ch_switch)) {
clear_bit(STATUS_CHANNEL_SWITCH_PENDING,
&priv->status);
priv->switch_channel = 0;
ieee80211_chswitch_done(ctx->vif, false);
}
} }
} else
ctx->ht.is_40mhz = false;
if ((le16_to_cpu(ctx->staging.channel) != ch))
ctx->staging.flags = 0;
iwl_legacy_set_rxon_channel(priv, channel, ctx);
iwl_legacy_set_rxon_ht(priv, ht_conf);
iwl_legacy_set_flags_for_band(priv, ctx, channel->band, ctx->vif);
spin_unlock_irq(&priv->lock);
iwl_legacy_set_rate(priv);
/*
* at this point, staging_rxon has the
* configuration for channel switch
*/
set_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status);
priv->switch_channel = cpu_to_le16(ch);
if (priv->cfg->ops->lib->set_channel_switch(priv, ch_switch)) {
clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status);
priv->switch_channel = 0;
ieee80211_chswitch_done(ctx->vif, false);
} }
out: out:
mutex_unlock(&priv->mutex); mutex_unlock(&priv->mutex);
IWL_DEBUG_MAC80211(priv, "leave\n"); IWL_DEBUG_MAC80211(priv, "leave\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册