Skip to contentSkip to conversation

rtlwifi/*/dm.c: Use const in swing_table declarations

PATCH In review Joe Perches 2 participants 5 messages Jun 28, 2020 – Jun 29, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtlwifi/*/dm.c: Use const in swing_table declarations

Reduce data usage about 1KB by using const.

---
 .../net/wireless/realtek/rtlwifi/rtl8188ee/dm.c    |  4 +-
 .../net/wireless/realtek/rtlwifi/rtl8723be/dm.c    |  4 +-
 .../net/wireless/realtek/rtlwifi/rtl8821ae/dm.c    | 98 ++++++++++++----------
 3 files changed, 56 insertions(+), 50 deletions(-)
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c +2 -2
index dceb04a9b3f5..1ffa188a65c9 100644
@@ -870,11 +870,11 @@ static void dm_txpower_track_cb_therm(struct ieee80211_hw *hw)
 	/*0.1 the following TWO tables decide the
 	 *final index of OFDM/CCK swing table
 	 */
-	s8 delta_swing_table_idx[2][15]  = {
+	static const s8 delta_swing_table_idx[2][15]  = {
 		{0, 0, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 10, 10, 11},
 		{0, 0, -1, -2, -3, -4, -4, -4, -4, -5, -7, -8, -9, -9, -10}
 	};
-	u8 thermal_threshold[2][15] = {
+	static const u8 thermal_threshold[2][15] = {
 		{0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 27},
 		{0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 25, 25, 25}
 	};
drivers/net/wireless/realtek/rtlwifi/rtl8723be/dm.c +2 -2
index b13fd3c0c832..c9b3d9d09c48 100644
@@ -736,11 +736,11 @@ static void rtl8723be_dm_txpower_tracking_callback_thermalmeter(
 	u8 ofdm_min_index = 6;
 	u8 index_for_channel = 0;
 
-	s8 delta_swing_table_idx_tup_a[TXSCALE_TABLE_SIZE] = {
+	static const s8 delta_swing_table_idx_tup_a[TXSCALE_TABLE_SIZE] = {
 		0, 0, 1, 2, 2, 2, 3, 3, 3, 4,  5,
 		5, 6, 6, 7, 7, 8, 8, 9, 9, 9, 10,
 		10, 11, 11, 12, 12, 13, 14, 15};
-	s8 delta_swing_table_idx_tdown_a[TXSCALE_TABLE_SIZE] = {
+	static const s8 delta_swing_table_idx_tdown_a[TXSCALE_TABLE_SIZE] = {
 		0, 0, 1, 2, 2, 2, 3, 3, 3, 4,  5,
 		5, 6, 6, 6, 6, 7, 7, 7, 8, 8,  9,
 		9, 10, 10, 11, 12, 13, 14, 15};
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c +52 -46

229 lines not on this page · raw message

maintainer
#1 lore raw

On Sun, 2020-06-28 at 03:17 -0700, Joe Perches wrote:

Use 'rtlwifi:' as subject title prefix is enough, likes
  rtlwifi: Use const in swing_table declarations

Quoted 11 lines

Reduce data usage about 1KB by using const.

---

 .../net/wireless/realtek/rtlwifi/rtl8188ee/dm.c    |  4 +-
 .../net/wireless/realtek/rtlwifi/rtl8723be/dm.c    |  4 +-
 .../net/wireless/realtek/rtlwifi/rtl8821ae/dm.c    | 98 ++++++++++++---------
-
 3 files changed, 56 insertions(+), 50 deletions(-)

[...]

Quoted 9 lines



 static void rtl8812ae_get_delta_swing_table(struct ieee80211_hw *hw,

drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c +4 -2
-					    u8 **up_a, u8 **down_a,
-					    u8 **up_b, u8 **down_b)
+					    const u8 **up_a,
+					    const u8 **down_a,
+					    const u8 **up_b,
+					    const u8 **down_b)
Quoted 4 lines

 {
  struct rtl_priv *rtlpriv = rtl_priv(hw);
  struct rtl_phy *rtlphy = &rtlpriv->phy;

Please remove below type casting:

@@ -1872,10 +1872,10 @@ static void rtl8821ae_get_delta_swing_table(struct ieee80211_hw *hw,
                *up_b = rtl8821ae_delta_swing_table_idx_5gb_p[2]; *down_b = rtl8821ae_delta_swing_table_idx_5gb_n[2]; } else {
-           *up_a = (u8 *)rtl8818e_delta_swing_table_idx_24gb_p; -           *down_a = (u8 *)rtl8818e_delta_swing_table_idx_24gb_n; -           *up_b = (u8 *)rtl8818e_delta_swing_table_idx_24gb_p; -           *down_b = (u8 *)rtl8818e_delta_swing_table_idx_24gb_n; +               *up_a = rtl8818e_delta_swing_table_idx_24gb_p; +               *down_a = rtl8818e_delta_swing_table_idx_24gb_n; +               *up_b = rtl8818e_delta_swing_table_idx_24gb_p; +               *down_b = rtl8818e_delta_swing_table_idx_24gb_n; }
        return;
 }

[...]

#2 lore raw
Quoted 4 lines · Pkshih

On Sun, 2020-06-28 at 03:17 -0700, Joe Perches wrote:

Use 'rtlwifi:' as subject title prefix is enough, likes
  rtlwifi: Use const in swing_table declarations

We disagree.

I like knowing what content is changed via patch subject lines as there are 3 rtlwifi drivers being changed by this one patch.

But your choice, you can change it if you choose.

Quoted 1 line
Quoted 1 line

Reduce data usage about 1KB by using const.

[]

Quoted 8 lines

Please remove below type casting:

(quoted diff) +0 -0
@@ -1872,10 +1872,10 @@ static void 

rtl8821ae_get_delta_swing_table(struct
ieee80211_hw *hw,
                *up_b = rtl8821ae_delta_swing_table_idx_5gb_p[2]; *down_b = rtl8821ae_delta_swing_table_idx_5gb_n[2]; } else {

Quoted 8 lines

-           *up_a = (u8 *)rtl8818e_delta_swing_table_idx_24gb_p; -           *down_a = (u8 *)rtl8818e_delta_swing_table_idx_24gb_n; -           *up_b = (u8 *)rtl8818e_delta_swing_table_idx_24gb_p; -           *down_b = (u8 *)rtl8818e_delta_swing_table_idx_24gb_n; +               *up_a = rtl8818e_delta_swing_table_idx_24gb_p; +               *down_a = rtl8818e_delta_swing_table_idx_24gb_n; +               *up_b = rtl8818e_delta_swing_table_idx_24gb_p; +               *down_b = rtl8818e_delta_swing_table_idx_24gb_n;

The compiler is quiet about this so I believe this to be an unrelated change and whitespace correction.

Of course you could modify it if you choose.

btw: There's an unnecessary return at the 2nd instance
of this cast removal too.

cheers, Joe

maintainer
#3 lore raw
Quoted 10 lines · On Sun, 2020-06-28 at 19:51 -0700, [email protected] wrote:
Quoted 4 lines · Pkshih

On Sun, 2020-06-28 at 03:17 -0700, Joe Perches wrote:

Use 'rtlwifi:' as subject title prefix is enough, likes
  rtlwifi: Use const in swing_table declarations

We disagree.

I like knowing what content is changed via patch subject lines as there are 3 rtlwifi drivers being changed by this one patch.

If 3 drivers are needed to be listed, I'd use below subject

"rtlwifi: Use const in rtl8188ee/rtl8723be/rtl8821ae swing_table declarations"

Quoted 16 lines

But your choice, you can change it if you choose.

Quoted 1 line
Quoted 1 line

Reduce data usage about 1KB by using const.

[]

Quoted 11 lines

Please remove below type casting:

(quoted diff) +0 -0
@@ -1872,10 +1872,10 @@ static void 

rtl8821ae_get_delta_swing_table(struct
ieee80211_hw *hw,
                *up_b = rtl8821ae_delta_swing_table_idx_5gb_p[2]; *down_b = rtl8821ae_delta_swing_table_idx_5gb_n[2]; } else {
-           *up_a = (u8 *)rtl8818e_delta_swing_table_idx_24gb_p; -           *down_a = (u8 *)rtl8818e_delta_swing_table_idx_24gb_n; -           *up_b = (u8 *)rtl8818e_delta_swing_table_idx_24gb_p;

Quoted 8 lines
Quoted 5 lines

-           *down_b = (u8 *)rtl8818e_delta_swing_table_idx_24gb_n; +               *up_a = rtl8818e_delta_swing_table_idx_24gb_p; +               *down_a = rtl8818e_delta_swing_table_idx_24gb_n; +               *up_b = rtl8818e_delta_swing_table_idx_24gb_p; +               *down_b = rtl8818e_delta_swing_table_idx_24gb_n;

The compiler is quiet about this so I believe this to be an unrelated change and whitespace correction.

I know compiler doesn't warn this, but it looks wired to cast 'const u8 *' to 'u8 *' to 'const u8 *'.

Quoted 5 lines

Of course you could modify it if you choose.

btw: There's an unnecessary return at the 2nd instance of this cast removal too.

It seems like to copy from rtl8812ae_get_delta_swing_table(), so I can remove it by another patch.

Quoted 4 lines

cheers, Joe

------Please consider the environment before printing this e-mail.

maintainer
#4 lore raw
Quoted 45 lines · Pkshih
Quoted 10 lines · On Sun, 2020-06-28 at 19:51 -0700, [email protected] wrote:
Quoted 4 lines · Pkshih

On Sun, 2020-06-28 at 03:17 -0700, Joe Perches wrote:

Use 'rtlwifi:' as subject title prefix is enough, likes
  rtlwifi: Use const in swing_table declarations


We disagree.

I like knowing what content is changed via patch subject lines as there are 3 rtlwifi drivers being changed by this one patch.

If 3 drivers are needed to be listed, I'd use below subject

"rtlwifi: Use const in rtl8188ee/rtl8723be/rtl8821ae swing_table declarations"

Quoted 16 lines


But your choice, you can change it if you choose.

Quoted 1 line
Quoted 1 line

Reduce data usage about 1KB by using const.

[]

Quoted 11 lines

Please remove below type casting:

(quoted diff) +0 -0
@@ -1872,10 +1872,10 @@ static void 

rtl8821ae_get_delta_swing_table(struct
ieee80211_hw *hw,
                *up_b = rtl8821ae_delta_swing_table_idx_5gb_p[2]; *down_b = rtl8821ae_delta_swing_table_idx_5gb_n[2]; } else {
-           *up_a = (u8 *)rtl8818e_delta_swing_table_idx_24gb_p; -           *down_a = (u8 *)rtl8818e_delta_swing_table_idx_24gb_n; -           *up_b = (u8 *)rtl8818e_delta_swing_table_idx_24gb_p;

Quoted 8 lines
Quoted 5 lines

-           *down_b = (u8 *)rtl8818e_delta_swing_table_idx_24gb_n; +               *up_a = rtl8818e_delta_swing_table_idx_24gb_p; +               *down_a = rtl8818e_delta_swing_table_idx_24gb_n; +               *up_b = rtl8818e_delta_swing_table_idx_24gb_p; +               *down_b = rtl8818e_delta_swing_table_idx_24gb_n;


The compiler is quiet about this so I believe this to be an unrelated change and whitespace correction.

I know compiler doesn't warn this, but it looks wired to cast 'const u8 *' to 'u8 *' to 'const u8 *'.

Quoted 9 lines
Quoted 5 lines


Of course you could modify it if you choose.

btw: There's an unnecessary return at the 2nd instance of this cast removal too.

It seems like to copy from rtl8812ae_get_delta_swing_table(), so I can remove it by another patch.

Two patches are sent:

rtlwifi: 8821ae: remove unused path B parameters from swing table
rtlwifi: Use const in 8188ee/8723be/8821ae swing_table declarations

---
Thanks
PK