]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
ath9k: Simplify ar9003_hw_tx99_set_txpower
authorHelmut Schaa <helmut.schaa@googlemail.com>
Thu, 28 Apr 2016 14:45:06 +0000 (16:45 +0200)
committerKalle Valo <kvalo@qca.qualcomm.com>
Mon, 9 May 2016 17:46:51 +0000 (20:46 +0300)
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>
drivers/net/wireless/ath/ath9k/ar9003_phy.c

index 2f15cbcbc736b14a0ff82e8e04111abfb0f4d2f1..81ab3ca2f1e0bd05285d72ce776969fe806a6afd 100644 (file)
@@ -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);
 }