[package] uhttpd: finish inherited uloop in forked childs, fixes misdispatched events...
[openwrt.git] / package / mac80211 / patches / 577-ath9k_fix_noise_immunity.patch
1 --- a/drivers/net/wireless/ath/ath9k/ani.c
2 +++ b/drivers/net/wireless/ath/ath9k/ani.c
3 @@ -154,9 +154,7 @@ static void ath9k_hw_set_ofdm_nil(struct
4                 aniState->rssiThrLow, aniState->rssiThrHigh);
5  
6         if (aniState->update_ani)
7 -               aniState->ofdmNoiseImmunityLevel =
8 -                       (immunityLevel > ATH9K_ANI_OFDM_DEF_LEVEL) ?
9 -                       immunityLevel : ATH9K_ANI_OFDM_DEF_LEVEL;
10 +               aniState->ofdmNoiseImmunityLevel = immunityLevel;
11  
12         entry_ofdm = &ofdm_level_table[aniState->ofdmNoiseImmunityLevel];
13         entry_cck = &cck_level_table[aniState->cckNoiseImmunityLevel];
14 @@ -217,9 +215,7 @@ static void ath9k_hw_set_cck_nil(struct 
15                 immunityLevel = ATH9K_ANI_CCK_MAX_LEVEL_LOW_RSSI;
16  
17         if (aniState->update_ani)
18 -               aniState->cckNoiseImmunityLevel =
19 -                       (immunityLevel > ATH9K_ANI_CCK_DEF_LEVEL) ?
20 -                       immunityLevel : ATH9K_ANI_CCK_DEF_LEVEL;
21 +               aniState->cckNoiseImmunityLevel = immunityLevel;
22  
23         entry_ofdm = &ofdm_level_table[aniState->ofdmNoiseImmunityLevel];
24         entry_cck = &cck_level_table[aniState->cckNoiseImmunityLevel];
25 @@ -285,6 +281,7 @@ void ath9k_ani_reset(struct ath_hw *ah, 
26         struct ar5416AniState *aniState = &ah->curchan->ani;
27         struct ath9k_channel *chan = ah->curchan;
28         struct ath_common *common = ath9k_hw_common(ah);
29 +       int ofdm_nil, cck_nil;
30  
31         if (!DO_ANI(ah))
32                 return;
33 @@ -306,6 +303,11 @@ void ath9k_ani_reset(struct ath_hw *ah, 
34         /* always allow mode (on/off) to be controlled */
35         ah->ani_function |= ATH9K_ANI_MODE;
36  
37 +       ofdm_nil = max_t(int, ATH9K_ANI_OFDM_DEF_LEVEL,
38 +                        aniState->ofdmNoiseImmunityLevel);
39 +       cck_nil = max_t(int, ATH9K_ANI_CCK_DEF_LEVEL,
40 +                        aniState->cckNoiseImmunityLevel);
41 +
42         if (is_scanning ||
43             (ah->opmode != NL80211_IFTYPE_STATION &&
44              ah->opmode != NL80211_IFTYPE_ADHOC)) {
45 @@ -329,8 +331,8 @@ void ath9k_ani_reset(struct ath_hw *ah, 
46                                 aniState->cckNoiseImmunityLevel);
47  
48                         aniState->update_ani = false;
49 -                       ath9k_hw_set_ofdm_nil(ah, ATH9K_ANI_OFDM_DEF_LEVEL);
50 -                       ath9k_hw_set_cck_nil(ah, ATH9K_ANI_CCK_DEF_LEVEL);
51 +                       ofdm_nil = ATH9K_ANI_OFDM_DEF_LEVEL;
52 +                       cck_nil = ATH9K_ANI_CCK_DEF_LEVEL;
53                 }
54         } else {
55                 /*
56 @@ -346,11 +348,9 @@ void ath9k_ani_reset(struct ath_hw *ah, 
57                         aniState->cckNoiseImmunityLevel);
58  
59                         aniState->update_ani = true;
60 -                       ath9k_hw_set_ofdm_nil(ah,
61 -                                             aniState->ofdmNoiseImmunityLevel);
62 -                       ath9k_hw_set_cck_nil(ah,
63 -                                            aniState->cckNoiseImmunityLevel);
64         }
65 +       ath9k_hw_set_ofdm_nil(ah, ofdm_nil);
66 +       ath9k_hw_set_cck_nil(ah, cck_nil);
67  
68         /*
69          * enable phy counters if hw supports or if not, enable phy