diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2009-09-09 23:29:18 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-10-07 16:39:24 -0400 |
commit | a91d75aec19d8d23c7c543dd4bc0e394e1d46867 (patch) | |
tree | 5a15b23eda7b3449a3b055652ed94156f3f2861c | |
parent | 21526d57ad98635fe12dc8efe46a3d992439a443 (diff) |
ath9k: move ath9k_ps_wakeup() and ath9k_ps_restore() to main.c
These are driver core helpers.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.c | 36 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.h | 6 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/main.c | 33 |
3 files changed, 38 insertions, 37 deletions
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 0893f23adaa8..82c91e5883d9 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -2932,8 +2932,7 @@ static bool ath9k_hw_set_power_awake(struct ath_hw *ah, int setChip) | |||
2932 | return true; | 2932 | return true; |
2933 | } | 2933 | } |
2934 | 2934 | ||
2935 | static bool ath9k_hw_setpower_nolock(struct ath_hw *ah, | 2935 | bool ath9k_hw_setpower_nolock(struct ath_hw *ah, enum ath9k_power_mode mode) |
2936 | enum ath9k_power_mode mode) | ||
2937 | { | 2936 | { |
2938 | int status = true, setChip = true; | 2937 | int status = true, setChip = true; |
2939 | static const char *modes[] = { | 2938 | static const char *modes[] = { |
@@ -2982,39 +2981,6 @@ bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode) | |||
2982 | return ret; | 2981 | return ret; |
2983 | } | 2982 | } |
2984 | 2983 | ||
2985 | void ath9k_ps_wakeup(struct ath_softc *sc) | ||
2986 | { | ||
2987 | unsigned long flags; | ||
2988 | |||
2989 | spin_lock_irqsave(&sc->sc_pm_lock, flags); | ||
2990 | if (++sc->ps_usecount != 1) | ||
2991 | goto unlock; | ||
2992 | |||
2993 | ath9k_hw_setpower_nolock(sc->sc_ah, ATH9K_PM_AWAKE); | ||
2994 | |||
2995 | unlock: | ||
2996 | spin_unlock_irqrestore(&sc->sc_pm_lock, flags); | ||
2997 | } | ||
2998 | |||
2999 | void ath9k_ps_restore(struct ath_softc *sc) | ||
3000 | { | ||
3001 | unsigned long flags; | ||
3002 | |||
3003 | spin_lock_irqsave(&sc->sc_pm_lock, flags); | ||
3004 | if (--sc->ps_usecount != 0) | ||
3005 | goto unlock; | ||
3006 | |||
3007 | if (sc->ps_enabled && | ||
3008 | !(sc->sc_flags & (SC_OP_WAIT_FOR_BEACON | | ||
3009 | SC_OP_WAIT_FOR_CAB | | ||
3010 | SC_OP_WAIT_FOR_PSPOLL_DATA | | ||
3011 | SC_OP_WAIT_FOR_TX_ACK))) | ||
3012 | ath9k_hw_setpower_nolock(sc->sc_ah, ATH9K_PM_NETWORK_SLEEP); | ||
3013 | |||
3014 | unlock: | ||
3015 | spin_unlock_irqrestore(&sc->sc_pm_lock, flags); | ||
3016 | } | ||
3017 | |||
3018 | /* | 2984 | /* |
3019 | * Helper for ASPM support. | 2985 | * Helper for ASPM support. |
3020 | * | 2986 | * |
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index 4d187aa8b8d2..01a127b01724 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -652,8 +652,10 @@ void ath9k_hw_set11nmac2040(struct ath_hw *ah, enum ath9k_ht_macmode mode); | |||
652 | void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period); | 652 | void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period); |
653 | void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah, | 653 | void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah, |
654 | const struct ath9k_beacon_state *bs); | 654 | const struct ath9k_beacon_state *bs); |
655 | bool ath9k_hw_setpower(struct ath_hw *ah, | 655 | |
656 | enum ath9k_power_mode mode); | 656 | bool ath9k_hw_setpower_nolock(struct ath_hw *ah, enum ath9k_power_mode mode); |
657 | bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode); | ||
658 | |||
657 | void ath9k_hw_configpcipowersave(struct ath_hw *ah, int restore, int power_off); | 659 | void ath9k_hw_configpcipowersave(struct ath_hw *ah, int restore, int power_off); |
658 | 660 | ||
659 | /* Interrupt Handling */ | 661 | /* Interrupt Handling */ |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index fe2888e4b8e9..9f9ac5b52acb 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -243,6 +243,39 @@ static struct ath9k_channel *ath_get_curchannel(struct ath_softc *sc, | |||
243 | return channel; | 243 | return channel; |
244 | } | 244 | } |
245 | 245 | ||
246 | void ath9k_ps_wakeup(struct ath_softc *sc) | ||
247 | { | ||
248 | unsigned long flags; | ||
249 | |||
250 | spin_lock_irqsave(&sc->sc_pm_lock, flags); | ||
251 | if (++sc->ps_usecount != 1) | ||
252 | goto unlock; | ||
253 | |||
254 | ath9k_hw_setpower_nolock(sc->sc_ah, ATH9K_PM_AWAKE); | ||
255 | |||
256 | unlock: | ||
257 | spin_unlock_irqrestore(&sc->sc_pm_lock, flags); | ||
258 | } | ||
259 | |||
260 | void ath9k_ps_restore(struct ath_softc *sc) | ||
261 | { | ||
262 | unsigned long flags; | ||
263 | |||
264 | spin_lock_irqsave(&sc->sc_pm_lock, flags); | ||
265 | if (--sc->ps_usecount != 0) | ||
266 | goto unlock; | ||
267 | |||
268 | if (sc->ps_enabled && | ||
269 | !(sc->sc_flags & (SC_OP_WAIT_FOR_BEACON | | ||
270 | SC_OP_WAIT_FOR_CAB | | ||
271 | SC_OP_WAIT_FOR_PSPOLL_DATA | | ||
272 | SC_OP_WAIT_FOR_TX_ACK))) | ||
273 | ath9k_hw_setpower_nolock(sc->sc_ah, ATH9K_PM_NETWORK_SLEEP); | ||
274 | |||
275 | unlock: | ||
276 | spin_unlock_irqrestore(&sc->sc_pm_lock, flags); | ||
277 | } | ||
278 | |||
246 | /* | 279 | /* |
247 | * Set/change channels. If the channel is really being changed, it's done | 280 | * Set/change channels. If the channel is really being changed, it's done |
248 | * by reseting the chip. To accomplish this we must first cleanup any pending | 281 | * by reseting the chip. To accomplish this we must first cleanup any pending |