@@ -1511,6 +1511,22 @@ void ath9k_enable_ps(struct ath_softc *sc)
}
}
+static bool ath9k_can_change_channel(struct ath_softc *sc)
+{
+ u32 wait_for = PS_WAIT_FOR_BEACON |
+ PS_WAIT_FOR_CAB |
+ PS_WAIT_FOR_PSPOLL_DATA |
+ PS_WAIT_FOR_TX_ACK;
+
+ if (sc->ps_flags & wait_for) {
+ ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_PS,
+ "Cannot change channel due to a wait constraint\n");
+ return false;
+ }
+
+ return true;
+}
+
static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
{
struct ath_wiphy *aphy = hw->priv;
@@ -1605,6 +1621,9 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
struct ieee80211_channel *curchan = hw->conf.channel;
int pos = curchan->hw_value;
+ if (!ath9k_can_change_channel(sc))
+ goto skip_chan_change;
+
aphy->chan_idx = pos;
aphy->chan_is_ht = conf_is_ht(conf);
if (hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)