]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/net/wireless/ath/ath9k/main.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-2.6-mn10300
[karo-tx-linux.git] / drivers / net / wireless / ath / ath9k / main.c
index 74ff51d4c339b3fa8f5c39cd60343447e872b660..c6ec800d7a6b6ef4fe91cc00ccffdb543d3504d0 100644 (file)
 #include "ath9k.h"
 #include "btcoex.h"
 
-static void ath_cache_conf_rate(struct ath_softc *sc,
-                               struct ieee80211_conf *conf)
-{
-       switch (conf->channel->band) {
-       case IEEE80211_BAND_2GHZ:
-               if (conf_is_ht20(conf))
-                       sc->cur_rate_mode = ATH9K_MODE_11NG_HT20;
-               else if (conf_is_ht40_minus(conf))
-                       sc->cur_rate_mode = ATH9K_MODE_11NG_HT40MINUS;
-               else if (conf_is_ht40_plus(conf))
-                       sc->cur_rate_mode = ATH9K_MODE_11NG_HT40PLUS;
-               else
-                       sc->cur_rate_mode = ATH9K_MODE_11G;
-               break;
-       case IEEE80211_BAND_5GHZ:
-               if (conf_is_ht20(conf))
-                       sc->cur_rate_mode = ATH9K_MODE_11NA_HT20;
-               else if (conf_is_ht40_minus(conf))
-                       sc->cur_rate_mode = ATH9K_MODE_11NA_HT40MINUS;
-               else if (conf_is_ht40_plus(conf))
-                       sc->cur_rate_mode = ATH9K_MODE_11NA_HT40PLUS;
-               else
-                       sc->cur_rate_mode = ATH9K_MODE_11A;
-               break;
-       default:
-               BUG_ON(1);
-               break;
-       }
-}
-
 static void ath_update_txpow(struct ath_softc *sc)
 {
        struct ath_hw *ah = sc->sc_ah;
@@ -212,6 +182,9 @@ static void ath_update_survey_stats(struct ath_softc *sc)
        struct ath_cycle_counters *cc = &common->cc_survey;
        unsigned int div = common->clockrate * 1000;
 
+       if (!ah->curchan)
+               return;
+
        if (ah->power_mode == ATH9K_PM_AWAKE)
                ath_hw_cycle_counters_update(common);
 
@@ -306,7 +279,6 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw,
                goto ps_restore;
        }
 
-       ath_cache_conf_rate(sc, &hw->conf);
        ath_update_txpow(sc);
        ath9k_hw_set_interrupts(ah, ah->imask);
 
@@ -608,7 +580,7 @@ void ath_hw_check(struct work_struct *work)
 
                msleep(1);
        }
-       ath_reset(sc, false);
+       ath_reset(sc, true);
 
 out:
        ath9k_ps_restore(sc);
@@ -626,7 +598,7 @@ void ath9k_tasklet(unsigned long data)
        ath9k_ps_wakeup(sc);
 
        if (status & ATH9K_INT_FATAL) {
-               ath_reset(sc, false);
+               ath_reset(sc, true);
                ath9k_ps_restore(sc);
                return;
        }
@@ -779,7 +751,9 @@ irqreturn_t ath_isr(int irq, void *dev)
                 * it will clear whatever condition caused
                 * the interrupt.
                 */
+               spin_lock(&common->cc_lock);
                ath9k_hw_proc_mib_event(ah);
+               spin_unlock(&common->cc_lock);
                ath9k_hw_set_interrupts(ah, ah->imask);
        }
 
@@ -1011,8 +985,6 @@ int ath_reset(struct ath_softc *sc, bool retry_tx)
         * that changes the channel so update any state that
         * might change as a result.
         */
-       ath_cache_conf_rate(sc, &hw->conf);
-
        ath_update_txpow(sc);
 
        if ((sc->sc_flags & SC_OP_BEACONS) || !(sc->sc_flags & (SC_OP_OFFCHANNEL)))
@@ -1219,8 +1191,6 @@ static int ath9k_start(struct ieee80211_hw *hw)
        if (ah->caps.hw_caps & ATH9K_HW_CAP_HT)
                ah->imask |= ATH9K_INT_CST;
 
-       ath_cache_conf_rate(sc, &hw->conf);
-
        sc->sc_flags &= ~SC_OP_INVALID;
 
        /* Disable BMISS interrupt when we're not associated */