Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab...
[pandora-kernel.git] / drivers / net / wireless / iwlegacy / iwl-core.c
index 42db0fc..3be76bd 100644 (file)
@@ -211,10 +211,7 @@ int iwl_legacy_init_geos(struct iwl_priv *priv)
                if (!iwl_legacy_is_channel_valid(ch))
                        continue;
 
-               if (iwl_legacy_is_channel_a_band(ch))
-                       sband =  &priv->bands[IEEE80211_BAND_5GHZ];
-               else
-                       sband =  &priv->bands[IEEE80211_BAND_2GHZ];
+               sband = &priv->bands[ch->band];
 
                geo_ch = &sband->channels[sband->n_channels++];
 
@@ -862,12 +859,8 @@ void iwl_legacy_chswitch_done(struct iwl_priv *priv, bool is_success)
        if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return;
 
-       if (priv->switch_rxon.switch_in_progress) {
+       if (test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
                ieee80211_chswitch_done(ctx->vif, is_success);
-               mutex_lock(&priv->mutex);
-               priv->switch_rxon.switch_in_progress = false;
-               mutex_unlock(&priv->mutex);
-       }
 }
 EXPORT_SYMBOL(iwl_legacy_chswitch_done);
 
@@ -879,19 +872,19 @@ void iwl_legacy_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
        struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
        struct iwl_legacy_rxon_cmd *rxon = (void *)&ctx->active;
 
-       if (priv->switch_rxon.switch_in_progress) {
-               if (!le32_to_cpu(csa->status) &&
-                   (csa->channel == priv->switch_rxon.channel)) {
-                       rxon->channel = csa->channel;
-                       ctx->staging.channel = csa->channel;
-                       IWL_DEBUG_11H(priv, "CSA notif: channel %d\n",
-                             le16_to_cpu(csa->channel));
-                       iwl_legacy_chswitch_done(priv, true);
-               } else {
-                       IWL_ERR(priv, "CSA notif (fail) : channel %d\n",
+       if (!test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
+               return;
+
+       if (!le32_to_cpu(csa->status) && csa->channel == priv->switch_channel) {
+               rxon->channel = csa->channel;
+               ctx->staging.channel = csa->channel;
+               IWL_DEBUG_11H(priv, "CSA notif: channel %d\n",
                              le16_to_cpu(csa->channel));
-                       iwl_legacy_chswitch_done(priv, false);
-               }
+               iwl_legacy_chswitch_done(priv, true);
+       } else {
+               IWL_ERR(priv, "CSA notif (fail) : channel %d\n",
+                       le16_to_cpu(csa->channel));
+               iwl_legacy_chswitch_done(priv, false);
        }
 }
 EXPORT_SYMBOL(iwl_legacy_rx_csa);
@@ -2117,10 +2110,9 @@ int iwl_legacy_mac_config(struct ieee80211_hw *hw, u32 changed)
        IWL_DEBUG_MAC80211(priv, "enter to channel %d changed 0x%X\n",
                                        channel->hw_value, changed);
 
-       if (unlikely(!priv->cfg->mod_params->disable_hw_scan &&
-                       test_bit(STATUS_SCANNING, &priv->status))) {
+       if (unlikely(test_bit(STATUS_SCANNING, &priv->status))) {
                scan_active = 1;
-               IWL_DEBUG_MAC80211(priv, "leave - scanning\n");
+               IWL_DEBUG_MAC80211(priv, "scan active\n");
        }
 
        if (changed & (IEEE80211_CONF_CHANGE_SMPS |
@@ -2440,11 +2432,13 @@ void iwl_legacy_mac_bss_info_changed(struct ieee80211_hw *hw,
 
        IWL_DEBUG_MAC80211(priv, "changes = 0x%X\n", changes);
 
-       if (!iwl_legacy_is_alive(priv))
-               return;
-
        mutex_lock(&priv->mutex);
 
+       if (!iwl_legacy_is_alive(priv)) {
+               mutex_unlock(&priv->mutex);
+               return;
+       }
+
        if (changes & BSS_CHANGED_QOS) {
                unsigned long flags;
 
@@ -2653,7 +2647,7 @@ unplugged:
 
 none:
        /* re-enable interrupts here since we don't have anything to service. */
-       /* only Re-enable if diabled by irq */
+       /* only Re-enable if disabled by irq */
        if (test_bit(STATUS_INT_ENABLED, &priv->status))
                iwl_legacy_enable_interrupts(priv);
        spin_unlock_irqrestore(&priv->lock, flags);