1 --- a/drivers/net/wireless/ath/ath9k/main.c
2 +++ b/drivers/net/wireless/ath/ath9k/main.c
3 @@ -122,6 +122,7 @@ bool ath9k_setpower(struct ath_softc *sc
5 void ath9k_ps_wakeup(struct ath_softc *sc)
7 + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
10 spin_lock_irqsave(&sc->sc_pm_lock, flags);
11 @@ -130,18 +131,33 @@ void ath9k_ps_wakeup(struct ath_softc *s
13 ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE);
16 + * While the hardware is asleep, the cycle counters contain no
17 + * useful data. Better clear them now so that they don't mess up the
18 + * ANI or survey data results.
20 + spin_lock(&common->cc_lock);
21 + ath_hw_cycle_counters_update(common);
22 + memset(&common->cc_survey, 0, sizeof(common->cc_survey));
23 + spin_unlock(&common->cc_lock);
26 spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
29 void ath9k_ps_restore(struct ath_softc *sc)
31 + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
34 spin_lock_irqsave(&sc->sc_pm_lock, flags);
35 if (--sc->ps_usecount != 0)
38 + spin_lock(&common->cc_lock);
39 + ath_hw_cycle_counters_update(common);
40 + spin_unlock(&common->cc_lock);
43 ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_FULL_SLEEP);
44 else if (sc->ps_enabled &&
45 @@ -197,7 +213,8 @@ static void ath_update_survey_stats(stru
46 struct ath_cycle_counters *cc = &common->cc_survey;
47 unsigned int div = common->clockrate * 1000;
49 - ath_hw_cycle_counters_update(common);
50 + if (ah->power_mode == ATH9K_PM_AWAKE)
51 + ath_hw_cycle_counters_update(common);
54 survey->filled |= SURVEY_INFO_CHANNEL_TIME |