--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
-@@ -212,83 +212,39 @@ static int ath_update_survey_stats(struc
+@@ -212,83 +212,47 @@ static int ath_update_survey_stats(struc
return ret;
}
-*/
-static int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw,
- struct ath9k_channel *hchan)
-+static bool ath_prepare_reset(struct ath_softc *sc, bool retry_tx)
++static bool ath_prepare_reset(struct ath_softc *sc, bool retry_tx, bool flush)
{
struct ath_hw *ah = sc->sc_ah;
-- struct ath_common *common = ath9k_hw_common(ah);
+ struct ath_common *common = ath9k_hw_common(ah);
- struct ieee80211_conf *conf = &common->hw->conf;
- bool fastcc = true, stopped;
- struct ieee80211_channel *channel = hw->conf.channel;
sc->hw_busy_count = 0;
-
-- del_timer_sync(&common->ani.timer);
+ del_timer_sync(&common->ani.timer);
cancel_work_sync(&sc->paprd_work);
cancel_work_sync(&sc->hw_check_work);
cancel_delayed_work_sync(&sc->tx_complete_work);
- */
ath9k_hw_disable_interrupts(ah);
- stopped = ath_drain_all_txq(sc, false);
-
+-
- if (!ath_stoprecv(sc))
- stopped = false;
--
+
- if (!ath9k_hw_check_alive(ah))
- stopped = false;
--
++ ret = ath_drain_all_txq(sc, retry_tx);
+
- /* XXX: do not flush receive queue here. We don't want
- * to flush data frames already in queue because of
- * changing channel. */
-+ ret = ath_drain_all_txq(sc, retry_tx);
-
+-
- if (!stopped || !(sc->sc_flags & SC_OP_OFFCHANNEL))
- fastcc = false;
+ if (!ath_stoprecv(sc))
- if (!(sc->sc_flags & SC_OP_OFFCHANNEL))
- caldata = &sc->caldata;
-+ ath_flushrecv(sc);
++ if (!flush) {
++ if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
++ ath_rx_tasklet(sc, 0, true);
++ ath_rx_tasklet(sc, 0, false);
++ } else {
++ ath_flushrecv(sc);
++ }
- ath_dbg(common, ATH_DBG_CONFIG,
- "(%u MHz) -> (%u MHz), conf_is_ht40: %d fastcc: %d\n",
}
ath9k_cmn_update_txpow(ah, sc->curtxpow,
-@@ -296,21 +252,87 @@ static int ath_set_channel(struct ath_so
+@@ -296,21 +260,89 @@ static int ath_set_channel(struct ath_so
ath9k_hw_set_interrupts(ah, ah->imask);
ath9k_hw_enable_interrupts(ah);
+ struct ath_common *common = ath9k_hw_common(ah);
+ struct ath9k_hw_cal_data *caldata = NULL;
+ bool fastcc = true;
++ bool flush = false;
+ int r;
+
+ if (!(sc->sc_flags & SC_OP_OFFCHANNEL)) {
+ fastcc = false;
+ caldata = &sc->caldata;
+ }
-
++
+ if (!hchan) {
+ fastcc = false;
++ flush = true;
+ hchan = ah->curchan;
+ }
+
+ if (fastcc && !ath9k_hw_check_alive(ah))
+ fastcc = false;
+
-+ if (!ath_prepare_reset(sc, retry_tx))
++ if (!ath_prepare_reset(sc, retry_tx, flush))
+ fastcc = false;
+
+ ath_dbg(common, ATH_DBG_CONFIG,
+ struct ath9k_channel *hchan)
+{
+ int r;
-+
+
+ if (sc->sc_flags & SC_OP_INVALID)
+ return -EIO;
+
return r;
}
-@@ -893,28 +915,13 @@ static void ath_radio_enable(struct ath_
+@@ -893,28 +925,13 @@ static void ath_radio_enable(struct ath_
channel->center_freq, r);
}
spin_unlock_bh(&sc->sc_pcu_lock);
ath9k_ps_restore(sc);
-@@ -942,13 +949,7 @@ void ath_radio_disable(struct ath_softc
+@@ -927,12 +944,8 @@ void ath_radio_disable(struct ath_softc
+ int r;
+
+ ath9k_ps_wakeup(sc);
+- cancel_delayed_work_sync(&sc->hw_pll_work);
+-
+ spin_lock_bh(&sc->sc_pcu_lock);
+
+- ieee80211_stop_queues(hw);
+-
+ /*
+ * Keep the LED on when the radio is disabled
+ * during idle unassociated state.
+@@ -942,13 +955,7 @@ void ath_radio_disable(struct ath_softc
ath9k_hw_cfg_gpio_input(ah, ah->led_pin);
}
-
- ath_stoprecv(sc); /* turn off frame recv */
- ath_flushrecv(sc); /* flush recv queue */
-+ ath_prepare_reset(sc, false);
++ ath_prepare_reset(sc, false, true);
if (!ah->curchan)
ah->curchan = ath9k_cmn_get_curchannel(hw, ah);
-@@ -970,48 +971,11 @@ void ath_radio_disable(struct ath_softc
+@@ -970,48 +977,11 @@ void ath_radio_disable(struct ath_softc
int ath_reset(struct ath_softc *sc, bool retry_tx)
{
if (retry_tx) {
int i;
-@@ -1024,12 +988,6 @@ int ath_reset(struct ath_softc *sc, bool
+@@ -1024,12 +994,6 @@ int ath_reset(struct ath_softc *sc, bool
}
}
ath9k_ps_restore(sc);
return r;
-@@ -1081,28 +1039,6 @@ static int ath9k_start(struct ieee80211_
+@@ -1081,28 +1045,6 @@ static int ath9k_start(struct ieee80211_
goto mutex_unlock;
}
/* Setup our intr mask. */
ah->imask = ATH9K_INT_TX | ATH9K_INT_RXEOL |
ATH9K_INT_RXORN | ATH9K_INT_FATAL |
-@@ -1125,12 +1061,14 @@ static int ath9k_start(struct ieee80211_
+@@ -1125,12 +1067,14 @@ static int ath9k_start(struct ieee80211_
/* Disable BMISS interrupt when we're not associated */
ah->imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS);