aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2009-07-14 20:17:13 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-24 15:05:18 -0400
commit04717ccd80e5acc500239222684fcf8d2c759a84 (patch)
treea506fc7ab3bca88e39a54952b822006d97765920 /drivers
parentebaa24534ef54a8f665558536dbef3a761a9b841 (diff)
ath9k: serialize ath9k_hw_setpower calls
Because ath9k_setpower is called from various contexts, we have to protect it against concurrent calls. Changes-licensed-under: ISC Signed-off-by: Gabor Juhos <juhosg@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ath/ath9k/ath9k.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c15
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c1
3 files changed, 16 insertions, 1 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 20bf4a7f896d..b37eb592b524 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -559,6 +559,7 @@ struct ath_softc {
559 spinlock_t sc_resetlock; 559 spinlock_t sc_resetlock;
560 spinlock_t sc_serial_rw; 560 spinlock_t sc_serial_rw;
561 spinlock_t ani_lock; 561 spinlock_t ani_lock;
562 spinlock_t sc_pm_lock;
562 struct mutex mutex; 563 struct mutex mutex;
563 564
564 u8 curbssid[ETH_ALEN]; 565 u8 curbssid[ETH_ALEN];
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index a115c8ceabe3..6740a6b98a62 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -2728,7 +2728,8 @@ static bool ath9k_hw_set_power_awake(struct ath_hw *ah, int setChip)
2728 return true; 2728 return true;
2729} 2729}
2730 2730
2731bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode) 2731static bool ath9k_hw_setpower_nolock(struct ath_hw *ah,
2732 enum ath9k_power_mode mode)
2732{ 2733{
2733 int status = true, setChip = true; 2734 int status = true, setChip = true;
2734 static const char *modes[] = { 2735 static const char *modes[] = {
@@ -2762,6 +2763,18 @@ bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode)
2762 return status; 2763 return status;
2763} 2764}
2764 2765
2766bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode)
2767{
2768 unsigned long flags;
2769 bool ret;
2770
2771 spin_lock_irqsave(&ah->ah_sc->sc_pm_lock, flags);
2772 ret = ath9k_hw_setpower_nolock(ah, mode);
2773 spin_unlock_irqrestore(&ah->ah_sc->sc_pm_lock, flags);
2774
2775 return ret;
2776}
2777
2765/* 2778/*
2766 * Helper for ASPM support. 2779 * Helper for ASPM support.
2767 * 2780 *
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 90cecce8d5ff..d14f8c9cef68 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1316,6 +1316,7 @@ static int ath_init(u16 devid, struct ath_softc *sc)
1316 spin_lock_init(&sc->sc_resetlock); 1316 spin_lock_init(&sc->sc_resetlock);
1317 spin_lock_init(&sc->sc_serial_rw); 1317 spin_lock_init(&sc->sc_serial_rw);
1318 spin_lock_init(&sc->ani_lock); 1318 spin_lock_init(&sc->ani_lock);
1319 spin_lock_init(&sc->sc_pm_lock);
1319 mutex_init(&sc->mutex); 1320 mutex_init(&sc->mutex);
1320 tasklet_init(&sc->intr_tq, ath9k_tasklet, (unsigned long)sc); 1321 tasklet_init(&sc->intr_tq, ath9k_tasklet, (unsigned long)sc);
1321 tasklet_init(&sc->bcon_tasklet, ath_beacon_tasklet, 1322 tasklet_init(&sc->bcon_tasklet, ath_beacon_tasklet,