ath9k: pass the ieee80211_hw on radio enable/disable
authorLuis R. Rodriguez <lrodriguez@atheros.com>
Mon, 2 Nov 2009 22:35:42 +0000 (14:35 -0800)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 11 Nov 2009 22:09:01 +0000 (17:09 -0500)
We use the ieee80211_hw for radio enable/disable but the wrong
structure hw was being used in consideration for virtual wiphys
as each virtual wiphy has its own ieee80211_hw struct.

Just pass the hw struct to ensure we use the right one. This should
fix the hw used and passed for radio enable/disable. This includes
the stoping / starting of the software TX queues so mac80211 doesn't
send us data for a specific virtual wiphy. ath9k already takes care
of pausing virtual wiphys and stopping the respective queues on its
own, but this should handle the idle mac80211 conf calls as well.

Cc: Jouni.Malinen <Jouni.Malinen@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/ath9k.h
drivers/net/wireless/ath/ath9k/main.c
drivers/net/wireless/ath/ath9k/virtual.c

index da5357838dda421f2c175a5fd05c361d7e7f3ccd..59ce7ec5b2246175790f25f85102d0db655a9260 100644 (file)
@@ -655,8 +655,9 @@ void ath9k_update_ichannel(struct ath_softc *sc, struct ieee80211_hw *hw,
 void ath_update_chainmask(struct ath_softc *sc, int is_ht);
 int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw,
                    struct ath9k_channel *hchan);
-void ath_radio_enable(struct ath_softc *sc);
-void ath_radio_disable(struct ath_softc *sc);
+
+void ath_radio_enable(struct ath_softc *sc, struct ieee80211_hw *hw);
+void ath_radio_disable(struct ath_softc *sc, struct ieee80211_hw *hw);
 
 #ifdef CONFIG_PCI
 int ath_pci_init(void);
index bdce0ab99ded73ab66e03570e247f3a41c940012..11aaa7d69a1fa6cef6f6bcb44f7dd98253d153bd 100644 (file)
@@ -1200,11 +1200,11 @@ fail:
        ath_deinit_leds(sc);
 }
 
-void ath_radio_enable(struct ath_softc *sc)
+void ath_radio_enable(struct ath_softc *sc, struct ieee80211_hw *hw)
 {
        struct ath_hw *ah = sc->sc_ah;
        struct ath_common *common = ath9k_hw_common(ah);
-       struct ieee80211_channel *channel = sc->hw->conf.channel;
+       struct ieee80211_channel *channel = hw->conf.channel;
        int r;
 
        ath9k_ps_wakeup(sc);
@@ -1241,18 +1241,18 @@ void ath_radio_enable(struct ath_softc *sc)
                            AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
        ath9k_hw_set_gpio(ah, ah->led_pin, 0);
 
-       ieee80211_wake_queues(sc->hw);
+       ieee80211_wake_queues(hw);
        ath9k_ps_restore(sc);
 }
 
-void ath_radio_disable(struct ath_softc *sc)
+void ath_radio_disable(struct ath_softc *sc, struct ieee80211_hw *hw)
 {
        struct ath_hw *ah = sc->sc_ah;
-       struct ieee80211_channel *channel = sc->hw->conf.channel;
+       struct ieee80211_channel *channel = hw->conf.channel;
        int r;
 
        ath9k_ps_wakeup(sc);
-       ieee80211_stop_queues(sc->hw);
+       ieee80211_stop_queues(hw);
 
        /* Disable LED */
        ath9k_hw_set_gpio(ah, ah->led_pin, 1);
@@ -1266,7 +1266,7 @@ void ath_radio_disable(struct ath_softc *sc)
        ath_flushrecv(sc);              /* flush recv queue */
 
        if (!ah->curchan)
-               ah->curchan = ath_get_curchannel(sc, sc->hw);
+               ah->curchan = ath_get_curchannel(sc, hw);
 
        spin_lock_bh(&sc->sc_resetlock);
        r = ath9k_hw_reset(ah, ah->curchan, false);
@@ -2719,7 +2719,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
                spin_unlock_bh(&sc->wiphy_lock);
 
                if (enable_radio) {
-                       ath_radio_enable(sc);
+                       ath_radio_enable(sc, hw);
                        ath_print(common, ATH_DBG_CONFIG,
                                  "not-idle: enabling radio\n");
                }
@@ -2800,7 +2800,7 @@ skip_chan_change:
 
        if (disable_radio) {
                ath_print(common, ATH_DBG_CONFIG, "idle: disabling radio\n");
-               ath_radio_disable(sc);
+               ath_radio_disable(sc, hw);
        }
 
        mutex_unlock(&sc->mutex);
index 7678c4a2ca6f6252b358a3e68472fede96d4e69d..69a871ba051f694dedec209b9dfdbe17c8306796 100644 (file)
@@ -526,8 +526,9 @@ int ath9k_wiphy_select(struct ath_wiphy *aphy)
                         * frame being completed)
                         */
                        spin_unlock_bh(&sc->wiphy_lock);
-                       ath_radio_disable(sc);
-                       ath_radio_enable(sc);
+                       ath_radio_disable(sc, aphy->hw);
+                       ath_radio_enable(sc, aphy->hw);
+                       /* Only the primary wiphy hw is used for queuing work */
                        ieee80211_queue_work(aphy->sc->hw,
                                   &aphy->sc->chan_work);
                        return -EBUSY; /* previous select still in progress */