Skip to contentSkip to conversation

wifi: ath9k: remove TX99 power array zero init

PATCH Applied Rosen Penev 3 participants 3 messages May 17 – Jun 6 Qualcomm Atheros ATH9K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: ath9k: remove TX99 power array zero init

This array is fully initialized in the loop itself. No need to zero initialize and then overwrite.

Remove static from the array. This was a holdover from when the array was a static global variable. It no longer confers any benefit.

Also add a min() call to avoid the manual if/ternary operation.

Assisted-by Codex:GPT-5.5
---
 drivers/net/wireless/ath/ath9k/ar9003_phy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/ar9003_phy.c +2 -2
index 6274d1624261..5d0433f2ae37 100644
@@ -1811,10 +1811,10 @@ static void ar9003_hw_tx99_stop(struct ath_hw *ah)
 
 static void ar9003_hw_tx99_set_txpower(struct ath_hw *ah, u8 txpower)
 {
-	static u8 p_pwr_array[ar9300RateSize] = { 0 };
+	u8 p_pwr_array[ar9300RateSize];
 	unsigned int i;
 
-	txpower = txpower <= MAX_RATE_POWER ? txpower : MAX_RATE_POWER;
+	txpower = min(txpower, MAX_RATE_POWER);
 	for (i = 0; i < ar9300RateSize; i++)
 		p_pwr_array[i] = txpower;
 
Signature · 1 line
2.54.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Rosen Penev

This array is fully initialized in the loop itself. No need to zero initialize and then overwrite.

Remove static from the array. This was a holdover from when the array was a static global variable. It no longer confers any benefit.

Also add a min() call to avoid the manual if/ternary operation.

Assisted-by Codex:GPT-5.5
Applied
#2 lore raw
In reply to Rosen Penev
Quoted 9 lines · Rosen Penev

This array is fully initialized in the loop itself. No need to zero initialize and then overwrite.

Remove static from the array. This was a holdover from when the array was a static global variable. It no longer confers any benefit.

Also add a min() call to avoid the manual if/ternary operation.

[...]

Applied, thanks!

[1/1] wifi: ath9k: remove TX99 power array zero init

      commit: 13cdd324cc155200ea328257c746004d898ff3de

Best regards,

Signature · 1 line
Jeff Johnson <[email protected]>