ath9k: Move txpower limit to channel context
authorFelix Fietkau <nbd@openwrt.org>
Wed, 11 Jun 2014 10:47:50 +0000 (16:17 +0530)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 19 Jun 2014 19:49:16 +0000 (15:49 -0400)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/ath9k.h
drivers/net/wireless/ath/ath9k/channel.c
drivers/net/wireless/ath/ath9k/init.c
drivers/net/wireless/ath/ath9k/main.c
drivers/net/wireless/ath/ath9k/mci.c

index 8c87eb7fb6de5cd7c62ca450065ea991d428636a..b6f6444d109e2301d439cf861a483246cdf9f519 100644 (file)
@@ -36,10 +36,6 @@ extern int ath9k_modparam_nohwcrypt;
 extern int led_blink;
 extern bool is_ath9k_unloaded;
 
-struct ath_config {
-       u16 txpowlimit;
-};
-
 /*************************/
 /* Descriptor Management */
 /*************************/
@@ -328,6 +324,7 @@ struct ath_rx {
 struct ath_chanctx {
        struct cfg80211_chan_def chandef;
        struct list_head vifs;
+       u16 txpower;
        bool offchannel;
 };
 
@@ -753,7 +750,6 @@ struct ath_softc {
        short nvifs;
        unsigned long ps_usecount;
 
-       struct ath_config config;
        struct ath_rx rx;
        struct ath_tx tx;
        struct ath_beacon beacon;
index aee6cdb4975b8dd986259f389779bafa73dbf891..1b40cf5aa95534132cf1c58043aa0a3c4664dd08 100644 (file)
@@ -118,6 +118,7 @@ void ath_chanctx_init(struct ath_softc *sc)
                ctx = &sc->chanctx[i];
                cfg80211_chandef_create(&ctx->chandef, chan, NL80211_CHAN_HT20);
                INIT_LIST_HEAD(&ctx->vifs);
+               ctx->txpower = ATH_TXPOWER_MAX;
        }
        sc->cur_chan = &sc->chanctx[0];
 }
index 32d954275d4747678f2b165006bf6f98eaf0809a..ffd42bfb74b4173b556458d3cb9a6abc77e85098 100644 (file)
@@ -169,9 +169,9 @@ static void ath9k_reg_notifier(struct wiphy *wiphy,
 
        /* Set tx power */
        if (ah->curchan) {
-               sc->config.txpowlimit = 2 * ah->curchan->chan->max_power;
+               sc->cur_chan->txpower = 2 * ah->curchan->chan->max_power;
                ath9k_ps_wakeup(sc);
-               ath9k_hw_set_txpowerlimit(ah, sc->config.txpowlimit, false);
+               ath9k_hw_set_txpowerlimit(ah, sc->cur_chan->txpower, false);
                sc->curtxpow = ath9k_hw_regulatory(ah)->power_limit;
                /* synchronize DFS detector if regulatory domain changed */
                if (sc->dfs_detector != NULL)
@@ -335,7 +335,6 @@ static void ath9k_init_misc(struct ath_softc *sc)
        setup_timer(&common->ani.timer, ath_ani_calibrate, (unsigned long)sc);
 
        common->last_rssi = ATH_RSSI_DUMMY_MARKER;
-       sc->config.txpowlimit = ATH_TXPOWER_MAX;
        memcpy(common->bssidmask, ath_bcast_mac, ETH_ALEN);
        sc->beacon.slottime = ATH9K_SLOT_TIME_9;
 
index 2e7cce7b1238f6740e0f2510fd24d7d917cc1144..5a9cee4a8935caacf8c040f0141bb8e59fc9a687 100644 (file)
@@ -227,7 +227,7 @@ static bool ath_complete_reset(struct ath_softc *sc, bool start)
        }
 
        ath9k_cmn_update_txpow(ah, sc->curtxpow,
-                              sc->config.txpowlimit, &sc->curtxpow);
+                              sc->cur_chan->txpower, &sc->curtxpow);
 
        clear_bit(ATH_OP_HW_RESET, &common->op_flags);
        ath9k_hw_set_interrupts(ah);
@@ -1315,9 +1315,9 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
 
        if (changed & IEEE80211_CONF_CHANGE_POWER) {
                ath_dbg(common, CONFIG, "Set power: %d\n", conf->power_level);
-               sc->config.txpowlimit = 2 * conf->power_level;
+               sc->cur_chan->txpower = 2 * conf->power_level;
                ath9k_cmn_update_txpow(ah, sc->curtxpow,
-                                      sc->config.txpowlimit, &sc->curtxpow);
+                                      sc->cur_chan->txpower, &sc->curtxpow);
        }
 
        mutex_unlock(&sc->mutex);
index a0dbcc4123840cbeab93e56939ce6b095f3e885d..313ed995585a9bc438b03a198b981ca67fa75092 100644 (file)
@@ -720,7 +720,7 @@ void ath9k_mci_set_txpower(struct ath_softc *sc, bool setchannel,
                mci_hw->concur_tx = concur_tx;
 
        if (old_concur_tx != mci_hw->concur_tx)
-               ath9k_hw_set_txpowerlimit(ah, sc->config.txpowlimit, false);
+               ath9k_hw_set_txpowerlimit(ah, sc->cur_chan->txpower, false);
 }
 
 static void ath9k_mci_stomp_audio(struct ath_softc *sc)