4dfaeafbeffa21dbd0ea53b4665064c9a1f54d6b
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 410-ath9k-get-rid-of-unnecessary-setpower-calls.patch
1 From 349626c9a263b41822a0c5a29061964b4a71ec3f Mon Sep 17 00:00:00 2001
2 From: Gabor Juhos <juhosg@openwrt.org>
3 Date: Thu, 23 Jul 2009 09:55:52 +0200
4 Subject: [PATCH 2/2] ath9k: get rid of unnecessary setpower calls
5
6 We are using setpower routines regardless of the current power mode.
7 Don't bother the hardware, if it is not necessary.
8
9 Changes-licensed-under: ISC
10 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
11 ---
12 drivers/net/wireless/ath/ath9k/hw.c | 8 ++++++--
13 1 files changed, 6 insertions(+), 2 deletions(-)
14
15 --- a/drivers/net/wireless/ath/ath9k/hw.c
16 +++ b/drivers/net/wireless/ath/ath9k/hw.c
17 @@ -475,6 +475,8 @@ static struct ath_hw *ath9k_hw_newstate(
18
19 ah->gbeacon_rate = 0;
20
21 + ah->power_mode = ATH9K_PM_UNDEFINED;
22 +
23 return ah;
24 }
25
26 @@ -2749,6 +2751,9 @@ static bool ath9k_hw_setpower_nolock(str
27 "UNDEFINED"
28 };
29
30 + if (ah->power_mode == mode)
31 + return status;
32 +
33 DPRINTF(ah->ah_sc, ATH_DBG_RESET, "%s -> %s\n",
34 modes[ah->power_mode], modes[mode]);
35
36 @@ -2793,8 +2798,7 @@ void ath9k_ps_wakeup(struct ath_softc *s
37 if (++sc->ps_usecount != 1)
38 goto unlock;
39
40 - if (sc->sc_ah->power_mode != ATH9K_PM_AWAKE)
41 - ath9k_hw_setpower_nolock(sc->sc_ah, ATH9K_PM_AWAKE);
42 + ath9k_hw_setpower_nolock(sc->sc_ah, ATH9K_PM_AWAKE);
43
44 unlock:
45 spin_unlock_irqrestore(&sc->sc_pm_lock, flags);