linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] wifi: rtw88: Refactor looping in rtw_phy_store_tx_power_by_rate
@ 2024-10-17  8:06 Mohammed Anees
  2024-10-18  5:32 ` Ping-Ke Shih
  2024-10-25  2:15 ` Ping-Ke Shih
  0 siblings, 2 replies; 3+ messages in thread
From: Mohammed Anees @ 2024-10-17  8:06 UTC (permalink / raw)
  To: linux-wireless, linux-kernel
  Cc: Ping-Ke Shih, Kalle Valo, Mohammed Anees, kernel test robot

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.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202410171143.OnFlgIwK-lkp@intel.com/
Signed-off-by: Mohammed Anees <pvmohammedanees2003@gmail.com>
---
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(-)

diff --git a/drivers/net/wireless/realtek/rtw88/phy.c b/drivers/net/wireless/realtek/rtw88/phy.c
index 37ef80c9091d..8b9f8f73c14c 100644
--- a/drivers/net/wireless/realtek/rtw88/phy.c
+++ b/drivers/net/wireless/realtek/rtw88/phy.c
@@ -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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH v2] wifi: rtw88: Refactor looping in rtw_phy_store_tx_power_by_rate
  2024-10-17  8:06 [PATCH v2] wifi: rtw88: Refactor looping in rtw_phy_store_tx_power_by_rate Mohammed Anees
@ 2024-10-18  5:32 ` Ping-Ke Shih
  2024-10-25  2:15 ` Ping-Ke Shih
  1 sibling, 0 replies; 3+ messages in thread
From: Ping-Ke Shih @ 2024-10-18  5:32 UTC (permalink / raw)
  To: Mohammed Anees, linux-wireless@vger.kernel.org,
	linux-kernel@vger.kernel.org
  Cc: Kalle Valo, kernel test robot

Mohammed Anees <pvmohammedanees2003@gmail.com> wrote:
> 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.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202410171143.OnFlgIwK-lkp@intel.com/

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

> Signed-off-by: Mohammed Anees <pvmohammedanees2003@gmail.com>

Acked-by: Ping-Ke Shih <pkshih@realtek.com>

> ---
> 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(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtw88/phy.c b/drivers/net/wireless/realtek/rtw88/phy.c
> index 37ef80c9091d..8b9f8f73c14c 100644
> --- a/drivers/net/wireless/realtek/rtw88/phy.c
> +++ b/drivers/net/wireless/realtek/rtw88/phy.c
> @@ -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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] wifi: rtw88: Refactor looping in rtw_phy_store_tx_power_by_rate
  2024-10-17  8:06 [PATCH v2] wifi: rtw88: Refactor looping in rtw_phy_store_tx_power_by_rate Mohammed Anees
  2024-10-18  5:32 ` Ping-Ke Shih
@ 2024-10-25  2:15 ` Ping-Ke Shih
  1 sibling, 0 replies; 3+ messages in thread
From: Ping-Ke Shih @ 2024-10-25  2:15 UTC (permalink / raw)
  To: Mohammed Anees, linux-wireless, linux-kernel
  Cc: Ping-Ke Shih, Kalle Valo, Mohammed Anees, kernel test robot

Mohammed Anees <pvmohammedanees2003@gmail.com> wrote:

> 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.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202410171143.OnFlgIwK-lkp@intel.com/
> Signed-off-by: Mohammed Anees <pvmohammedanees2003@gmail.com>
> Acked-by: Ping-Ke Shih <pkshih@realtek.com>

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-25  2:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-17  8:06 [PATCH v2] wifi: rtw88: Refactor looping in rtw_phy_store_tx_power_by_rate Mohammed Anees
2024-10-18  5:32 ` Ping-Ke Shih
2024-10-25  2:15 ` Ping-Ke Shih

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).