625bd425b41057f1939df60668d45bb40e15eba3
[openwrt.git] / package / kernel / mac80211 / patches / 341-ath9k_common-always-update-value-in-ath9k_cmn_update.patch
1 From: Felix Fietkau <nbd@openwrt.org>
2 Date: Wed, 22 Oct 2014 18:16:14 +0200
3 Subject: [PATCH] ath9k_common: always update value in
4  ath9k_cmn_update_txpow
5
6 In some cases the limit may be the same as reg->power_limit, but the
7 actual value that the hardware uses is not up to date. In that case, a
8 wrong value for current tx power is tracked internally.
9 Fix this by unconditionally updating it.
10
11 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
12 ---
13
14 --- a/drivers/net/wireless/ath/ath9k/common.c
15 +++ b/drivers/net/wireless/ath/ath9k/common.c
16 @@ -368,11 +368,11 @@ void ath9k_cmn_update_txpow(struct ath_h
17  {
18         struct ath_regulatory *reg = ath9k_hw_regulatory(ah);
19  
20 -       if (reg->power_limit != new_txpow) {
21 +       if (reg->power_limit != new_txpow)
22                 ath9k_hw_set_txpowerlimit(ah, new_txpow, false);
23 -               /* read back in case value is clamped */
24 -               *txpower = reg->max_power_level;
25 -       }
26 +
27 +       /* read back in case value is clamped */
28 +       *txpower = reg->max_power_level;
29  }
30  EXPORT_SYMBOL(ath9k_cmn_update_txpow);
31