Linux-Wireless Archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] wifi: rtlwifi: rtl8723be: Make read-only arrays static const
@ 2024-04-25 15:57 Colin Ian King
  2024-04-26  0:20 ` Ping-Ke Shih
  2024-04-29  1:49 ` Ping-Ke Shih
  0 siblings, 2 replies; 3+ messages in thread
From: Colin Ian King @ 2024-04-25 15:57 UTC (permalink / raw
  To: Ping-Ke Shih, Kalle Valo, Su Hui, linux-wireless
  Cc: kernel-janitors, linux-kernel

Don't populate the read-only arrays cck_rates, ofdm_rates, ht_rates_1t and
channel_all on the stack at run time, instead make them static const and
clean up the formatting.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 .../wireless/realtek/rtlwifi/rtl8723be/phy.c  | 45 +++++++++++--------
 1 file changed, 26 insertions(+), 19 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c
index 094cb36153f5..13e689037acc 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c
@@ -1110,16 +1110,22 @@ static void _rtl8723be_phy_set_txpower_index(struct ieee80211_hw *hw,
 void rtl8723be_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel)
 {
 	struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
-	u8 cck_rates[]  = {DESC92C_RATE1M, DESC92C_RATE2M,
-			   DESC92C_RATE5_5M, DESC92C_RATE11M};
-	u8 ofdm_rates[]  = {DESC92C_RATE6M, DESC92C_RATE9M,
-			    DESC92C_RATE12M, DESC92C_RATE18M,
-			    DESC92C_RATE24M, DESC92C_RATE36M,
-			    DESC92C_RATE48M, DESC92C_RATE54M};
-	u8 ht_rates_1t[]  = {DESC92C_RATEMCS0, DESC92C_RATEMCS1,
-			     DESC92C_RATEMCS2, DESC92C_RATEMCS3,
-			     DESC92C_RATEMCS4, DESC92C_RATEMCS5,
-			     DESC92C_RATEMCS6, DESC92C_RATEMCS7};
+	static const u8 cck_rates[]  = {
+		DESC92C_RATE1M, DESC92C_RATE2M,
+		DESC92C_RATE5_5M, DESC92C_RATE11M
+	};
+	static const u8 ofdm_rates[]  = {
+		DESC92C_RATE6M, DESC92C_RATE9M,
+		DESC92C_RATE12M, DESC92C_RATE18M,
+		DESC92C_RATE24M, DESC92C_RATE36M,
+		DESC92C_RATE48M, DESC92C_RATE54M
+	};
+	static const u8 ht_rates_1t[]  = {
+		DESC92C_RATEMCS0, DESC92C_RATEMCS1,
+		DESC92C_RATEMCS2, DESC92C_RATEMCS3,
+		DESC92C_RATEMCS4, DESC92C_RATEMCS5,
+		DESC92C_RATEMCS6, DESC92C_RATEMCS7
+	};
 	u8 i;
 	u8 power_index;
 
@@ -2155,15 +2161,16 @@ static void _rtl8723be_phy_iq_calibrate(struct ieee80211_hw *hw,
 
 static u8 _get_right_chnl_place_for_iqk(u8 chnl)
 {
-	u8 channel_all[TARGET_CHNL_NUM_2G_5G] = {
-			1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
-			13, 14, 36, 38, 40, 42, 44, 46,
-			48, 50, 52, 54, 56, 58, 60, 62, 64,
-			100, 102, 104, 106, 108, 110,
-			112, 114, 116, 118, 120, 122,
-			124, 126, 128, 130, 132, 134, 136,
-			138, 140, 149, 151, 153, 155, 157,
-			159, 161, 163, 165};
+	static const u8 channel_all[TARGET_CHNL_NUM_2G_5G] = {
+		1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
+		13, 14, 36, 38, 40, 42, 44, 46,
+		48, 50, 52, 54, 56, 58, 60, 62, 64,
+		100, 102, 104, 106, 108, 110,
+		112, 114, 116, 118, 120, 122,
+		124, 126, 128, 130, 132, 134, 136,
+		138, 140, 149, 151, 153, 155, 157,
+		159, 161, 163, 165
+	};
 	u8 place = chnl;
 
 	if (chnl > 14) {
-- 
2.39.2


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

* RE: [PATCH][next] wifi: rtlwifi: rtl8723be: Make read-only arrays static const
  2024-04-25 15:57 [PATCH][next] wifi: rtlwifi: rtl8723be: Make read-only arrays static const Colin Ian King
@ 2024-04-26  0:20 ` Ping-Ke Shih
  2024-04-29  1:49 ` Ping-Ke Shih
  1 sibling, 0 replies; 3+ messages in thread
From: Ping-Ke Shih @ 2024-04-26  0:20 UTC (permalink / raw
  To: Colin Ian King, Kalle Valo, Su Hui,
	linux-wireless@vger.kernel.org
  Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org

Colin Ian King <colin.i.king@gmail.com> wrote:
> Don't populate the read-only arrays cck_rates, ofdm_rates, ht_rates_1t and
> channel_all on the stack at run time, instead make them static const and
> clean up the formatting.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

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



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

* Re: [PATCH][next] wifi: rtlwifi: rtl8723be: Make read-only arrays static const
  2024-04-25 15:57 [PATCH][next] wifi: rtlwifi: rtl8723be: Make read-only arrays static const Colin Ian King
  2024-04-26  0:20 ` Ping-Ke Shih
@ 2024-04-29  1:49 ` Ping-Ke Shih
  1 sibling, 0 replies; 3+ messages in thread
From: Ping-Ke Shih @ 2024-04-29  1:49 UTC (permalink / raw
  To: Colin Ian King, Ping-Ke Shih, Kalle Valo, Su Hui, linux-wireless
  Cc: kernel-janitors, linux-kernel

Colin Ian King <colin.i.king@gmail.com> wrote:

> Don't populate the read-only arrays cck_rates, ofdm_rates, ht_rates_1t and
> channel_all on the stack at run time, instead make them static const and
> clean up the formatting.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> Acked-by: Ping-Ke Shih <pkshih@realtek.com>

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

ed403e86c826 wifi: rtlwifi: rtl8723be: Make read-only arrays static const

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


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

end of thread, other threads:[~2024-04-29  1:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-25 15:57 [PATCH][next] wifi: rtlwifi: rtl8723be: Make read-only arrays static const Colin Ian King
2024-04-26  0:20 ` Ping-Ke Shih
2024-04-29  1:49 ` 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 read-only IMAP folder(s) and NNTP newsgroup(s).