提交 9d94674a 编写于 作者: L Luis R. Rodriguez 提交者: John W. Linville

ath9k: simplify hw reset locking

The new PCU lock is better placed so we can just contend
against that when trying to reset hardware.

This is part of a series of patches which fix stopping
TX DMA completley when requested on the driver.
For more details about this issue refer to this thread:

http://marc.info/?l=linux-wireless&m=128629803703756&w=2Tested-by: NBen Greear <greearb@candelatech.com>
Cc: Kyungwan Nam <kyungwan.nam@atheros.com>
Cc: stable@kernel.org
Signed-off-by: NLuis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 5d4c4282
...@@ -599,7 +599,6 @@ struct ath_softc { ...@@ -599,7 +599,6 @@ struct ath_softc {
struct ath_hw *sc_ah; struct ath_hw *sc_ah;
void __iomem *mem; void __iomem *mem;
int irq; int irq;
spinlock_t sc_resetlock;
spinlock_t sc_serial_rw; spinlock_t sc_serial_rw;
spinlock_t sc_pm_lock; spinlock_t sc_pm_lock;
struct mutex mutex; struct mutex mutex;
......
...@@ -580,7 +580,6 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid, ...@@ -580,7 +580,6 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
spin_lock_init(&common->cc_lock); spin_lock_init(&common->cc_lock);
spin_lock_init(&sc->wiphy_lock); spin_lock_init(&sc->wiphy_lock);
spin_lock_init(&sc->sc_resetlock);
spin_lock_init(&sc->sc_serial_rw); spin_lock_init(&sc->sc_serial_rw);
spin_lock_init(&sc->sc_pm_lock); spin_lock_init(&sc->sc_pm_lock);
mutex_init(&sc->mutex); mutex_init(&sc->mutex);
......
...@@ -262,19 +262,15 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw, ...@@ -262,19 +262,15 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw,
channel->center_freq, conf_is_ht40(conf), channel->center_freq, conf_is_ht40(conf),
fastcc); fastcc);
spin_lock_bh(&sc->sc_resetlock);
r = ath9k_hw_reset(ah, hchan, caldata, fastcc); r = ath9k_hw_reset(ah, hchan, caldata, fastcc);
if (r) { if (r) {
ath_print(common, ATH_DBG_FATAL, ath_print(common, ATH_DBG_FATAL,
"Unable to reset channel (%u MHz), " "Unable to reset channel (%u MHz), "
"reset status %d\n", "reset status %d\n",
channel->center_freq, r); channel->center_freq, r);
spin_unlock_bh(&sc->sc_resetlock);
spin_unlock_bh(&sc->rx.pcu_lock); spin_unlock_bh(&sc->rx.pcu_lock);
goto ps_restore; goto ps_restore;
} }
spin_unlock_bh(&sc->sc_resetlock);
if (ath_startrecv(sc) != 0) { if (ath_startrecv(sc) != 0) {
ath_print(common, ATH_DBG_FATAL, ath_print(common, ATH_DBG_FATAL,
...@@ -886,7 +882,6 @@ void ath_radio_enable(struct ath_softc *sc, struct ieee80211_hw *hw) ...@@ -886,7 +882,6 @@ void ath_radio_enable(struct ath_softc *sc, struct ieee80211_hw *hw)
ah->curchan = ath_get_curchannel(sc, sc->hw); ah->curchan = ath_get_curchannel(sc, sc->hw);
spin_lock_bh(&sc->rx.pcu_lock); spin_lock_bh(&sc->rx.pcu_lock);
spin_lock_bh(&sc->sc_resetlock);
r = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false); r = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false);
if (r) { if (r) {
ath_print(common, ATH_DBG_FATAL, ath_print(common, ATH_DBG_FATAL,
...@@ -894,7 +889,6 @@ void ath_radio_enable(struct ath_softc *sc, struct ieee80211_hw *hw) ...@@ -894,7 +889,6 @@ void ath_radio_enable(struct ath_softc *sc, struct ieee80211_hw *hw)
"reset status %d\n", "reset status %d\n",
channel->center_freq, r); channel->center_freq, r);
} }
spin_unlock_bh(&sc->sc_resetlock);
ath_update_txpow(sc); ath_update_txpow(sc);
if (ath_startrecv(sc) != 0) { if (ath_startrecv(sc) != 0) {
...@@ -951,7 +945,6 @@ void ath_radio_disable(struct ath_softc *sc, struct ieee80211_hw *hw) ...@@ -951,7 +945,6 @@ void ath_radio_disable(struct ath_softc *sc, struct ieee80211_hw *hw)
if (!ah->curchan) if (!ah->curchan)
ah->curchan = ath_get_curchannel(sc, hw); ah->curchan = ath_get_curchannel(sc, hw);
spin_lock_bh(&sc->sc_resetlock);
r = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false); r = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false);
if (r) { if (r) {
ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_FATAL, ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_FATAL,
...@@ -959,7 +952,6 @@ void ath_radio_disable(struct ath_softc *sc, struct ieee80211_hw *hw) ...@@ -959,7 +952,6 @@ void ath_radio_disable(struct ath_softc *sc, struct ieee80211_hw *hw)
"reset status %d\n", "reset status %d\n",
channel->center_freq, r); channel->center_freq, r);
} }
spin_unlock_bh(&sc->sc_resetlock);
ath9k_hw_phy_disable(ah); ath9k_hw_phy_disable(ah);
...@@ -990,12 +982,10 @@ int ath_reset(struct ath_softc *sc, bool retry_tx) ...@@ -990,12 +982,10 @@ int ath_reset(struct ath_softc *sc, bool retry_tx)
ath_stoprecv(sc); ath_stoprecv(sc);
ath_flushrecv(sc); ath_flushrecv(sc);
spin_lock_bh(&sc->sc_resetlock);
r = ath9k_hw_reset(ah, sc->sc_ah->curchan, ah->caldata, false); r = ath9k_hw_reset(ah, sc->sc_ah->curchan, ah->caldata, false);
if (r) if (r)
ath_print(common, ATH_DBG_FATAL, ath_print(common, ATH_DBG_FATAL,
"Unable to reset hardware; reset status %d\n", r); "Unable to reset hardware; reset status %d\n", r);
spin_unlock_bh(&sc->sc_resetlock);
if (ath_startrecv(sc) != 0) if (ath_startrecv(sc) != 0)
ath_print(common, ATH_DBG_FATAL, ath_print(common, ATH_DBG_FATAL,
...@@ -1166,18 +1156,15 @@ static int ath9k_start(struct ieee80211_hw *hw) ...@@ -1166,18 +1156,15 @@ static int ath9k_start(struct ieee80211_hw *hw)
* and then setup of the interrupt mask. * and then setup of the interrupt mask.
*/ */
spin_lock_bh(&sc->rx.pcu_lock); spin_lock_bh(&sc->rx.pcu_lock);
spin_lock_bh(&sc->sc_resetlock);
r = ath9k_hw_reset(ah, init_channel, ah->caldata, false); r = ath9k_hw_reset(ah, init_channel, ah->caldata, false);
if (r) { if (r) {
ath_print(common, ATH_DBG_FATAL, ath_print(common, ATH_DBG_FATAL,
"Unable to reset hardware; reset status %d " "Unable to reset hardware; reset status %d "
"(freq %u MHz)\n", r, "(freq %u MHz)\n", r,
curchan->center_freq); curchan->center_freq);
spin_unlock_bh(&sc->sc_resetlock);
spin_unlock_bh(&sc->rx.pcu_lock); spin_unlock_bh(&sc->rx.pcu_lock);
goto mutex_unlock; goto mutex_unlock;
} }
spin_unlock_bh(&sc->sc_resetlock);
/* /*
* This is needed only to setup initial state * This is needed only to setup initial state
...@@ -1398,14 +1385,17 @@ static void ath9k_stop(struct ieee80211_hw *hw) ...@@ -1398,14 +1385,17 @@ static void ath9k_stop(struct ieee80211_hw *hw)
* before setting the invalid flag. */ * before setting the invalid flag. */
ath9k_hw_disable_interrupts(ah); ath9k_hw_disable_interrupts(ah);
spin_lock_bh(&sc->rx.pcu_lock);
if (!(sc->sc_flags & SC_OP_INVALID)) { if (!(sc->sc_flags & SC_OP_INVALID)) {
ath_drain_all_txq(sc, false); ath_drain_all_txq(sc, false);
spin_lock_bh(&sc->rx.pcu_lock);
ath_stoprecv(sc); ath_stoprecv(sc);
ath9k_hw_phy_disable(ah); ath9k_hw_phy_disable(ah);
} else spin_unlock_bh(&sc->rx.pcu_lock);
} else {
spin_lock_bh(&sc->rx.pcu_lock);
sc->rx.rxlink = NULL; sc->rx.rxlink = NULL;
spin_unlock_bh(&sc->rx.pcu_lock); spin_unlock_bh(&sc->rx.pcu_lock);
}
/* disable HAL and put h/w to sleep */ /* disable HAL and put h/w to sleep */
ath9k_hw_disable(ah); ath9k_hw_disable(ah);
......
...@@ -1148,13 +1148,13 @@ void ath_drain_all_txq(struct ath_softc *sc, bool retry_tx) ...@@ -1148,13 +1148,13 @@ void ath_drain_all_txq(struct ath_softc *sc, bool retry_tx)
ath_print(common, ATH_DBG_FATAL, ath_print(common, ATH_DBG_FATAL,
"Failed to stop TX DMA. Resetting hardware!\n"); "Failed to stop TX DMA. Resetting hardware!\n");
spin_lock_bh(&sc->sc_resetlock); spin_lock_bh(&sc->rx.pcu_lock);
r = ath9k_hw_reset(ah, sc->sc_ah->curchan, ah->caldata, false); r = ath9k_hw_reset(ah, sc->sc_ah->curchan, ah->caldata, false);
if (r) if (r)
ath_print(common, ATH_DBG_FATAL, ath_print(common, ATH_DBG_FATAL,
"Unable to reset hardware; reset status %d\n", "Unable to reset hardware; reset status %d\n",
r); r);
spin_unlock_bh(&sc->sc_resetlock); spin_unlock_bh(&sc->rx.pcu_lock);
} }
for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) { for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册