Skip to content

Commit

Permalink
ath9k: Simplify ANI initialization
Browse files Browse the repository at this point in the history
The check "enable_ani" is not required since it is always
set to true and the logic for disabling/enabling ANI via
debugfs is done at a higher layer.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Sujith Manoharan authored and John W. Linville committed Jun 3, 2013
1 parent 380013f commit e323300
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 27 deletions.
13 changes: 5 additions & 8 deletions drivers/net/wireless/ath/ath9k/ani.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static void ath9k_ani_restart(struct ath_hw *ah)
{
struct ar5416AniState *aniState;

if (!DO_ANI(ah))
if (!ah->curchan)
return;

aniState = &ah->curchan->ani;
Expand Down Expand Up @@ -195,7 +195,7 @@ static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah)
{
struct ar5416AniState *aniState;

if (!DO_ANI(ah))
if (!ah->curchan)
return;

aniState = &ah->curchan->ani;
Expand Down Expand Up @@ -251,7 +251,7 @@ static void ath9k_hw_ani_cck_err_trigger(struct ath_hw *ah)
{
struct ar5416AniState *aniState;

if (!DO_ANI(ah))
if (!ah->curchan)
return;

aniState = &ah->curchan->ani;
Expand Down Expand Up @@ -297,7 +297,7 @@ void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning)
struct ath_common *common = ath9k_hw_common(ah);
int ofdm_nil, cck_nil;

if (!DO_ANI(ah))
if (!ah->curchan)
return;

BUG_ON(aniState == NULL);
Expand Down Expand Up @@ -415,7 +415,7 @@ void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan)
struct ath_common *common = ath9k_hw_common(ah);
u32 ofdmPhyErrRate, cckPhyErrRate;

if (!DO_ANI(ah))
if (!ah->curchan)
return;

aniState = &ah->curchan->ani;
Expand Down Expand Up @@ -524,9 +524,6 @@ void ath9k_hw_ani_init(struct ath_hw *ah)
ah->aniperiod = ATH9K_ANI_PERIOD;
ah->config.ani_poll_interval = ATH9K_ANI_POLLINTERVAL;

if (ah->config.enable_ani)
ah->proc_phyerr |= HAL_PROCESS_ANI;

ath9k_ani_restart(ah);
ath9k_enable_mib_counters(ah);
}
4 changes: 0 additions & 4 deletions drivers/net/wireless/ath/ath9k/ani.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
#ifndef ANI_H
#define ANI_H

#define HAL_PROCESS_ANI 0x00000001

#define DO_ANI(ah) (((ah)->proc_phyerr & HAL_PROCESS_ANI) && ah->curchan)

#define BEACON_RSSI(ahp) (ahp->stats.avgbrssi)

/* units are errors per second */
Expand Down
6 changes: 2 additions & 4 deletions drivers/net/wireless/ath/ath9k/htc_drv_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -814,8 +814,7 @@ void ath9k_htc_ani_work(struct work_struct *work)
}

/* Verify whether we must check ANI */
if (ah->config.enable_ani &&
(timestamp - common->ani.checkani_timer) >= ATH_ANI_POLLINTERVAL) {
if ((timestamp - common->ani.checkani_timer) >= ATH_ANI_POLLINTERVAL) {
aniflag = true;
common->ani.checkani_timer = timestamp;
}
Expand Down Expand Up @@ -845,8 +844,7 @@ void ath9k_htc_ani_work(struct work_struct *work)
* short calibration and long calibration.
*/
cal_interval = ATH_LONG_CALINTERVAL;
if (ah->config.enable_ani)
cal_interval = min(cal_interval, (u32)ATH_ANI_POLLINTERVAL);
cal_interval = min(cal_interval, (u32)ATH_ANI_POLLINTERVAL);
if (!common->ani.caldone)
cal_interval = min(cal_interval, (u32)short_cal_interval);

Expand Down
4 changes: 1 addition & 3 deletions drivers/net/wireless/ath/ath9k/hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,6 @@ static void ath9k_hw_init_config(struct ath_hw *ah)
ah->config.pcie_clock_req = 0;
ah->config.pcie_waen = 0;
ah->config.analog_shiftreg = 1;
ah->config.enable_ani = true;

for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
ah->config.spurchans[i][0] = AR_NO_SPUR;
Expand Down Expand Up @@ -549,8 +548,7 @@ static int ath9k_hw_post_init(struct ath_hw *ah)
ah->eep_ops->get_eeprom_ver(ah),
ah->eep_ops->get_eeprom_rev(ah));

if (ah->config.enable_ani)
ath9k_hw_ani_init(ah);
ath9k_hw_ani_init(ah);

return 0;
}
Expand Down
2 changes: 0 additions & 2 deletions drivers/net/wireless/ath/ath9k/hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ struct ath9k_ops_config {
u32 ofdm_trig_high;
u32 cck_trig_high;
u32 cck_trig_low;
u32 enable_ani;
u32 enable_paprd;
int serialize_regmode;
bool rx_intr_mitigation;
Expand Down Expand Up @@ -852,7 +851,6 @@ struct ath_hw {
u32 globaltxtimeout;

/* ANI */
u32 proc_phyerr;
u32 aniperiod;
enum ath9k_ani_cmd ani_function;
u32 ani_skip_count;
Expand Down
8 changes: 2 additions & 6 deletions drivers/net/wireless/ath/ath9k/link.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,7 @@ void ath_ani_calibrate(unsigned long data)
}

/* Verify whether we must check ANI */
if (sc->sc_ah->config.enable_ani
&& (timestamp - common->ani.checkani_timer) >=
ah->config.ani_poll_interval) {
if ((timestamp - common->ani.checkani_timer) >= ah->config.ani_poll_interval) {
aniflag = true;
common->ani.checkani_timer = timestamp;
}
Expand Down Expand Up @@ -427,9 +425,7 @@ void ath_ani_calibrate(unsigned long data)
* short calibration and long calibration.
*/
cal_interval = ATH_LONG_CALINTERVAL;
if (sc->sc_ah->config.enable_ani)
cal_interval = min(cal_interval,
(u32)ah->config.ani_poll_interval);
cal_interval = min(cal_interval, (u32)ah->config.ani_poll_interval);
if (!common->ani.caldone)
cal_interval = min(cal_interval, (u32)short_cal_interval);

Expand Down

0 comments on commit e323300

Please sign in to comment.