Skip to contentSkip to conversation

Realtek wifi deadcoding

PATCH In review [email protected] 2 participants 8 messages Nov 3, 2024 – Nov 4, 2024 Realtek wireless driver (rtlwifi family)

lore
Share & tools
lore
#0 lore raw

cover Realtek wifi deadcoding

From: "Dr. David Alan Gilbert" <[email protected]>

Hi,
This cleans up a bunch of unused functions.
I've split it, I think based on where they were added.

I'm also suspicious that exhalbtc_pre_load_firmware and ex_btc8821a2ant_pre_load_firmware are unused, but commit 6fbbc82adfb2 makes a promising sounding reason why it's there - but I can't see a use. Anyone know why? Anyway, I've left that for now.

Dave

Dr. David Alan Gilbert (2):
rtlwifi: Remove unused functions
rtlwifi: Remove more unused functions

 .../rtlwifi/btcoexist/halbtc8723b1ant.c       | 11 ---
 .../rtlwifi/btcoexist/halbtc8723b1ant.h       |  1 -
 .../realtek/rtlwifi/btcoexist/halbtcoutsrc.c  | 79 -------------------
 .../realtek/rtlwifi/btcoexist/halbtcoutsrc.h  | 10 ---
 4 files changed, 101 deletions(-)
Signature · 1 line
2.47.0
#1 lore raw

PATCH 1/2 rtlwifi: Remove unused functions

From: "Dr. David Alan Gilbert" <[email protected]>

exhalbtc_rf_status_notify(), exhalbtc_coex_dm_switch() and exhalbtc_antenna_detection() are unused since they were added in 2017's commit 7937f02d1953 ("rtlwifi: btcoex: hook external functions for newer chips")

Remove them.

This leaves ex_btc8723b1ant_coex_dm_reset() unused.

Remove it.

---
 .../rtlwifi/btcoexist/halbtc8723b1ant.c       | 11 -----
 .../rtlwifi/btcoexist/halbtc8723b1ant.h       |  1 -
 .../realtek/rtlwifi/btcoexist/halbtcoutsrc.c  | 45 -------------------
 .../realtek/rtlwifi/btcoexist/halbtcoutsrc.h  |  4 --
 4 files changed, 61 deletions(-)
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b1ant.c +0 -11
index 039bbedb41c2..379193b24428 100644
@@ -3409,17 +3409,6 @@ void ex_btc8723b1ant_pnp_notify(struct btc_coexist *btcoexist, u8 pnp_state)
 	}
 }
 
-void ex_btc8723b1ant_coex_dm_reset(struct btc_coexist *btcoexist)
-{
-	struct rtl_priv *rtlpriv = btcoexist->adapter;
-
-	rtl_dbg(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
-		"[BTCoex], *****************Coex DM Reset****************\n");
-
-	halbtc8723b1ant_init_hw_config(btcoexist, false, false);
-	halbtc8723b1ant_init_coex_dm(btcoexist);
-}
-
 void ex_btc8723b1ant_periodical(struct btc_coexist *btcoexist)
 {
 	struct rtl_priv *rtlpriv = btcoexist->adapter;
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b1ant.h +0 -1
index 9d41e11388ad..a4506d838dc7 100644
@@ -197,7 +197,6 @@ void ex_btc8723b1ant_rf_status_notify(struct btc_coexist *btcoexist,
 				      u8 type);
 void ex_btc8723b1ant_halt_notify(struct btc_coexist *btcoexist);
 void ex_btc8723b1ant_pnp_notify(struct btc_coexist *btcoexist, u8 pnpstate);
-void ex_btc8723b1ant_coex_dm_reset(struct btc_coexist *btcoexist);
 void ex_btc8723b1ant_periodical(struct btc_coexist *btcoexist);
 void ex_btc8723b1ant_display_coex_info(struct btc_coexist *btcoexist,
 				       struct seq_file *m);
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c +0 -45

63 lines not on this page · raw message

drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h +0 -4
index a96a995dd850..5d146fcb7852 100644
@@ -763,15 +763,11 @@ void exhalbtc_mediastatus_notify(struct btc_coexist *btcoexist,
 void exhalbtc_special_packet_notify(struct btc_coexist *btcoexist, u8 pkt_type);
 void exhalbtc_bt_info_notify(struct btc_coexist *btcoexist, u8 *tmp_buf,
 			     u8 length);
-void exhalbtc_rf_status_notify(struct btc_coexist *btcoexist, u8 type);
 void exhalbtc_halt_notify(struct btc_coexist *btcoexist);
 void exhalbtc_pnp_notify(struct btc_coexist *btcoexist, u8 pnp_state);
-void exhalbtc_coex_dm_switch(struct btc_coexist *btcoexist);
 void exhalbtc_periodical(struct btc_coexist *btcoexist);
 void exhalbtc_dbg_control(struct btc_coexist *btcoexist, u8 code, u8 len,
 			  u8 *data);
-void exhalbtc_antenna_detection(struct btc_coexist *btcoexist, u32 cent_freq,
-				u32 offset, u32 span, u32 seconds);
 void exhalbtc_stack_update_profile_info(void);
 void exhalbtc_set_hci_version(struct btc_coexist *btcoexist, u16 hci_version);
 void exhalbtc_set_bt_patch_version(struct btc_coexist *btcoexist,
Signature · 1 line
2.47.0
#2 lore raw

Re: [PATCH 1/2] rtlwifi: Remove unused functions

Quoted 7 lines · [email protected] writes:

From: "Dr. David Alan Gilbert" <[email protected]>

exhalbtc_rf_status_notify(), exhalbtc_coex_dm_switch() and exhalbtc_antenna_detection() are unused since they were added in 2017's commit 7937f02d1953 ("rtlwifi: btcoex: hook external functions for newer chips")

Quoted 7 lines

Remove them.

This leaves ex_btc8723b1ant_coex_dm_reset() unused.

Remove it.

'wifi:' missing.

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#3 lore raw

PATCH 2/2 rtlwifi: Remove more unused functions

In reply to [email protected]

From: "Dr. David Alan Gilbert" <[email protected]>

exhalbtc_dbg_control(), exhalbtc_stack_update_profile_info(), exhalbtc_set_hci_version(), and exhalbtc_set_bt_patch_version() are unused since their addition in 2014 by
commit aa45a673b291 ("rtlwifi: btcoexist: Add new mini driver")

Remove them.

---
 .../realtek/rtlwifi/btcoexist/halbtcoutsrc.c  | 34 -------------------
 .../realtek/rtlwifi/btcoexist/halbtcoutsrc.h  |  6 ----
 2 files changed, 40 deletions(-)
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c +0 -34
index 74c4504065c0..478cca33e5e3 100644
@@ -1782,22 +1782,6 @@ void exhalbtc_periodical(struct btc_coexist *btcoexist)
 	halbtc_normal_low_power(btcoexist);
 }
 
-void exhalbtc_dbg_control(struct btc_coexist *btcoexist,
-			  u8 code, u8 len, u8 *data)
-{
-	if (!halbtc_is_bt_coexist_available(btcoexist))
-		return;
-	btcoexist->statistics.cnt_dbg_ctrl++;
-
-	halbtc_leave_low_power(btcoexist);
-
-	halbtc_normal_low_power(btcoexist);
-}
-
-void exhalbtc_stack_update_profile_info(void)
-{
-}
-
 void exhalbtc_update_min_bt_rssi(struct btc_coexist *btcoexist, s8 bt_rssi)
 {
 	if (!halbtc_is_bt_coexist_available(btcoexist))
@@ -1806,24 +1790,6 @@ void exhalbtc_update_min_bt_rssi(struct btc_coexist *btcoexist, s8 bt_rssi)
 	btcoexist->stack_info.min_bt_rssi = bt_rssi;
 }
 
-void exhalbtc_set_hci_version(struct btc_coexist *btcoexist, u16 hci_version)
-{
-	if (!halbtc_is_bt_coexist_available(btcoexist))
-		return;
-
-	btcoexist->stack_info.hci_version = hci_version;
-}
-
-void exhalbtc_set_bt_patch_version(struct btc_coexist *btcoexist,
-				   u16 bt_hci_version, u16 bt_patch_version)
-{
-	if (!halbtc_is_bt_coexist_available(btcoexist))
-		return;
-
-	btcoexist->bt_info.bt_real_fw_ver = bt_patch_version;
-	btcoexist->bt_info.bt_hci_ver = bt_hci_version;
-}
-
 void exhalbtc_set_chip_type(struct btc_coexist *btcoexist, u8 chip_type)
 {
 	switch (chip_type) {
drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h +0 -6
index 5d146fcb7852..d8d88a989806 100644
@@ -766,12 +766,6 @@ void exhalbtc_bt_info_notify(struct btc_coexist *btcoexist, u8 *tmp_buf,
 void exhalbtc_halt_notify(struct btc_coexist *btcoexist);
 void exhalbtc_pnp_notify(struct btc_coexist *btcoexist, u8 pnp_state);
 void exhalbtc_periodical(struct btc_coexist *btcoexist);
-void exhalbtc_dbg_control(struct btc_coexist *btcoexist, u8 code, u8 len,
-			  u8 *data);
-void exhalbtc_stack_update_profile_info(void);
-void exhalbtc_set_hci_version(struct btc_coexist *btcoexist, u16 hci_version);
-void exhalbtc_set_bt_patch_version(struct btc_coexist *btcoexist,
-				   u16 bt_hci_version, u16 bt_patch_version);
 void exhalbtc_update_min_bt_rssi(struct btc_coexist *btcoexist, s8 bt_rssi);
 void exhalbtc_set_bt_exist(struct btc_coexist *btcoexist, bool bt_exist);
 void exhalbtc_set_chip_type(struct btc_coexist *btcoexist, u8 chip_type);
Signature · 1 line
2.47.0
#4 lore raw

Re: [PATCH 2/2] rtlwifi: Remove more unused functions

Quoted 10 lines · [email protected] writes:

From: "Dr. David Alan Gilbert" <[email protected]>

exhalbtc_dbg_control(), exhalbtc_stack_update_profile_info(), exhalbtc_set_hci_version(), and exhalbtc_set_bt_patch_version() are unused since their addition in 2014 by
commit aa45a673b291 ("rtlwifi: btcoexist: Add new mini driver")

Remove them.

'wifi:' missing. Also in both patches the subject could be more unique.

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#5 lore raw

Re: [PATCH 2/2] rtlwifi: Remove more unused functions

Quoted 9 lines · * Kalle Valo ([email protected]) wrote:
Quoted 7 lines · [email protected] writes:

From: "Dr. David Alan Gilbert" <[email protected]>

exhalbtc_dbg_control(), exhalbtc_stack_update_profile_info(), exhalbtc_set_hci_version(), and exhalbtc_set_bt_patch_version() are unused since their addition in 2014 by
commit aa45a673b291 ("rtlwifi: btcoexist: Add new mini driver")

Quoted 5 lines
Quoted 3 lines

Remove them.

'wifi:' missing.

Oops, can add that.

Quoted 1 line

Also in both patches the subject could be more unique.

Do you have suggestions? I don't know the code to give good titles. They're both 'btcoexist'; I could merge them into one

wifi: wtlwifi: Remove btcoexist deadcode

Dave

Quoted 5 lines
Signature · 4 lines
-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Signature · 4 lines
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
#6 lore raw

Re: [PATCH 2/2] rtlwifi: Remove more unused functions

Quoted 16 lines · Dr. David Alan Gilbert
Quoted 9 lines · * Kalle Valo ([email protected]) wrote:
Quoted 7 lines · [email protected] writes:

From: "Dr. David Alan Gilbert" <[email protected]>

exhalbtc_dbg_control(), exhalbtc_stack_update_profile_info(), exhalbtc_set_hci_version(), and exhalbtc_set_bt_patch_version() are unused since their addition in 2014 by
commit aa45a673b291 ("rtlwifi: btcoexist: Add new mini driver")

Quoted 5 lines
Quoted 3 lines

Remove them.

'wifi:' missing.

Quoted 8 lines

Oops, can add that.

Quoted 1 line

Also in both patches the subject could be more unique.

Do you have suggestions? I don't know the code to give good titles. They're both 'btcoexist'; I could merge them into one

wifi: wtlwifi: Remove btcoexist deadcode

No good suggestions really. Usually I add what I'm removing to the subject but as this patch is removing several functions the subject would be too long. Maybe something like 'wifi: rtlwifi: remove several unused exhalbtc_*() functions?' just to throw out some ideas, I'm sure you can come with better ones.

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#7 lore raw

Re: [PATCH 2/2] rtlwifi: Remove more unused functions

Quoted 25 lines · * Kalle Valo ([email protected]) wrote:
Quoted 23 lines · Dr. David Alan Gilbert
Quoted 9 lines · * Kalle Valo ([email protected]) wrote:
Quoted 7 lines · [email protected] writes:

From: "Dr. David Alan Gilbert" <[email protected]>

exhalbtc_dbg_control(), exhalbtc_stack_update_profile_info(), exhalbtc_set_hci_version(), and exhalbtc_set_bt_patch_version() are unused since their addition in 2014 by
commit aa45a673b291 ("rtlwifi: btcoexist: Add new mini driver")

Quoted 5 lines
Quoted 3 lines

Remove them.

'wifi:' missing.

Oops, can add that.

Quoted 1 line

Also in both patches the subject could be more unique.

Do you have suggestions? I don't know the code to give good titles. They're both 'btcoexist'; I could merge them into one

Quoted 7 lines
Quoted 1 line

wifi: wtlwifi: Remove btcoexist deadcode

No good suggestions really. Usually I add what I'm removing to the subject but as this patch is removing several functions the subject would be too long. Maybe something like 'wifi: rtlwifi: remove several unused exhalbtc_*() functions?' just to throw out some ideas, I'm sure you can come with better ones.

OK, I've just merged the two together, and sent it out as a single patch

[PATCH v2] wifi: rtlwifi: Remove some exhalbtc deadcod
message-id: [email protected]

Dave

Quoted 6 lines
Signature · 4 lines
-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Signature · 4 lines
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/