2023-11-06 03:45:11

by Ping-Ke Shih

[permalink] [raw]
Subject: RE: [PATCH 2/2] wifi: rtlwifi: simplify _rtl8812ae_phy_get_txpower_limit()



> -----Original Message-----
> From: Dmitry Antipov <[email protected]>
> Sent: Wednesday, November 1, 2023 7:35 PM
> To: Ping-Ke Shih <[email protected]>
> Cc: Kalle Valo <[email protected]>; [email protected]; [email protected]; Dmitry
> Antipov <[email protected]>
> Subject: [PATCH 2/2] wifi: rtlwifi: simplify _rtl8812ae_phy_get_txpower_limit()
>
> Since 'regulation' is a compile-time constant equal to
> 'TXPWR_LMT_WW', mark it as such and simplify few branches
> in '_rtl8812ae_phy_get_txpower_limit()'. Compile tested only.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Signed-off-by: Dmitry Antipov <[email protected]>
> ---
> .../wireless/realtek/rtlwifi/rtl8821ae/phy.c | 24 +++++++------------
> 1 file changed, 8 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
> b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
> index c262770fea29..27e256a82f00 100644

[...]

> @@ -2415,10 +2413,7 @@ static s8 _rtl8812ae_phy_get_txpower_limit(struct ieee80211_hw *hw,
> limits[i] = rtlphy->txpwr_limit_2_4g[i][bdwidth]
> [sec][chnl][rf_path];
>
> - power_limit = (regulation == TXPWR_LMT_WW) ?
> - _rtl8812ae_phy_get_world_wide_limit(limits) :
> - rtlphy->txpwr_limit_2_4g[regu][bdwidth]
> - [sec][chnl][rf_path];
> + power_limit = _rtl8812ae_phy_get_world_wide_limit(limits);

I think the constantly selection of "WW" is just a workaround, and correct
way is to add regd notifier and handle regulatory request.

Ping-Ke