aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/main.c
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2009-09-09 23:29:18 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-10-07 16:39:24 -0400
commita91d75aec19d8d23c7c543dd4bc0e394e1d46867 (patch)
tree5a15b23eda7b3449a3b055652ed94156f3f2861c /drivers/net/wireless/ath/ath9k/main.c
parent21526d57ad98635fe12dc8efe46a3d992439a443 (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>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/main.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index fe2888e4b8e..9f9ac5b52ac 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
246void 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
260void 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