4ee5f7359e140333cafca7c30f06106c78fd13eb
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 590-ath9k_fix_cycle_counter_ps.patch
1 --- a/drivers/net/wireless/ath/ath9k/main.c
2 +++ b/drivers/net/wireless/ath/ath9k/main.c
3 @@ -94,11 +94,13 @@ void ath9k_ps_wakeup(struct ath_softc *s
4 {
5 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
6 unsigned long flags;
7 + enum ath9k_power_mode power_mode;
8
9 spin_lock_irqsave(&sc->sc_pm_lock, flags);
10 if (++sc->ps_usecount != 1)
11 goto unlock;
12
13 + power_mode = sc->sc_ah->power_mode;
14 ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE);
15
16 /*
17 @@ -106,10 +108,12 @@ void ath9k_ps_wakeup(struct ath_softc *s
18 * useful data. Better clear them now so that they don't mess up
19 * survey data results.
20 */
21 - spin_lock(&common->cc_lock);
22 - ath_hw_cycle_counters_update(common);
23 - memset(&common->cc_survey, 0, sizeof(common->cc_survey));
24 - spin_unlock(&common->cc_lock);
25 + if (power_mode != ATH9K_PM_AWAKE) {
26 + spin_lock(&common->cc_lock);
27 + ath_hw_cycle_counters_update(common);
28 + memset(&common->cc_survey, 0, sizeof(common->cc_survey));
29 + spin_unlock(&common->cc_lock);
30 + }
31
32 unlock:
33 spin_unlock_irqrestore(&sc->sc_pm_lock, flags);