summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorHelmut Schaa <helmut.schaa@googlemail.com>2016-04-28 16:45:06 +0200
committerKalle Valo <kvalo@qca.qualcomm.com>2016-05-09 20:46:51 +0300
commitb0291715d31c891bcb5de936271881f58600f7c1 (patch)
tree0e1569f2e43b1e8d3e8eb4d32a246677120805ae /drivers/net
parente7ae328961ffcf78bb18d0ecdb1e5a50d1185336 (diff)
downloadlinux-b0291715d31c891bcb5de936271881f58600f7c1.tar.gz
linux-b0291715d31c891bcb5de936271881f58600f7c1.tar.bz2
linux-b0291715d31c891bcb5de936271881f58600f7c1.zip
ath9k: Simplify ar9003_hw_tx99_set_txpower
There's no need to keep the same for loop twice in the code. Move the txpower cap before the loop to reduce code complexity. Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_phy.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
index 2f15cbcbc736..81ab3ca2f1e0 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
@@ -1844,13 +1844,9 @@ static void ar9003_hw_tx99_set_txpower(struct ath_hw *ah, u8 txpower)
static u8 p_pwr_array[ar9300RateSize] = { 0 };
unsigned int i;
- if (txpower <= MAX_RATE_POWER) {
- for (i = 0; i < ar9300RateSize; i++)
- p_pwr_array[i] = txpower;
- } else {
- for (i = 0; i < ar9300RateSize; i++)
- p_pwr_array[i] = MAX_RATE_POWER;
- }
+ txpower = txpower <= MAX_RATE_POWER ? txpower : MAX_RATE_POWER;
+ for (i = 0; i < ar9300RateSize; i++)
+ p_pwr_array[i] = txpower;
ar9003_hw_tx_power_regwrite(ah, p_pwr_array);
}