ath5k cleanup
cover ath5k cleanup
hi!
this is a series of cleanup patches for ath5k. as the beginning of a larger initiative to merge ath5k_hw and ath5k_softc i have removed the double use of 'opmode' and removed some unused variables in ath5k_hw. please check if anyone still needs these definitions...
thanks,
bruno
---
Bruno Randolf (4):
ath5k: remove ah_gpio_npins
ath5k: remove ah_mac_revision
ath5k: remove ah_magic
ath5k: remove double opmode definition
drivers/net/wireless/ath/ath5k/ath5k.h | 7 +------ drivers/net/wireless/ath/ath5k/attach.c | 4 +--- drivers/net/wireless/ath/ath5k/base.c | 7 ++++--- drivers/net/wireless/ath/ath5k/caps.c | 3 --- drivers/net/wireless/ath/ath5k/desc.c | 6 ------ drivers/net/wireless/ath/ath5k/eeprom.h | 3 --- drivers/net/wireless/ath/ath5k/pcu.c | 14 +++++++------- drivers/net/wireless/ath/ath5k/reset.c | 9 ++------- 8 files changed, 15 insertions(+), 38 deletions(-)
Signature · 1 line
Signature
PATCH 1/4 ath5k: remove double opmode definition
opmode (operating mode) was defined in struct ath5k_hw and struct ath5k_softc. remove it from ath5k_hw and use only from ath5k_softc (sc->opmode).
(btw: what's the meaning of opmode when we have multiple interfaces?)
---
drivers/net/wireless/ath/ath5k/ath5k.h | 3 +-- drivers/net/wireless/ath/ath5k/attach.c | 3 +-- drivers/net/wireless/ath/ath5k/base.c | 7 ++++--- drivers/net/wireless/ath/ath5k/pcu.c | 14 +++++++------- drivers/net/wireless/ath/ath5k/reset.c | 9 ++------- 5 files changed, 15 insertions(+), 21 deletions(-)
drivers/net/wireless/ath/ath5k/ath5k.h +1 -2
@@ -1036,7 +1036,6 @@ struct ath5k_hw {enum ath5k_int ah_imr; -enum nl80211_iftype ah_op_mode;struct ieee80211_channel *ah_current_channel;bool ah_turbo;bool ah_calibration;
@@ -1199,7 +1198,7 @@ extern int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac);extern bool ath5k_eeprom_is_hb63 (struct ath5k_hw *ah);/* Protocol Control Unit Functions */ -extern int ath5k_hw_set_opmode (struct ath5k_hw *ah); +extern int ath5k_hw_set_opmode (struct ath5k_hw *ah,enum nl80211_iftype opmode);extern void ath5k_hw_set_coverage_class (struct ath5k_hw *ah,u8 coverage_class);/* BSSID Functions */ extern int ath5k_hw_set_lladdr (struct ath5k_hw *ah,const u8 *mac);
drivers/net/wireless/ath/ath5k/attach.c +1 -2
@@ -113,7 +113,6 @@ int ath5k_hw_attach(struct ath5k_softc *sc)/* * HW information */ - ah->ah_op_mode =NL80211_IFTYPE_STATION ; ah->ah_radar.r_enabled =AR5K_TUNE_RADAR_ALERT ; ah->ah_turbo = false; ah->ah_txpower.txp_tpc =AR5K_TUNE_TPC_TXPOWER ;
@@ -328,7 +327,7 @@ int ath5k_hw_attach(struct ath5k_softc *sc)/* Set BSSID to bcast address: ff:ff:ff:ff:ff:ff for now */ memcpy (common->curbssid, ath_bcast_mac,ETH_ALEN );ath5k_hw_set_associd (ah); -ath5k_hw_set_opmode (ah); +ath5k_hw_set_opmode (ah, sc->opmode);ath5k_hw_rfgain_opt_init (ah);
drivers/net/wireless/ath/ath5k/base.c +4 -3
@@ -1137,8 +1137,6 @@ ath5k_mode_setup(struct ath5k_softc *sc)struct ath5k_hw *ah = sc->ah;u32 rfilt; - ah->ah_op_mode = sc->opmode; -/* configure rx filter */ rfilt = sc->filter_flags;ath5k_hw_set_rx_filter (ah, rfilt);
@@ -1147,8 +1145,9 @@ ath5k_mode_setup(struct ath5k_softc *sc)ath5k_hw_set_bssid_mask (ah, sc->bssidmask);/* configure operational mode */ -ath5k_hw_set_opmode (ah); +ath5k_hw_set_opmode (ah, sc->opmode); +ATH5K_DBG (sc,ATH5K_DEBUG_MODE ,"mode setup opmode %d\n" , sc->opmode);ATH5K_DBG (sc,ATH5K_DEBUG_MODE ,"RX filter 0x%x\n" , rfilt); }
@@ -2855,6 +2854,8 @@ static int ath5k_add_interface(struct ieee80211_hw *hw, goto end; } +ATH5K_DBG (sc,ATH5K_DEBUG_MODE ,"add interface mode %d\n" , sc->opmode); +ath5k_hw_set_lladdr (sc->ah, vif->addr);ath5k_mode_setup (sc);
drivers/net/wireless/ath/ath5k/pcu.c +7 -7
@@ -39,16 +39,16 @@* ath5k_hw_set_opmode - Set PCU operating mode * * @ah: The &struct ath5k_hw +* @op_mode: &enum nl80211_iftype operating mode * * Initialize PCU for the various operating modes (AP/STA etc) -* -* NOTE: ah->ah_op_mode must be set before calling this. */ -int ath5k_hw_set_opmode (struct ath5k_hw *ah) +int ath5k_hw_set_opmode (struct ath5k_hw *ah,enum nl80211_iftype op_mode) {struct ath_common *common =ath5k_hw_common (ah);u32 pcu_reg, beacon_reg, low_id, high_id; +ATH5K_DBG (ah->ah_sc,ATH5K_DEBUG_MODE ,"mode %d\n" , op_mode);/* Preserve rest settings */ pcu_reg =ath5k_hw_reg_read (ah,AR5K_STA_ID1 ) &0xffff0000 ;
@@ -61,7 +61,7 @@ int ath5k_hw_set_opmode(struct ath5k_hw *ah)ATH5K_TRACE (ah->ah_sc); -switch (ah->ah_op_mode) { +switch (op_mode) {case NL80211_IFTYPE_ADHOC : pcu_reg |=AR5K_STA_ID1_ADHOC |AR5K_STA_ID1_KEYSRCH_MODE ; beacon_reg |=AR5K_BCR_ADHOC ;
@@ -651,7 +651,7 @@ void ath5k_hw_init_beacon(struct ath5k_hw *ah, u32 next_beacon, u32 interval)/* * Set the additional timers by mode */ -switch (ah->ah_op_mode) { +switch (ah->ah_sc->opmode) {case NL80211_IFTYPE_MONITOR :case NL80211_IFTYPE_STATION :/* In STA mode timer1 is used as next wakeup
@@ -688,8 +688,8 @@ void ath5k_hw_init_beacon(struct ath5k_hw *ah, u32 next_beacon, u32 interval)* Set the beacon register and enable all timers. */ /* When in AP or Mesh Point mode zero timer0 to start TSF */ -if (ah->ah_op_mode ==NL80211_IFTYPE_AP || - ah->ah_op_mode ==NL80211_IFTYPE_MESH_POINT ) +if (ah->ah_sc->opmode ==NL80211_IFTYPE_AP || + ah->ah_sc->opmode ==NL80211_IFTYPE_MESH_POINT )ath5k_hw_reg_write (ah,0 ,AR5K_TIMER0 );ath5k_hw_reg_write (ah, next_beacon,AR5K_TIMER0 );
drivers/net/wireless/ath/ath5k/reset.c +2 -7
@@ -1014,11 +1014,6 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,if (ret)return ret; -/* -* Initialize operating mode -*/ - ah->ah_op_mode = op_mode; -/* PHY access enable */ if (ah->ah_mac_srev >=AR5K_SREV_AR5211 )ath5k_hw_reg_write (ah,AR5K_PHY_SHIFT_5GHZ ,AR5K_PHY (0 ));
@@ -1189,7 +1184,7 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,ath5k_hw_set_associd (ah);/* Set PCU config */ -ath5k_hw_set_opmode (ah); +ath5k_hw_set_opmode (ah, op_mode);/* Clear any pending interrupts * PISR/SISR Not available on 5210 */
@@ -1375,7 +1370,7 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,* external 32KHz crystal when sleeping if one * exists */ if (ah->ah_version ==AR5K_AR5212 && - ah->ah_op_mode !=NL80211_IFTYPE_AP ) + op_mode !=NL80211_IFTYPE_AP )ath5k_hw_set_sleep_clock (ah, true);/*
PATCH 2/4 ath5k: remove ah_magic
In reply to Bruno Randolfit's never used. probably a leftover from the old OpenHAL days...
---
drivers/net/wireless/ath/ath5k/ath5k.h | 1 - drivers/net/wireless/ath/ath5k/desc.c | 6 ------ drivers/net/wireless/ath/ath5k/eeprom.h | 3 --- 3 files changed, 0 insertions(+), 10 deletions(-)
drivers/net/wireless/ath/ath5k/ath5k.h +0 -1
@@ -1028,7 +1028,6 @@ struct ath5k_nfcal_hist/* TODO: Clean up and merge with ath5k_softc */ struct ath5k_hw { -u32 ah_magic;struct ath_common common;struct ath5k_softc *ah_sc;
drivers/net/wireless/ath/ath5k/desc.c +0 -6
@@ -668,12 +668,6 @@ int ath5k_hw_init_desc_functions(struct ath5k_hw *ah) ah->ah_version != AR5K_AR5212)return -ENOTSUPP ; -/* XXX: What is this magic value and where is it used ? */ -if (ah->ah_version ==AR5K_AR5212 ) - ah->ah_magic =AR5K_EEPROM_MAGIC_5212 ; -else if (ah->ah_version ==AR5K_AR5211 ) - ah->ah_magic =AR5K_EEPROM_MAGIC_5211 ; -if (ah->ah_version ==AR5K_AR5212 ) { ah->ah_setup_rx_desc = ath5k_hw_setup_rx_desc; ah->ah_setup_tx_desc = ath5k_hw_setup_4word_tx_desc;
drivers/net/wireless/ath/ath5k/eeprom.h +0 -3
@@ -24,9 +24,6 @@* SERDES infos are present */ #define AR5K_EEPROM_MAGIC 0x003d/* EEPROM Magic number */ #define AR5K_EEPROM_MAGIC_VALUE 0x5aa5/* Default - found on EEPROM */ -#define AR5K_EEPROM_MAGIC_5212 0x0000145c/* 5212 */ -#define AR5K_EEPROM_MAGIC_5211 0x0000145b/* 5211 */ -#define AR5K_EEPROM_MAGIC_5210 0x0000145a/* 5210 */ #define AR5K_EEPROM_IS_HB63 0x000b/* Talon detect */
PATCH 3/4 ath5k: remove ah_mac_revision
In reply to Bruno Randolfit's not used, and we have ah_mac_srev.
---
drivers/net/wireless/ath/ath5k/ath5k.h | 1 - drivers/net/wireless/ath/ath5k/attach.c | 1 - 2 files changed, 0 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath5k/ath5k.h +0 -1
@@ -1047,7 +1047,6 @@ struct ath5k_hw {u32 ah_phy;u32 ah_mac_srev;u16 ah_mac_version; -u16 ah_mac_revision;u16 ah_phy_revision;u16 ah_radio_5ghz_revision;u16 ah_radio_2ghz_revision;
drivers/net/wireless/ath/ath5k/attach.c +0 -1
@@ -148,7 +148,6 @@ int ath5k_hw_attach(struct ath5k_softc *sc)/* Get MAC, PHY and RADIO revisions */ ah->ah_mac_srev = srev; ah->ah_mac_version =AR5K_REG_MS (srev,AR5K_SREV_VER ); - ah->ah_mac_revision =AR5K_REG_MS (srev,AR5K_SREV_REV ); ah->ah_phy_revision =ath5k_hw_reg_read (ah,AR5K_PHY_CHIP_ID ) &0xffffffff ; ah->ah_radio_5ghz_revision = ath5k_hw_radio_revision(ah,
PATCH 4/4 ath5k: remove ah_gpio_npins
In reply to Bruno Randolfit's never used and we have a newer implementation in gpio.c.
---
drivers/net/wireless/ath/ath5k/ath5k.h | 2 -- drivers/net/wireless/ath/ath5k/caps.c | 3 --- 2 files changed, 0 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath5k/ath5k.h +0 -2
@@ -1068,8 +1068,6 @@ struct ath5k_hw {u8 ah_def_ant;bool ah_software_retry; -int ah_gpio_npins; -struct ath5k_capabilities ah_capabilities;struct ath5k_txq_info ah_txq[AR5K_NUM_TX_QUEUES ];
drivers/net/wireless/ath/ath5k/caps.c +0 -3
@@ -102,9 +102,6 @@ int ath5k_hw_set_capabilities(struct ath5k_hw *ah) } } -/* GPIO */ - ah->ah_gpio_npins =AR5K_NUM_GPIO ; -/* Set number of supported TX queues */ if (ah->ah_version ==AR5K_AR5210 ) ah->ah_capabilities.cap_queues.q_tx_num =