In order to access the operating mode in common code,
move opmode to the ath_common struct from the respective
context structs in ath5k/ath9k.

Signed-off-by: Bob Copeland <m...@bobcopeland.com>
---
 drivers/net/wireless/ath/ath.h          |    1 +
 drivers/net/wireless/ath/ath5k/base.c   |   42 +++++++++++++++---------------
 drivers/net/wireless/ath/ath5k/base.h   |    1 -
 drivers/net/wireless/ath/ath9k/ani.c    |   19 ++++++++------
 drivers/net/wireless/ath/ath9k/beacon.c |   10 +++---
 drivers/net/wireless/ath/ath9k/common.c |    3 +-
 drivers/net/wireless/ath/ath9k/hw.c     |   15 ++++++-----
 drivers/net/wireless/ath/ath9k/hw.h     |    1 -
 drivers/net/wireless/ath/ath9k/main.c   |   14 +++++-----
 drivers/net/wireless/ath/ath9k/rc.c     |   10 ++++---
 drivers/net/wireless/ath/ath9k/recv.c   |   11 ++++---
 drivers/net/wireless/ath/ath9k/xmit.c   |    4 ++-
 12 files changed, 69 insertions(+), 62 deletions(-)

diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h
index 9e05648..dc09380 100644
--- a/drivers/net/wireless/ath/ath.h
+++ b/drivers/net/wireless/ath/ath.h
@@ -85,6 +85,7 @@ struct ath_common {
        struct ieee80211_hw *hw;
        int debug_mask;
        enum ath_device_state state;
+       enum nl80211_iftype opmode;
 
        struct ath_ani ani;
 
diff --git a/drivers/net/wireless/ath/ath5k/base.c 
b/drivers/net/wireless/ath/ath5k/base.c
index a4c086f..8446863 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -567,7 +567,6 @@ ath5k_pci_probe(struct pci_dev *pdev,
        __set_bit(ATH_STAT_INVALID, sc->status);
 
        sc->iobase = mem; /* So we can unmap it on detach */
-       sc->opmode = NL80211_IFTYPE_STATION;
        sc->bintval = 1000;
        mutex_init(&sc->lock);
        spin_lock_init(&sc->rxbuflock);
@@ -595,6 +594,7 @@ ath5k_pci_probe(struct pci_dev *pdev,
        sc->ah->ah_sc = sc;
        sc->ah->ah_iobase = sc->iobase;
        common = ath5k_hw_common(sc->ah);
+       common->opmode = NL80211_IFTYPE_STATION;
        common->ops = &ath5k_common_ops;
        common->ah = sc->ah;
        common->hw = hw;
@@ -1137,7 +1137,7 @@ ath5k_mode_setup(struct ath5k_softc *sc)
        struct ath5k_hw *ah = sc->ah;
        u32 rfilt;
 
-       ah->ah_op_mode = sc->opmode;
+       ah->ah_op_mode = ath5k_hw_common(ah)->opmode;
 
        /* configure rx filter */
        rfilt = sc->filter_flags;
@@ -1514,8 +1514,8 @@ ath5k_beaconq_config(struct ath5k_softc *sc)
        ret = ath5k_hw_get_tx_queueprops(ah, sc->bhalq, &qi);
        if (ret)
                return ret;
-       if (sc->opmode == NL80211_IFTYPE_AP ||
-               sc->opmode == NL80211_IFTYPE_MESH_POINT) {
+       if (ath5k_hw_common(ah)->opmode == NL80211_IFTYPE_AP ||
+               ath5k_hw_common(ah)->opmode == NL80211_IFTYPE_MESH_POINT) {
                /*
                 * Always burst out beacon and CAB traffic
                 * (aifs = cwmin = cwmax = 0)
@@ -1523,7 +1523,7 @@ ath5k_beaconq_config(struct ath5k_softc *sc)
                qi.tqi_aifs = 0;
                qi.tqi_cw_min = 0;
                qi.tqi_cw_max = 0;
-       } else if (sc->opmode == NL80211_IFTYPE_ADHOC) {
+       } else if (ath5k_hw_common(ah)->opmode == NL80211_IFTYPE_ADHOC) {
                /*
                 * Adhoc mode; backoff between 0 and (2 * cw_min).
                 */
@@ -1841,7 +1841,7 @@ ath5k_tasklet_rx(unsigned long data)
                        /* let crypto-error packets fall through in MNTR */
                        if ((rs.rs_status &
                                ~(AR5K_RXERR_DECRYPT|AR5K_RXERR_MIC)) ||
-                                       sc->opmode != NL80211_IFTYPE_MONITOR)
+                                       ath5k_hw_common(ah)->opmode != 
NL80211_IFTYPE_MONITOR)
                                goto next;
                }
 accept:
@@ -1925,7 +1925,7 @@ accept:
                ath5k_debug_dump_skb(sc, skb, "RX  ", 0);
 
                /* check beacons in IBSS mode */
-               if (sc->opmode == NL80211_IFTYPE_ADHOC)
+               if (ath5k_hw_common(ah)->opmode == NL80211_IFTYPE_ADHOC)
                        ath5k_check_ibss_tsf(sc, skb, rxs);
 
                ieee80211_rx(sc->hw, skb);
@@ -2062,7 +2062,7 @@ ath5k_beacon_setup(struct ath5k_softc *sc, struct 
ath5k_buf *bf)
        antenna = ah->ah_tx_ant;
 
        flags = AR5K_TXDESC_NOACK;
-       if (sc->opmode == NL80211_IFTYPE_ADHOC && ath5k_hw_hasveol(ah)) {
+       if (ath5k_hw_common(ah)->opmode == NL80211_IFTYPE_ADHOC && 
ath5k_hw_hasveol(ah)) {
                ds->ds_link = bf->daddr;        /* self-linked */
                flags |= AR5K_TXDESC_VEOL;
        } else
@@ -2125,8 +2125,8 @@ ath5k_beacon_send(struct ath5k_softc *sc)
 
        ATH5K_DBG_UNLIMIT(sc, ATH5K_DEBUG_BEACON, "in beacon_send\n");
 
-       if (unlikely(bf->skb == NULL || sc->opmode == NL80211_IFTYPE_STATION ||
-                       sc->opmode == NL80211_IFTYPE_MONITOR)) {
+       if (unlikely(bf->skb == NULL || ath5k_hw_common(ah)->opmode == 
NL80211_IFTYPE_STATION ||
+                       ath5k_hw_common(ah)->opmode == NL80211_IFTYPE_MONITOR)) 
{
                ATH5K_WARN(sc, "bf=%p bf_skb=%p\n", bf, bf ? bf->skb : NULL);
                return;
        }
@@ -2167,7 +2167,7 @@ ath5k_beacon_send(struct ath5k_softc *sc)
        }
 
        /* refresh the beacon for AP mode */
-       if (sc->opmode == NL80211_IFTYPE_AP)
+       if (ath5k_hw_common(ah)->opmode == NL80211_IFTYPE_AP)
                ath5k_beacon_update(sc->hw, sc->vif);
 
        ath5k_hw_set_txdp(ah, sc->bhalq, bf->daddr);
@@ -2317,7 +2317,7 @@ ath5k_beacon_config(struct ath5k_softc *sc)
 
                sc->imask |= AR5K_INT_SWBA;
 
-               if (sc->opmode == NL80211_IFTYPE_ADHOC) {
+               if (ath5k_hw_common(ah)->opmode == NL80211_IFTYPE_ADHOC) {
                        if (ath5k_hw_hasveol(ah))
                                ath5k_beacon_send(sc);
                } else
@@ -2343,7 +2343,7 @@ static void ath5k_tasklet_beacon(unsigned long data)
         * transmission time) in order to detect wether
         * automatic TSF updates happened.
         */
-       if (sc->opmode == NL80211_IFTYPE_ADHOC) {
+       if (ath5k_hw_common(sc->ah)->opmode == NL80211_IFTYPE_ADHOC) {
                /* XXX: only if VEOL suppported */
                u64 tsf = ath5k_hw_get_tsf64(sc->ah);
                sc->nexttbtt += sc->bintval;
@@ -2373,7 +2373,7 @@ ath5k_init(struct ath5k_softc *sc)
 
        mutex_lock(&sc->lock);
 
-       ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "mode %d\n", sc->opmode);
+       ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "mode %d\n", 
ath5k_hw_common(sc->ah)->opmode);
 
        /*
         * Stop anything previously setup.  This is safe
@@ -2660,7 +2660,7 @@ static int ath5k_tx_queue(struct ieee80211_hw *hw, struct 
sk_buff *skb,
 
        ath5k_debug_dump_skb(sc, skb, "TX  ", 1);
 
-       if (sc->opmode == NL80211_IFTYPE_MONITOR)
+       if (ath5k_hw_common(sc->ah)->opmode == NL80211_IFTYPE_MONITOR)
                ATH5K_DBG(sc, ATH5K_DEBUG_XMIT, "tx in monitor (scan?)\n");
 
        /*
@@ -2731,7 +2731,7 @@ ath5k_reset(struct ath5k_softc *sc, struct 
ieee80211_channel *chan)
                sc->curchan = chan;
                sc->curband = &sc->sbands[chan->band];
        }
-       ret = ath5k_hw_reset(ah, sc->opmode, sc->curchan, chan != NULL);
+       ret = ath5k_hw_reset(ah, ath5k_hw_common(ah)->opmode, sc->curchan, chan 
!= NULL);
        if (ret) {
                ATH5K_ERR(sc, "can't reset hardware (%d)\n", ret);
                goto err;
@@ -2804,7 +2804,7 @@ static int ath5k_add_interface(struct ieee80211_hw *hw,
        case NL80211_IFTYPE_ADHOC:
        case NL80211_IFTYPE_MESH_POINT:
        case NL80211_IFTYPE_MONITOR:
-               sc->opmode = conf->type;
+               ath5k_hw_common(sc->ah)->opmode = conf->type;
                break;
        default:
                ret = -EOPNOTSUPP;
@@ -3002,7 +3002,7 @@ static void ath5k_configure_filter(struct ieee80211_hw 
*hw,
 
        /* XXX move these to mac80211, and add a beacon IFF flag to mac80211 */
 
-       switch (sc->opmode) {
+       switch (ath5k_hw_common(ah)->opmode) {
        case NL80211_IFTYPE_MESH_POINT:
        case NL80211_IFTYPE_MONITOR:
                rfilt |= AR5K_RX_FILTER_CONTROL |
@@ -3047,7 +3047,7 @@ ath5k_set_key(struct ieee80211_hw *hw, enum set_key_cmd 
cmd,
        if (modparam_nohwcrypt)
                return -EOPNOTSUPP;
 
-       if (sc->opmode == NL80211_IFTYPE_AP)
+       if (ath5k_hw_common(ah)->opmode == NL80211_IFTYPE_AP)
                return -EOPNOTSUPP;
 
        switch (key->alg) {
@@ -3145,7 +3145,7 @@ ath5k_reset_tsf(struct ieee80211_hw *hw)
         * in IBSS mode we need to update the beacon timers too.
         * this will also reset the TSF if we call it with 0
         */
-       if (sc->opmode == NL80211_IFTYPE_ADHOC)
+       if (ath5k_hw_common(sc->ah)->opmode == NL80211_IFTYPE_ADHOC)
                ath5k_beacon_update_timers(sc, 0);
        else
                ath5k_hw_reset_tsf(sc->ah);
@@ -3230,7 +3230,7 @@ static void ath5k_bss_info_changed(struct ieee80211_hw 
*hw,
 
        if (changes & BSS_CHANGED_ASSOC) {
                sc->assoc = bss_conf->assoc;
-               if (sc->opmode == NL80211_IFTYPE_STATION)
+               if (ath5k_hw_common(ah)->opmode == NL80211_IFTYPE_STATION)
                        set_beacon_filter(hw, sc->assoc);
                ath5k_hw_set_ledstate(sc->ah, sc->assoc ?
                        AR5K_LED_ASSOC : AR5K_LED_INIT);
diff --git a/drivers/net/wireless/ath/ath5k/base.h 
b/drivers/net/wireless/ath/ath5k/base.h
index 952b3a2..10ba46d 100644
--- a/drivers/net/wireless/ath/ath5k/base.h
+++ b/drivers/net/wireless/ath/ath5k/base.h
@@ -124,7 +124,6 @@ struct ath5k_softc {
        struct ieee80211_channel channels[ATH_CHAN_MAX];
        struct ieee80211_rate   rates[IEEE80211_NUM_BANDS][AR5K_MAX_RATES];
        s8                      rate_idx[IEEE80211_NUM_BANDS][AR5K_MAX_RATES];
-       enum nl80211_iftype     opmode;
        struct ath5k_hw         *ah;            /* Atheros HW */
 
        struct ieee80211_supported_band         *curband;
diff --git a/drivers/net/wireless/ath/ath9k/ani.c 
b/drivers/net/wireless/ath/ath9k/ani.c
index 2a0cd64..e5117fe 100644
--- a/drivers/net/wireless/ath/ath9k/ani.c
+++ b/drivers/net/wireless/ath/ath9k/ani.c
@@ -276,6 +276,7 @@ static void ath9k_ani_restart(struct ath_hw *ah)
 static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah)
 {
        struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf;
+       struct ath_common *common = ath9k_hw_common(ah);
        struct ar5416AniState *aniState;
        int32_t rssi;
 
@@ -298,7 +299,7 @@ static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah)
                }
        }
 
-       if (ah->opmode == NL80211_IFTYPE_AP) {
+       if (common->opmode == NL80211_IFTYPE_AP) {
                if (aniState->firstepLevel < HAL_FIRST_STEP_MAX) {
                        ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL,
                                             aniState->firstepLevel + 1);
@@ -348,6 +349,7 @@ static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah)
 static void ath9k_hw_ani_cck_err_trigger(struct ath_hw *ah)
 {
        struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf;
+       struct ath_common *common = ath9k_hw_common(ah);
        struct ar5416AniState *aniState;
        int32_t rssi;
 
@@ -361,7 +363,7 @@ static void ath9k_hw_ani_cck_err_trigger(struct ath_hw *ah)
                        return;
                }
        }
-       if (ah->opmode == NL80211_IFTYPE_AP) {
+       if (common->opmode == NL80211_IFTYPE_AP) {
                if (aniState->firstepLevel < HAL_FIRST_STEP_MAX) {
                        ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL,
                                             aniState->firstepLevel + 1);
@@ -387,10 +389,11 @@ static void ath9k_hw_ani_lower_immunity(struct ath_hw *ah)
 {
        struct ar5416AniState *aniState;
        int32_t rssi;
+       struct ath_common *common = ath9k_hw_common(ah);
 
        aniState = ah->curani;
 
-       if (ah->opmode == NL80211_IFTYPE_AP) {
+       if (common->opmode == NL80211_IFTYPE_AP) {
                if (aniState->firstepLevel > 0) {
                        if (ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL,
                                                 aniState->firstepLevel - 1))
@@ -478,13 +481,13 @@ void ath9k_ani_reset(struct ath_hw *ah)
        aniState = &ah->ani[index];
        ah->curani = aniState;
 
-       if (DO_ANI(ah) && ah->opmode != NL80211_IFTYPE_STATION
-           && ah->opmode != NL80211_IFTYPE_ADHOC) {
+       if (DO_ANI(ah) && common->opmode != NL80211_IFTYPE_STATION
+           && common->opmode != NL80211_IFTYPE_ADHOC) {
                ath_print(common, ATH_DBG_ANI,
-                         "Reset ANI state opmode %u\n", ah->opmode);
+                         "Reset ANI state opmode %u\n", common->opmode);
                ah->stats.ast_ani_reset++;
 
-               if (ah->opmode == NL80211_IFTYPE_AP) {
+               if (common->opmode == NL80211_IFTYPE_AP) {
                        /*
                         * ath9k_hw_ani_control() will only process items set on
                         * ah->ani_function
@@ -507,7 +510,7 @@ void ath9k_ani_reset(struct ath_hw *ah)
                ath9k_hw_setrxfilter(ah, ath9k_hw_getrxfilter(ah) |
                                     ATH9K_RX_FILTER_PHYERR);
 
-               if (ah->opmode == NL80211_IFTYPE_AP) {
+               if (common->opmode == NL80211_IFTYPE_AP) {
                        ah->curani->ofdmTrigHigh =
                                ah->config.ofdm_trig_high;
                        ah->curani->ofdmTrigLow =
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c 
b/drivers/net/wireless/ath/ath9k/beacon.c
index 1660ef1..044b3e1 100644
--- a/drivers/net/wireless/ath/ath9k/beacon.c
+++ b/drivers/net/wireless/ath/ath9k/beacon.c
@@ -31,7 +31,7 @@ int ath_beaconq_config(struct ath_softc *sc)
        int qnum;
 
        ath9k_hw_get_txq_props(ah, sc->beacon.beaconq, &qi);
-       if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) {
+       if (common->opmode == NL80211_IFTYPE_AP) {
                /* Always burst out beacon and CAB traffic. */
                qi.tqi_aifs = 1;
                qi.tqi_cwmin = 0;
@@ -76,8 +76,8 @@ static void ath_beacon_setup(struct ath_softc *sc, struct 
ath_vif *avp,
        ds = bf->bf_desc;
        flags = ATH9K_TXDESC_NOACK;
 
-       if (((sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) ||
-            (sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT)) &&
+       if (((common->opmode == NL80211_IFTYPE_ADHOC) ||
+            (common->opmode == NL80211_IFTYPE_MESH_POINT)) &&
            (ah->caps.hw_caps & ATH9K_HW_CAP_VEOL)) {
                ds->ds_link = bf->bf_daddr; /* self-linked */
                flags |= ATH9K_TXDESC_VEOL;
@@ -265,7 +265,7 @@ int ath_beacon_alloc(struct ath_wiphy *aphy, struct 
ieee80211_vif *vif)
                                                 struct ath_buf, list);
                list_del(&avp->av_bcbuf->list);
 
-               if (sc->sc_ah->opmode == NL80211_IFTYPE_AP ||
+               if (common->opmode == NL80211_IFTYPE_AP ||
                    !(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_VEOL)) {
                        int slot;
                        /*
@@ -751,7 +751,7 @@ void ath_beacon_config(struct ath_softc *sc, struct 
ieee80211_vif *vif)
                cur_conf->bmiss_timeout =
                        ATH_DEFAULT_BMISS_LIMIT * cur_conf->beacon_interval;
        } else {
-               iftype = sc->sc_ah->opmode;
+               iftype = common->opmode;
        }
 
        /*
diff --git a/drivers/net/wireless/ath/ath9k/common.c 
b/drivers/net/wireless/ath/ath9k/common.c
index 4d775ae..9253fee 100644
--- a/drivers/net/wireless/ath/ath9k/common.c
+++ b/drivers/net/wireless/ath/ath9k/common.c
@@ -36,7 +36,6 @@ static bool ath9k_rx_accept(struct ath_common *common,
                            struct ath_rx_status *rx_stats,
                            bool *decrypt_error)
 {
-       struct ath_hw *ah = common->ah;
        struct ieee80211_hdr *hdr;
        __le16 fc;
 
@@ -87,7 +86,7 @@ static bool ath9k_rx_accept(struct ath_common *common,
                 * decryption and MIC failures. For monitor mode,
                 * we also ignore the CRC error.
                 */
-               if (ah->opmode == NL80211_IFTYPE_MONITOR) {
+               if (common->opmode == NL80211_IFTYPE_MONITOR) {
                        if (rx_stats->rs_status &
                            ~(ATH9K_RXERR_DECRYPT | ATH9K_RXERR_MIC |
                              ATH9K_RXERR_CRC))
diff --git a/drivers/net/wireless/ath/ath9k/hw.c 
b/drivers/net/wireless/ath/ath9k/hw.c
index 9474f9f..88e1929 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -2032,7 +2032,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct 
ath9k_channel *chan,
                  | (ah->config.
                     ack_6mb ? AR_STA_ID1_ACKCTS_6MB : 0)
                  | ah->sta_id1_defaults);
-       ath9k_hw_set_operating_mode(ah, ah->opmode);
+       ath9k_hw_set_operating_mode(ah, common->opmode);
 
        ath_hw_setbssidmask(common);
 
@@ -2055,7 +2055,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct 
ath9k_channel *chan,
        for (i = 0; i < ah->caps.total_queues; i++)
                ath9k_hw_resettxqueue(ah, i);
 
-       ath9k_hw_init_interrupt_masks(ah, ah->opmode);
+       ath9k_hw_init_interrupt_masks(ah, common->opmode);
        ath9k_hw_init_qos(ah);
 
        if (ah->caps.hw_caps & ATH9K_HW_CAP_RFSILENT)
@@ -2962,10 +2962,10 @@ EXPORT_SYMBOL(ath9k_hw_set_interrupts);
 void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period)
 {
        int flags = 0;
-
+       struct ath_common *common = ath9k_hw_common(ah);
        ah->beacon_interval = beacon_period;
 
-       switch (ah->opmode) {
+       switch (common->opmode) {
        case NL80211_IFTYPE_STATION:
        case NL80211_IFTYPE_MONITOR:
                REG_WRITE(ah, AR_NEXT_TBTT_TIMER, TU_TO_USEC(next_beacon));
@@ -2998,7 +2998,7 @@ void ath9k_hw_beaconinit(struct ath_hw *ah, u32 
next_beacon, u32 beacon_period)
        default:
                ath_print(ath9k_hw_common(ah), ATH_DBG_BEACON,
                          "%s: unsupported opmode: %d\n",
-                         __func__, ah->opmode);
+                         __func__, common->opmode);
                return;
                break;
        }
@@ -3104,7 +3104,7 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah)
 
        capField = ah->eep_ops->get_eeprom(ah, EEP_OP_CAP);
 
-       if (ah->opmode != NL80211_IFTYPE_AP &&
+       if (common->opmode != NL80211_IFTYPE_AP &&
            ah->hw_version.subvendorid == AR_SUBVENDOR_ID_NEW_A) {
                if (regulatory->current_rd == 0x64 ||
                    regulatory->current_rd == 0x65)
@@ -3584,7 +3584,8 @@ EXPORT_SYMBOL(ath9k_hw_setmac);
 
 void ath9k_hw_setopmode(struct ath_hw *ah)
 {
-       ath9k_hw_set_operating_mode(ah, ah->opmode);
+       struct ath_common *common = ath9k_hw_common(ah);
+       ath9k_hw_set_operating_mode(ah, common->opmode);
 }
 EXPORT_SYMBOL(ath9k_hw_setopmode);
 
diff --git a/drivers/net/wireless/ath/ath9k/hw.h 
b/drivers/net/wireless/ath/ath9k/hw.h
index 8849450..3670699 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -468,7 +468,6 @@ struct ath_hw {
 
        bool htc_reset_init;
 
-       enum nl80211_iftype opmode;
        enum ath9k_power_mode power_mode;
 
        struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS];
diff --git a/drivers/net/wireless/ath/ath9k/main.c 
b/drivers/net/wireless/ath/ath9k/main.c
index 3f5b887..c8aeef0 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -360,7 +360,7 @@ static void ath_ani_calibrate(unsigned long data)
        unsigned int timestamp = jiffies_to_msecs(jiffies);
        u32 cal_interval, short_cal_interval;
 
-       short_cal_interval = (ah->opmode == NL80211_IFTYPE_AP) ?
+       short_cal_interval = (common->opmode == NL80211_IFTYPE_AP) ?
                ATH_AP_SHORT_CALINTERVAL : ATH_STA_SHORT_CALINTERVAL;
 
        /* Only calibrate if awake */
@@ -1662,7 +1662,7 @@ static int ath_init_softc(u16 devid, struct ath_softc 
*sc, u16 subsysid,
                ath9k_hw_keyreset(ah, (u16) i);
 
        /* default to MONITOR mode */
-       sc->sc_ah->opmode = NL80211_IFTYPE_MONITOR;
+       common->opmode = NL80211_IFTYPE_MONITOR;
 
        /*
         * Allocate hardware transmit queues: one queue for
@@ -2592,7 +2592,7 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
        }
 
        /* Set the device opmode */
-       sc->sc_ah->opmode = ic_opmode;
+       common->opmode = ic_opmode;
 
        /*
         * Enable MIB interrupts when there are hardware phy counters.
@@ -2634,9 +2634,9 @@ static void ath9k_remove_interface(struct ieee80211_hw 
*hw,
        del_timer_sync(&common->ani.timer);
 
        /* Reclaim beacon resources */
-       if ((sc->sc_ah->opmode == NL80211_IFTYPE_AP) ||
-           (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) ||
-           (sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT)) {
+       if ((common->opmode == NL80211_IFTYPE_AP) ||
+           (common->opmode == NL80211_IFTYPE_ADHOC) ||
+           (common->opmode == NL80211_IFTYPE_MESH_POINT)) {
                ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq);
                ath_beacon_return(sc, avp);
        }
@@ -2884,7 +2884,7 @@ static int ath9k_conf_tx(struct ieee80211_hw *hw, u16 
queue,
        if (ret)
                ath_print(common, ATH_DBG_FATAL, "TXQ Update failed\n");
 
-       if (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC)
+       if (common->opmode == NL80211_IFTYPE_ADHOC)
                if ((qnum == sc->tx.hwq_map[ATH9K_WME_AC_BE]) && !ret)
                        ath_beaconq_config(sc);
 
diff --git a/drivers/net/wireless/ath/ath9k/rc.c 
b/drivers/net/wireless/ath/ath9k/rc.c
index 70fdb9d..c5a4528 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -1282,6 +1282,7 @@ static void ath_rate_init(void *priv, struct 
ieee80211_supported_band *sband,
        struct ath_softc *sc = priv;
        struct ath_rate_priv *ath_rc_priv = priv_sta;
        const struct ath_rate_table *rate_table;
+       struct ath_common *common = ath9k_hw_common(sc->sc_ah);
        bool is_cw40, is_sgi40;
        int i, j = 0;
 
@@ -1309,9 +1310,9 @@ static void ath_rate_init(void *priv, struct 
ieee80211_supported_band *sband,
 
        /* Choose rate table first */
 
-       if ((sc->sc_ah->opmode == NL80211_IFTYPE_STATION) ||
-           (sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT) ||
-           (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC)) {
+       if ((common->opmode == NL80211_IFTYPE_STATION) ||
+           (common->opmode == NL80211_IFTYPE_MESH_POINT) ||
+           (common->opmode == NL80211_IFTYPE_ADHOC)) {
                rate_table = ath_choose_rate_table(sc, sband->band,
                                      sta->ht_cap.ht_supported, is_cw40);
        } else {
@@ -1328,6 +1329,7 @@ static void ath_rate_update(void *priv, struct 
ieee80211_supported_band *sband,
 {
        struct ath_softc *sc = priv;
        struct ath_rate_priv *ath_rc_priv = priv_sta;
+       struct ath_common *common = ath9k_hw_common(sc->sc_ah);
        const struct ath_rate_table *rate_table = NULL;
        bool oper_cw40 = false, oper_sgi40;
        bool local_cw40 = (ath_rc_priv->ht_cap & WLAN_RC_40_FLAG) ?
@@ -1338,7 +1340,7 @@ static void ath_rate_update(void *priv, struct 
ieee80211_supported_band *sband,
        /* FIXME: Handle AP mode later when we support CWM */
 
        if (changed & IEEE80211_RC_HT_CHANGED) {
-               if (sc->sc_ah->opmode != NL80211_IFTYPE_STATION)
+               if (common->opmode != NL80211_IFTYPE_STATION)
                        return;
 
                if (sc->hw->conf.channel_type == NL80211_CHAN_HT40MINUS ||
diff --git a/drivers/net/wireless/ath/ath9k/recv.c 
b/drivers/net/wireless/ath/ath9k/recv.c
index 477365e..68f938c 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -216,6 +216,7 @@ u32 ath_calcrxfilter(struct ath_softc *sc)
 {
 #define        RX_FILTER_PRESERVE (ATH9K_RX_FILTER_PHYERR | 
ATH9K_RX_FILTER_PHYRADAR)
 
+    struct ath_common *common = ath9k_hw_common(sc->sc_ah);
        u32 rfilt;
 
        rfilt = (ath9k_hw_getrxfilter(sc->sc_ah) & RX_FILTER_PRESERVE)
@@ -223,7 +224,7 @@ u32 ath_calcrxfilter(struct ath_softc *sc)
                | ATH9K_RX_FILTER_MCAST;
 
        /* If not a STA, enable processing of Probe Requests */
-       if (sc->sc_ah->opmode != NL80211_IFTYPE_STATION)
+       if (common->opmode != NL80211_IFTYPE_STATION)
                rfilt |= ATH9K_RX_FILTER_PROBEREQ;
 
        /*
@@ -231,15 +232,15 @@ u32 ath_calcrxfilter(struct ath_softc *sc)
         * mode interface or when in monitor mode. AP mode does not need this
         * since it receives all in-BSS frames anyway.
         */
-       if (((sc->sc_ah->opmode != NL80211_IFTYPE_AP) &&
+       if (((common->opmode != NL80211_IFTYPE_AP) &&
             (sc->rx.rxfilter & FIF_PROMISC_IN_BSS)) ||
-           (sc->sc_ah->opmode == NL80211_IFTYPE_MONITOR))
+           (common->opmode == NL80211_IFTYPE_MONITOR))
                rfilt |= ATH9K_RX_FILTER_PROM;
 
        if (sc->rx.rxfilter & FIF_CONTROL)
                rfilt |= ATH9K_RX_FILTER_CONTROL;
 
-       if ((sc->sc_ah->opmode == NL80211_IFTYPE_STATION) &&
+       if ((common->opmode == NL80211_IFTYPE_STATION) &&
            !(sc->rx.rxfilter & FIF_BCN_PRBRESP_PROMISC))
                rfilt |= ATH9K_RX_FILTER_MYBEACON;
        else
@@ -247,7 +248,7 @@ u32 ath_calcrxfilter(struct ath_softc *sc)
 
        if ((AR_SREV_9280_10_OR_LATER(sc->sc_ah) ||
            AR_SREV_9285_10_OR_LATER(sc->sc_ah)) &&
-           (sc->sc_ah->opmode == NL80211_IFTYPE_AP) &&
+           (common->opmode == NL80211_IFTYPE_AP) &&
            (sc->rx.rxfilter & FIF_PSPOLL))
                rfilt |= ATH9K_RX_FILTER_PSPOLL;
 
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c 
b/drivers/net/wireless/ath/ath9k/xmit.c
index 1e813bb..9b4229a 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -298,6 +298,8 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, 
struct ath_txq *txq,
        struct ath_buf *bf_next, *bf_last = bf->bf_lastbf;
        struct ath_desc *ds = bf_last->bf_desc;
        struct list_head bf_head, bf_pending;
+       struct ath_common *common = ath9k_hw_common(sc->sc_ah);
+
        u16 seq_st = 0, acked_cnt = 0, txfail_cnt = 0;
        u32 ba[WME_BA_BMP_SIZE >> 5];
        int isaggr, txfail, txpending, sendbar = 0, needreset = 0, nbad = 0;
@@ -337,7 +339,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, 
struct ath_txq *txq,
                         * when perform internal reset in this routine.
                         * Only enable reset in STA mode for now.
                         */
-                       if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION)
+                       if (common->opmode == NL80211_IFTYPE_STATION)
                                needreset = 1;
                }
        }
-- 
1.6.3.3


_______________________________________________
ath5k-devel mailing list
ath5k-devel@lists.ath5k.org
https://lists.ath5k.org/mailman/listinfo/ath5k-devel

Reply via email to