]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/net/wireless/ath/ath9k/init.c
ath9k: Remove pm_qos request after hw unregister.
[net-next-2.6.git] / drivers / net / wireless / ath / ath9k / init.c
index a4c5ed41b176c09f17706eba9d1a4696d7dd3966..92bc5c5f48768ac42ca4b1bd02690d9d38ebed80 100644 (file)
@@ -15,6 +15,7 @@
  */
 
 #include <linux/slab.h>
+#include <linux/pm_qos_params.h>
 
 #include "ath9k.h"
 
@@ -179,6 +180,8 @@ static const struct ath_ops ath9k_common_ops = {
        .write = ath9k_iowrite32,
 };
 
+struct pm_qos_request_list ath9k_pm_qos_req;
+
 /**************************/
 /*     Initialization     */
 /**************************/
@@ -485,7 +488,7 @@ static int ath9k_init_channels_rates(struct ath_softc *sc)
                     ARRAY_SIZE(ath9k_5ghz_chantable) !=
                     ATH9K_NUM_CHANNELS);
 
-       if (test_bit(ATH9K_MODE_11G, sc->sc_ah->caps.wireless_modes)) {
+       if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) {
                channels = kmemdup(ath9k_2ghz_chantable,
                        sizeof(ath9k_2ghz_chantable), GFP_KERNEL);
                if (!channels)
@@ -500,7 +503,7 @@ static int ath9k_init_channels_rates(struct ath_softc *sc)
                        ARRAY_SIZE(ath9k_legacy_rates);
        }
 
-       if (test_bit(ATH9K_MODE_11A, sc->sc_ah->caps.wireless_modes)) {
+       if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) {
                channels = kmemdup(ath9k_5ghz_chantable,
                        sizeof(ath9k_5ghz_chantable), GFP_KERNEL);
                if (!channels) {
@@ -577,6 +580,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
        common->hw = sc->hw;
        common->priv = sc;
        common->debug_mask = ath9k_debug;
+       spin_lock_init(&common->cc_lock);
 
        spin_lock_init(&sc->wiphy_lock);
        spin_lock_init(&sc->sc_resetlock);
@@ -681,17 +685,17 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
        hw->rate_control_algorithm = "ath9k_rate_control";
 #endif
 
-       if (test_bit(ATH9K_MODE_11G, sc->sc_ah->caps.wireless_modes))
+       if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ)
                hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
                        &sc->sbands[IEEE80211_BAND_2GHZ];
-       if (test_bit(ATH9K_MODE_11A, sc->sc_ah->caps.wireless_modes))
+       if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
                hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
                        &sc->sbands[IEEE80211_BAND_5GHZ];
 
        if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) {
-               if (test_bit(ATH9K_MODE_11G, sc->sc_ah->caps.wireless_modes))
+               if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ)
                        setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_2GHZ].ht_cap);
-               if (test_bit(ATH9K_MODE_11A, sc->sc_ah->caps.wireless_modes))
+               if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
                        setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_5GHZ].ht_cap);
        }
 
@@ -755,6 +759,9 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc, u16 subsysid,
        ath_init_leds(sc);
        ath_start_rfkill_poll(sc);
 
+       pm_qos_add_request(&ath9k_pm_qos_req, PM_QOS_CPU_DMA_LATENCY,
+                          PM_QOS_DEFAULT_VALUE);
+
        return 0;
 
 error_world:
@@ -823,6 +830,7 @@ void ath9k_deinit_device(struct ath_softc *sc)
        }
 
        ieee80211_unregister_hw(hw);
+       pm_qos_remove_request(&ath9k_pm_qos_req);
        ath_rx_cleanup(sc);
        ath_tx_cleanup(sc);
        ath9k_deinit_softc(sc);