diff mbox

[3/3] ath9k: Simplify ar9003_hw_tx99_set_txpower

Message ID 1461854706-10494-3-git-send-email-helmut.schaa@googlemail.com (mailing list archive)
State Accepted
Commit e049790ed1be48928ac6d368b1ca761f3b072be4
Delegated to: Kalle Valo
Headers show

Commit Message

Helmut Schaa April 28, 2016, 2:45 p.m. UTC
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>
---
 drivers/net/wireless/ath/ath9k/ar9003_phy.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
diff mbox

Patch

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
index 2f15cbc..81ab3ca 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);
 }