ath9k: Use new scan notifiers from mac80211
authorSujith <Sujith.Manoharan@atheros.com>
Tue, 3 Mar 2009 04:46:45 +0000 (10:16 +0530)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 5 Mar 2009 19:39:41 +0000 (14:39 -0500)
The only use case for this right now is ANI calibration,
but more might come up in the future.

Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath9k/ath9k.h
drivers/net/wireless/ath9k/main.c

index 69292f31d20b902a4c3d1cc4b94c552b6b8dc8ca..0fb66b0c9e8e5884818c5c85b51c74dccd336baa 100644 (file)
@@ -559,6 +559,7 @@ struct ath_rfkill {
 #define SC_OP_RFKILL_HW_BLOCKED        BIT(13)
 #define SC_OP_WAIT_FOR_BEACON  BIT(14)
 #define SC_OP_LED_ON           BIT(15)
+#define SC_OP_SCANNING         BIT(16)
 
 struct ath_bus_ops {
        void            (*read_cachesize)(struct ath_softc *sc, int *csz);
@@ -682,4 +683,5 @@ static inline void ath9k_ps_restore(struct ath_softc *sc)
                        ath9k_hw_setpower(sc->sc_ah,
                                          sc->sc_ah->restore_mode);
 }
+
 #endif /* ATH9K_H */
index 59b769e716fc54c6a4034eea4a678d5312aedcb0..48beef9235b3f058d991eb1ac2d29bff468224fc 100644 (file)
@@ -327,7 +327,7 @@ static void ath_ani_calibrate(unsigned long data)
        * don't calibrate when we're scanning.
        * we are most likely not on our home channel.
        */
-       if (sc->rx.rxfilter & FIF_BCN_PRBRESP_PROMISC)
+       if (sc->sc_flags & SC_OP_SCANNING)
                goto set_timer;
 
        /* Long calibration runs independently of short calibration. */
@@ -2616,6 +2616,24 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw,
        return ret;
 }
 
+static void ath9k_sw_scan_start(struct ieee80211_hw *hw)
+{
+       struct ath_softc *sc = hw->priv;
+
+       mutex_lock(&sc->mutex);
+       sc->sc_flags |= SC_OP_SCANNING;
+       mutex_unlock(&sc->mutex);
+}
+
+static void ath9k_sw_scan_complete(struct ieee80211_hw *hw)
+{
+       struct ath_softc *sc = hw->priv;
+
+       mutex_lock(&sc->mutex);
+       sc->sc_flags &= ~SC_OP_SCANNING;
+       mutex_unlock(&sc->mutex);
+}
+
 struct ieee80211_ops ath9k_ops = {
        .tx                 = ath9k_tx,
        .start              = ath9k_start,
@@ -2633,6 +2651,8 @@ struct ieee80211_ops ath9k_ops = {
        .set_tsf            = ath9k_set_tsf,
        .reset_tsf          = ath9k_reset_tsf,
        .ampdu_action       = ath9k_ampdu_action,
+       .sw_scan_start      = ath9k_sw_scan_start,
+       .sw_scan_complete   = ath9k_sw_scan_complete,
 };
 
 static struct {