aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2011-06-02 10:46:20 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-06-07 14:44:02 -0400
commitf973f87ec13e82256d45e11b204a8e3fb3808635 (patch)
treed18dbdf141824eb12a290c4b364fa61deb02ac03 /drivers
parent70559a06657c55aeefe2f06619d3592a08cc68ac (diff)
iwlagn: refactor iwlagn_mac_channel_switch
Use less indentions and remove uneeded irq-save flags. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Acked-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c106
1 files changed, 52 insertions, 54 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 0b2d2cd4b54a..099c2795ec0b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -2916,7 +2916,6 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw,
2916 */ 2916 */
2917 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 2917 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
2918 u16 ch; 2918 u16 ch;
2919 unsigned long flags = 0;
2920 2919
2921 IWL_DEBUG_MAC80211(priv, "enter\n"); 2920 IWL_DEBUG_MAC80211(priv, "enter\n");
2922 2921
@@ -2933,65 +2932,64 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw,
2933 if (!iwl_is_associated_ctx(ctx)) 2932 if (!iwl_is_associated_ctx(ctx))
2934 goto out; 2933 goto out;
2935 2934
2936 if (priv->cfg->ops->lib->set_channel_switch) { 2935 if (!priv->cfg->ops->lib->set_channel_switch)
2936 goto out;
2937 2937
2938 ch = channel->hw_value; 2938 ch = channel->hw_value;
2939 if (le16_to_cpu(ctx->active.channel) != ch) { 2939 if (le16_to_cpu(ctx->active.channel) == ch)
2940 ch_info = iwl_get_channel_info(priv, 2940 goto out;
2941 channel->band, 2941
2942 ch); 2942 ch_info = iwl_get_channel_info(priv, channel->band, ch);
2943 if (!is_channel_valid(ch_info)) { 2943 if (!is_channel_valid(ch_info)) {
2944 IWL_DEBUG_MAC80211(priv, "invalid channel\n"); 2944 IWL_DEBUG_MAC80211(priv, "invalid channel\n");
2945 goto out; 2945 goto out;
2946 } 2946 }
2947 spin_lock_irqsave(&priv->lock, flags);
2948
2949 priv->current_ht_config.smps = conf->smps_mode;
2950
2951 /* Configure HT40 channels */
2952 ctx->ht.enabled = conf_is_ht(conf);
2953 if (ctx->ht.enabled) {
2954 if (conf_is_ht40_minus(conf)) {
2955 ctx->ht.extension_chan_offset =
2956 IEEE80211_HT_PARAM_CHA_SEC_BELOW;
2957 ctx->ht.is_40mhz = true;
2958 } else if (conf_is_ht40_plus(conf)) {
2959 ctx->ht.extension_chan_offset =
2960 IEEE80211_HT_PARAM_CHA_SEC_ABOVE;
2961 ctx->ht.is_40mhz = true;
2962 } else {
2963 ctx->ht.extension_chan_offset =
2964 IEEE80211_HT_PARAM_CHA_SEC_NONE;
2965 ctx->ht.is_40mhz = false;
2966 }
2967 } else
2968 ctx->ht.is_40mhz = false;
2969 2947
2970 if ((le16_to_cpu(ctx->staging.channel) != ch)) 2948 spin_lock_irq(&priv->lock);
2971 ctx->staging.flags = 0;
2972 2949
2973 iwl_set_rxon_channel(priv, channel, ctx); 2950 priv->current_ht_config.smps = conf->smps_mode;
2974 iwl_set_rxon_ht(priv, ht_conf);
2975 iwl_set_flags_for_band(priv, ctx, channel->band,
2976 ctx->vif);
2977 spin_unlock_irqrestore(&priv->lock, flags);
2978 2951
2979 iwl_set_rate(priv); 2952 /* Configure HT40 channels */
2980 /* 2953 ctx->ht.enabled = conf_is_ht(conf);
2981 * at this point, staging_rxon has the 2954 if (ctx->ht.enabled) {
2982 * configuration for channel switch 2955 if (conf_is_ht40_minus(conf)) {
2983 */ 2956 ctx->ht.extension_chan_offset =
2984 set_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status); 2957 IEEE80211_HT_PARAM_CHA_SEC_BELOW;
2985 priv->switch_channel = cpu_to_le16(ch); 2958 ctx->ht.is_40mhz = true;
2986 if (priv->cfg->ops->lib->set_channel_switch(priv, 2959 } else if (conf_is_ht40_plus(conf)) {
2987 ch_switch)) { 2960 ctx->ht.extension_chan_offset =
2988 clear_bit(STATUS_CHANNEL_SWITCH_PENDING, 2961 IEEE80211_HT_PARAM_CHA_SEC_ABOVE;
2989 &priv->status); 2962 ctx->ht.is_40mhz = true;
2990 priv->switch_channel = 0; 2963 } else {
2991 ieee80211_chswitch_done(ctx->vif, false); 2964 ctx->ht.extension_chan_offset =
2992 } 2965 IEEE80211_HT_PARAM_CHA_SEC_NONE;
2966 ctx->ht.is_40mhz = false;
2993 } 2967 }
2968 } else
2969 ctx->ht.is_40mhz = false;
2970
2971 if ((le16_to_cpu(ctx->staging.channel) != ch))
2972 ctx->staging.flags = 0;
2973
2974 iwl_set_rxon_channel(priv, channel, ctx);
2975 iwl_set_rxon_ht(priv, ht_conf);
2976 iwl_set_flags_for_band(priv, ctx, channel->band, ctx->vif);
2977
2978 spin_unlock_irq(&priv->lock);
2979
2980 iwl_set_rate(priv);
2981 /*
2982 * at this point, staging_rxon has the
2983 * configuration for channel switch
2984 */
2985 set_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status);
2986 priv->switch_channel = cpu_to_le16(ch);
2987 if (priv->cfg->ops->lib->set_channel_switch(priv, ch_switch)) {
2988 clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status);
2989 priv->switch_channel = 0;
2990 ieee80211_chswitch_done(ctx->vif, false);
2994 } 2991 }
2992
2995out: 2993out:
2996 mutex_unlock(&priv->mutex); 2994 mutex_unlock(&priv->mutex);
2997 IWL_DEBUG_MAC80211(priv, "leave\n"); 2995 IWL_DEBUG_MAC80211(priv, "leave\n");