linux/atheros: fix another 2.6.36 patch issue
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 528-ath9k_ani_listen_time_fix.patch
1 --- a/drivers/net/wireless/ath/ath9k/ani.c
2 +++ b/drivers/net/wireless/ath/ath9k/ani.c
3 @@ -633,7 +633,7 @@ void ath9k_ani_reset(struct ath_hw *ah,
4 REGWRITE_BUFFER_FLUSH(ah);
5 }
6
7 -static void ath9k_hw_ani_read_counters(struct ath_hw *ah)
8 +static bool ath9k_hw_ani_read_counters(struct ath_hw *ah)
9 {
10 struct ath_common *common = ath9k_hw_common(ah);
11 struct ar5416AniState *aniState = &ah->curchan->ani;
12 @@ -646,10 +646,10 @@ static void ath9k_hw_ani_read_counters(s
13 ath_hw_cycle_counters_update(common);
14 listenTime = ath_hw_get_listen_time(common);
15
16 - if (listenTime < 0) {
17 + if (listenTime <= 0) {
18 ah->stats.ast_ani_lneg++;
19 ath9k_ani_restart(ah);
20 - return;
21 + return false;
22 }
23
24 if (!use_new_ani(ah)) {
25 @@ -683,7 +683,7 @@ static void ath9k_hw_ani_read_counters(s
26 REG_WRITE(ah, AR_PHY_ERR_MASK_2,
27 AR_PHY_ERR_CCK_TIMING);
28 }
29 - return;
30 + return false;
31 }
32
33 ofdmPhyErrCnt = phyCnt1 - ofdm_base;
34 @@ -695,7 +695,7 @@ static void ath9k_hw_ani_read_counters(s
35 ah->stats.ast_ani_cckerrs +=
36 cckPhyErrCnt - aniState->cckPhyErrCount;
37 aniState->cckPhyErrCount = cckPhyErrCnt;
38 -
39 + return true;
40 }
41
42 void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan)
43 @@ -711,7 +711,8 @@ void ath9k_hw_ani_monitor(struct ath_hw
44 if (WARN_ON(!aniState))
45 return;
46
47 - ath9k_hw_ani_read_counters(ah);
48 + if (!ath9k_hw_ani_read_counters(ah))
49 + return;
50
51 ofdmPhyErrRate = aniState->ofdmPhyErrCount * 1000 /
52 aniState->listenTime;