diff options
author | Felix Fietkau <nbd@openwrt.org> | 2010-11-02 20:36:51 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-11-08 16:53:47 -0500 |
commit | fbb078fcd2fa83646ad9504d8e4c54a67b8729ae (patch) | |
tree | 3273b3cfdd9d45d63448fbbde1a4df08201ae700 /drivers/net/wireless | |
parent | 3cc25e510dfc36dc62ee0aa87344b36ed7c1742a (diff) |
ath9k: check old power mode before clearing cycle counters
ath9k_ps_wakeup() clears the cycle counters after waking up the
hardware using ath9k_hw_setpower, however if power save is disabled,
then the counters will contain useful data, which then gets discarded.
Fix this by checking the old power mode before discarding any data.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/main.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 09dcdd7882e6..25d3ef4c338e 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -94,11 +94,13 @@ void ath9k_ps_wakeup(struct ath_softc *sc) | |||
94 | { | 94 | { |
95 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 95 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
96 | unsigned long flags; | 96 | unsigned long flags; |
97 | enum ath9k_power_mode power_mode; | ||
97 | 98 | ||
98 | spin_lock_irqsave(&sc->sc_pm_lock, flags); | 99 | spin_lock_irqsave(&sc->sc_pm_lock, flags); |
99 | if (++sc->ps_usecount != 1) | 100 | if (++sc->ps_usecount != 1) |
100 | goto unlock; | 101 | goto unlock; |
101 | 102 | ||
103 | power_mode = sc->sc_ah->power_mode; | ||
102 | ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE); | 104 | ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE); |
103 | 105 | ||
104 | /* | 106 | /* |
@@ -106,10 +108,12 @@ void ath9k_ps_wakeup(struct ath_softc *sc) | |||
106 | * useful data. Better clear them now so that they don't mess up | 108 | * useful data. Better clear them now so that they don't mess up |
107 | * survey data results. | 109 | * survey data results. |
108 | */ | 110 | */ |
109 | spin_lock(&common->cc_lock); | 111 | if (power_mode != ATH9K_PM_AWAKE) { |
110 | ath_hw_cycle_counters_update(common); | 112 | spin_lock(&common->cc_lock); |
111 | memset(&common->cc_survey, 0, sizeof(common->cc_survey)); | 113 | ath_hw_cycle_counters_update(common); |
112 | spin_unlock(&common->cc_lock); | 114 | memset(&common->cc_survey, 0, sizeof(common->cc_survey)); |
115 | spin_unlock(&common->cc_lock); | ||
116 | } | ||
113 | 117 | ||
114 | unlock: | 118 | unlock: |
115 | spin_unlock_irqrestore(&sc->sc_pm_lock, flags); | 119 | spin_unlock_irqrestore(&sc->sc_pm_lock, flags); |