Commit b002a4a9 authored by Luis R. Rodriguez's avatar Luis R. Rodriguez Committed by John W. Linville

atheros: add ieee80211_hw to ath_common

Make use of it on hw code in ath9k to avoid
using the ath9k ath_softc.
Signed-off-by: default avatarLuis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 13b81559
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/if_ether.h> #include <linux/if_ether.h>
#include <net/mac80211.h>
static const u8 ath_bcast_mac[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; static const u8 ath_bcast_mac[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
...@@ -46,6 +47,7 @@ struct ath_ops { ...@@ -46,6 +47,7 @@ struct ath_ops {
struct ath_common { struct ath_common {
void *ah; void *ah;
struct ieee80211_hw *hw;
u16 cachelsz; u16 cachelsz;
u16 curaid; u16 curaid;
u8 macaddr[ETH_ALEN]; u8 macaddr[ETH_ALEN];
......
...@@ -594,6 +594,7 @@ ath5k_pci_probe(struct pci_dev *pdev, ...@@ -594,6 +594,7 @@ ath5k_pci_probe(struct pci_dev *pdev,
common = ath5k_hw_common(sc->ah); common = ath5k_hw_common(sc->ah);
common->ops = &ath5k_common_ops; common->ops = &ath5k_common_ops;
common->ah = sc->ah; common->ah = sc->ah;
common->hw = hw;
common->cachelsz = csz << 2; /* convert to bytes */ common->cachelsz = csz << 2; /* convert to bytes */
/* Initialize device */ /* Initialize device */
......
...@@ -271,7 +271,7 @@ static void ath9k_ani_restart(struct ath_hw *ah) ...@@ -271,7 +271,7 @@ static void ath9k_ani_restart(struct ath_hw *ah)
static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah) static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah)
{ {
struct ieee80211_conf *conf = &ah->ah_sc->hw->conf; struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf;
struct ar5416AniState *aniState; struct ar5416AniState *aniState;
int32_t rssi; int32_t rssi;
...@@ -343,7 +343,7 @@ static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah) ...@@ -343,7 +343,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) static void ath9k_hw_ani_cck_err_trigger(struct ath_hw *ah)
{ {
struct ieee80211_conf *conf = &ah->ah_sc->hw->conf; struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf;
struct ar5416AniState *aniState; struct ar5416AniState *aniState;
int32_t rssi; int32_t rssi;
......
...@@ -278,7 +278,7 @@ static bool ath9k_hw_per_calibration(struct ath_hw *ah, ...@@ -278,7 +278,7 @@ static bool ath9k_hw_per_calibration(struct ath_hw *ah,
static bool ath9k_hw_iscal_supported(struct ath_hw *ah, static bool ath9k_hw_iscal_supported(struct ath_hw *ah,
enum ath9k_cal_types calType) enum ath9k_cal_types calType)
{ {
struct ieee80211_conf *conf = &ah->ah_sc->hw->conf; struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf;
switch (calType & ah->supp_cals) { switch (calType & ah->supp_cals) {
case IQ_MISMATCH_CAL: /* Both 2 GHz and 5 GHz support OFDM */ case IQ_MISMATCH_CAL: /* Both 2 GHz and 5 GHz support OFDM */
...@@ -555,7 +555,7 @@ static void ath9k_hw_adc_dccal_calibrate(struct ath_hw *ah, u8 numChains) ...@@ -555,7 +555,7 @@ static void ath9k_hw_adc_dccal_calibrate(struct ath_hw *ah, u8 numChains)
/* This is done for the currently configured channel */ /* This is done for the currently configured channel */
bool ath9k_hw_reset_calvalid(struct ath_hw *ah) bool ath9k_hw_reset_calvalid(struct ath_hw *ah)
{ {
struct ieee80211_conf *conf = &ah->ah_sc->hw->conf; struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf;
struct ath9k_cal_list *currCal = ah->cal_list_curr; struct ath9k_cal_list *currCal = ah->cal_list_curr;
if (!ah->curchan) if (!ah->curchan)
......
...@@ -40,7 +40,7 @@ static void ath9k_hw_spur_mitigate(struct ath_hw *ah, struct ath9k_channel *chan ...@@ -40,7 +40,7 @@ static void ath9k_hw_spur_mitigate(struct ath_hw *ah, struct ath9k_channel *chan
static u32 ath9k_hw_mac_usec(struct ath_hw *ah, u32 clks) static u32 ath9k_hw_mac_usec(struct ath_hw *ah, u32 clks)
{ {
struct ieee80211_conf *conf = &ah->ah_sc->hw->conf; struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf;
if (!ah->curchan) /* should really check for CCK instead */ if (!ah->curchan) /* should really check for CCK instead */
return clks / ATH9K_CLOCK_RATE_CCK; return clks / ATH9K_CLOCK_RATE_CCK;
...@@ -52,7 +52,7 @@ static u32 ath9k_hw_mac_usec(struct ath_hw *ah, u32 clks) ...@@ -52,7 +52,7 @@ static u32 ath9k_hw_mac_usec(struct ath_hw *ah, u32 clks)
static u32 ath9k_hw_mac_to_usec(struct ath_hw *ah, u32 clks) static u32 ath9k_hw_mac_to_usec(struct ath_hw *ah, u32 clks)
{ {
struct ieee80211_conf *conf = &ah->ah_sc->hw->conf; struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf;
if (conf_is_ht40(conf)) if (conf_is_ht40(conf))
return ath9k_hw_mac_usec(ah, clks) / 2; return ath9k_hw_mac_usec(ah, clks) / 2;
...@@ -62,7 +62,7 @@ static u32 ath9k_hw_mac_to_usec(struct ath_hw *ah, u32 clks) ...@@ -62,7 +62,7 @@ static u32 ath9k_hw_mac_to_usec(struct ath_hw *ah, u32 clks)
static u32 ath9k_hw_mac_clks(struct ath_hw *ah, u32 usecs) static u32 ath9k_hw_mac_clks(struct ath_hw *ah, u32 usecs)
{ {
struct ieee80211_conf *conf = &ah->ah_sc->hw->conf; struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf;
if (!ah->curchan) /* should really check for CCK instead */ if (!ah->curchan) /* should really check for CCK instead */
return usecs *ATH9K_CLOCK_RATE_CCK; return usecs *ATH9K_CLOCK_RATE_CCK;
...@@ -73,7 +73,7 @@ static u32 ath9k_hw_mac_clks(struct ath_hw *ah, u32 usecs) ...@@ -73,7 +73,7 @@ static u32 ath9k_hw_mac_clks(struct ath_hw *ah, u32 usecs)
static u32 ath9k_hw_mac_to_clks(struct ath_hw *ah, u32 usecs) static u32 ath9k_hw_mac_to_clks(struct ath_hw *ah, u32 usecs)
{ {
struct ieee80211_conf *conf = &ah->ah_sc->hw->conf; struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf;
if (conf_is_ht40(conf)) if (conf_is_ht40(conf))
return ath9k_hw_mac_clks(ah, usecs) * 2; return ath9k_hw_mac_clks(ah, usecs) * 2;
......
...@@ -437,6 +437,7 @@ struct ath_gen_timer_table { ...@@ -437,6 +437,7 @@ struct ath_gen_timer_table {
}; };
struct ath_hw { struct ath_hw {
struct ieee80211_hw *hw;
struct ath_softc *ah_sc; struct ath_softc *ah_sc;
struct ath_common common; struct ath_common common;
struct ath9k_hw_version hw_version; struct ath9k_hw_version hw_version;
......
...@@ -1571,6 +1571,7 @@ static int ath_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid) ...@@ -1571,6 +1571,7 @@ static int ath_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid)
common = ath9k_hw_common(ah); common = ath9k_hw_common(ah);
common->ops = &ath9k_common_ops; common->ops = &ath9k_common_ops;
common->ah = ah; common->ah = ah;
common->hw = sc->hw;
/* /*
* Cache line size is used to size and align various * Cache line size is used to size and align various
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment