Commit f973f87e authored by Stanislaw Gruszka's avatar Stanislaw Gruszka Committed by John W. Linville

iwlagn: refactor iwlagn_mac_channel_switch

Use less indentions and remove uneeded irq-save flags.
Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
Acked-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 70559a06
...@@ -2916,7 +2916,6 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw, ...@@ -2916,7 +2916,6 @@ static void iwlagn_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");
...@@ -2933,18 +2932,20 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw, ...@@ -2933,18 +2932,20 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw,
if (!iwl_is_associated_ctx(ctx)) if (!iwl_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_get_channel_info(priv, goto out;
channel->band,
ch); ch_info = iwl_get_channel_info(priv, channel->band, ch);
if (!is_channel_valid(ch_info)) { if (!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_irq(&priv->lock);
priv->current_ht_config.smps = conf->smps_mode; priv->current_ht_config.smps = conf->smps_mode;
...@@ -2972,9 +2973,9 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw, ...@@ -2972,9 +2973,9 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw,
iwl_set_rxon_channel(priv, channel, ctx); iwl_set_rxon_channel(priv, channel, ctx);
iwl_set_rxon_ht(priv, ht_conf); iwl_set_rxon_ht(priv, ht_conf);
iwl_set_flags_for_band(priv, ctx, channel->band, iwl_set_flags_for_band(priv, ctx, channel->band, ctx->vif);
ctx->vif);
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irq(&priv->lock);
iwl_set_rate(priv); iwl_set_rate(priv);
/* /*
...@@ -2983,15 +2984,12 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw, ...@@ -2983,15 +2984,12 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw,
*/ */
set_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status); set_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status);
priv->switch_channel = cpu_to_le16(ch); priv->switch_channel = cpu_to_le16(ch);
if (priv->cfg->ops->lib->set_channel_switch(priv, if (priv->cfg->ops->lib->set_channel_switch(priv, ch_switch)) {
ch_switch)) { clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status);
clear_bit(STATUS_CHANNEL_SWITCH_PENDING,
&priv->status);
priv->switch_channel = 0; priv->switch_channel = 0;
ieee80211_chswitch_done(ctx->vif, false); 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%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment