Skip to contentSkip to conversation

wifi: rtw88: Refactor looping in rtw_phy_store_tx_power_by_rate

PATCH In review Mohammed Anees 2 participants 3 messages Oct 17, 2024 – Oct 25, 2024 Realtek wireless driver (rtw88)

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 wifi: rtw88: Refactor looping in rtw_phy_store_tx_power_by_rate

The previous implementation included an unnecessary else condition paired with a continue statement. Since a check is already performed to determine if the band is either 2G or 5G, the else condition will never be triggered. We can remove this check.

---
v2:
- Changed from using a pointer approach to a simpler if-else structure for clarity.

---
 drivers/net/wireless/realtek/rtw88/phy.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/wireless/realtek/rtw88/phy.c +1 -3
index 37ef80c9091d..8b9f8f73c14c 100644
@@ -1470,10 +1470,8 @@ static void rtw_phy_store_tx_power_by_rate(struct rtw_dev *rtwdev,
 		rate = rates[i];
 		if (band == PHY_BAND_2G)
 			hal->tx_pwr_by_rate_offset_2g[rfpath][rate] = offset;
-		else if (band == PHY_BAND_5G)
-			hal->tx_pwr_by_rate_offset_5g[rfpath][rate] = offset;
 		else
-			continue;
+			hal->tx_pwr_by_rate_offset_5g[rfpath][rate] = offset;
 	}
 }
 
Signature · 1 line
2.47.0
maintainer Acked-by on v2 1/1
#1 lore raw
Quoted 8 lines · Mohammed Anees

The previous implementation included an unnecessary else condition paired with a continue statement. Since a check is already performed to determine if the band is either 2G or 5G, the else condition will never be triggered. We can remove this check.

no need this Closes link because of typo of v1. I will remove this during merging.

Quoted 1 line
Quoted 25 lines

---
v2:
- Changed from using a pointer approach to a simpler if-else structure for clarity.

---
 drivers/net/wireless/realtek/rtw88/phy.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/wireless/realtek/rtw88/phy.c +1 -4
index 37ef80c9091d..8b9f8f73c14c 100644
@@ -1470,10 +1470,8 @@ static void rtw_phy_store_tx_power_by_rate(struct rtw_dev *rtwdev,
                rate = rates[i];
                if (band == PHY_BAND_2G)
                        hal->tx_pwr_by_rate_offset_2g[rfpath][rate] = offset;
-               else if (band == PHY_BAND_5G)
-                       hal->tx_pwr_by_rate_offset_5g[rfpath][rate] = offset;
                else
-                       continue;
+                       hal->tx_pwr_by_rate_offset_5g[rfpath][rate] = offset;
        }
 }
 
--

2.47.0

maintainer
#2 lore raw
In reply to Mohammed Anees
Quoted 10 lines · Mohammed Anees

The previous implementation included an unnecessary else condition paired with a continue statement. Since a check is already performed to determine if the band is either 2G or 5G, the else condition will never be triggered. We can remove this check.

1 patch(es) applied to rtw-next branch of rtw.git, thanks.

7846f0b63562 wifi: rtw88: Refactor looping in rtw_phy_store_tx_power_by_rate

---
https://github.com/pkshih/rtw.git