Skip to contentSkip to conversation

rtlwifi deadcoding

PATCH In review [email protected] 2 participants 7 messages Apr 25, 2025 – May 5, 2025 Realtek wireless driver (rtlwifi family)

lore
Share & tools
lore
#0 lore raw

cover rtlwifi deadcoding

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

Hi,
A bunch of small deadcode cleanups for unused functions, many
of which are empty anyway.

However, one odd thing I noticed while preparing these is
rtl8188ee_bt_hw_init() in drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c isn't called - lots of the other models have similarly named functions that are called; is that a bug just forgetting to call it?

Dave

Dr. David Alan Gilbert (3):
wifi: rtlwifi: Remove unused rtl_usb_{resume|suspend}
wifi: rtlwifi: Remove uncalled stub rtl*_phy_ap_calibrate
wifi: rtlwifi: Remove unused rtl_bb_delay()

 drivers/net/wireless/realtek/rtlwifi/core.c          | 11 -----------
 drivers/net/wireless/realtek/rtlwifi/core.h          |  1 -
 drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c |  5 -----
 drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.h |  1 -
 drivers/net/wireless/realtek/rtlwifi/rtl8192du/phy.c |  5 -----
 drivers/net/wireless/realtek/rtlwifi/rtl8192du/phy.h |  1 -
 drivers/net/wireless/realtek/rtlwifi/rtl8192ee/phy.c |  4 ----
 drivers/net/wireless/realtek/rtlwifi/rtl8192ee/phy.h |  1 -
 drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c |  4 ----
 drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.h |  1 -
 drivers/net/wireless/realtek/rtlwifi/usb.c           | 12 ------------
 drivers/net/wireless/realtek/rtlwifi/usb.h           |  2 --
 12 files changed, 48 deletions(-)
Signature · 1 line
2.49.0
#1 lore raw

PATCH 1/3 wifi: rtlwifi: Remove unused rtl_usb_{resume|suspend}

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

rtl_usb_resume() and rtl_usb_suspend() are trivial stubs that were added in 2011's
commit 2ca20f79e0d8 ("rtlwifi: Add usb driver")
but aren't wired up anywhere (though commit 442888c706e9 ("rtlwifi:
rtl8192cu: Add routines dm, fw, led and sw") added commented out assignments).

Remove them.

---
 drivers/net/wireless/realtek/rtlwifi/usb.c | 12 ------------
 drivers/net/wireless/realtek/rtlwifi/usb.h |  2 --
 2 files changed, 14 deletions(-)
drivers/net/wireless/realtek/rtlwifi/usb.c +0 -12
index f5718e570011..d35ed56d6db9 100644
@@ -1077,15 +1077,3 @@ void rtl_usb_disconnect(struct usb_interface *intf)
 	ieee80211_free_hw(hw);
 }
 EXPORT_SYMBOL(rtl_usb_disconnect);
-
-int rtl_usb_suspend(struct usb_interface *pusb_intf, pm_message_t message)
-{
-	return 0;
-}
-EXPORT_SYMBOL(rtl_usb_suspend);
-
-int rtl_usb_resume(struct usb_interface *pusb_intf)
-{
-	return 0;
-}
-EXPORT_SYMBOL(rtl_usb_resume);
drivers/net/wireless/realtek/rtlwifi/usb.h +0 -2
index b66d6f9ae564..b873bbc9c4c2 100644
@@ -138,7 +138,5 @@ int rtl_usb_probe(struct usb_interface *intf,
 		  const struct usb_device_id *id,
 		  const struct rtl_hal_cfg *rtl92cu_hal_cfg);
 void rtl_usb_disconnect(struct usb_interface *intf);
-int rtl_usb_suspend(struct usb_interface *pusb_intf, pm_message_t message);
-int rtl_usb_resume(struct usb_interface *pusb_intf);
 
 #endif
Signature · 1 line
2.49.0
maintainer
#2 lore raw

Re: [PATCH 1/3] wifi: rtlwifi: Remove unused rtl_usb_{resume|suspend}

Quoted 9 lines · [email protected] wrote:

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

rtl_usb_resume() and rtl_usb_suspend() are trivial stubs that were added in 2011's
commit 2ca20f79e0d8 ("rtlwifi: Add usb driver")
but aren't wired up anywhere (though commit 442888c706e9 ("rtlwifi:
rtl8192cu: Add routines dm, fw, led and sw") added commented out assignments).

Quoted 3 lines

Remove them.

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

d559636e382a wifi: rtlwifi: Remove unused rtl_usb_{resume|suspend} 2d867b18eb93 wifi: rtlwifi: Remove uncalled stub rtl*_phy_ap_calibrate 406dac790c25 wifi: rtlwifi: Remove unused rtl_bb_delay()

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

#3 lore raw

Re: [PATCH 1/3] wifi: rtlwifi: Remove unused rtl_usb_{resume|suspend}

Quoted 13 lines · * Ping-Ke Shih ([email protected]) wrote:
Quoted 11 lines · [email protected] wrote:

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

rtl_usb_resume() and rtl_usb_suspend() are trivial stubs that were added in 2011's
commit 2ca20f79e0d8 ("rtlwifi: Add usb driver")
but aren't wired up anywhere (though commit 442888c706e9 ("rtlwifi:
rtl8192cu: Add routines dm, fw, led and sw") added commented out assignments).

Remove them.

Quoted 7 lines
Quoted 1 line

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

d559636e382a wifi: rtlwifi: Remove unused rtl_usb_{resume|suspend} 2d867b18eb93 wifi: rtlwifi: Remove uncalled stub rtl*_phy_ap_calibrate 406dac790c25 wifi: rtlwifi: Remove unused rtl_bb_delay()

Thanks!
Did you see the question in the 0/3 cover letter asking why rtl8188ee_bt_hw_init() isn't called?

Dave

Quoted 3 lines

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

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   |_______/
maintainer
#4 lore raw

RE: [PATCH 1/3] wifi: rtlwifi: Remove unused rtl_usb_{resume|suspend}

Quoted 2 lines

Did you see the question in the 0/3 cover letter asking why rtl8188ee_bt_hw_init() isn't called?

Checked vendor driver. For RTL8188E, only USB interface implements this function, but no caller. The PCI interface doesn't support Bluetooth.

I think you can find the vendor drivers in github or somewhere. That's not too hard to address this.

#5 lore raw

PATCH 2/3 wifi: rtlwifi: Remove uncalled stub rtl*_phy_ap_calibrate

In reply to [email protected]

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

rtl92d_phy_ap_calibrate(),
rtl92du_phy_ap_calibrate(),
rtl92ee_phy_ap_calibrate(), and
rtl8821ae_phy_ap_calibrate()

are all empty function stubs that are never called anywhere.

Remove them.

---
 drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c | 5 -----
 drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.h | 1 -
 drivers/net/wireless/realtek/rtlwifi/rtl8192du/phy.c | 5 -----
 drivers/net/wireless/realtek/rtlwifi/rtl8192du/phy.h | 1 -
 drivers/net/wireless/realtek/rtlwifi/rtl8192ee/phy.c | 4 ----
 drivers/net/wireless/realtek/rtlwifi/rtl8192ee/phy.h | 1 -
 drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c | 4 ----
 drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.h | 1 -
 8 files changed, 22 deletions(-)
drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c +0 -5
index e07402e73ba3..68f890050afb 100644
@@ -2055,11 +2055,6 @@ void rtl92d_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t)
 	RTPRINT(rtlpriv, FINIT, INIT_IQK,  "LCK:Finish!!!\n");
 }
 
-void rtl92d_phy_ap_calibrate(struct ieee80211_hw *hw, s8 delta)
-{
-	return;
-}
-
 static bool _rtl92d_phy_set_sw_chnl_cmdarray(struct swchnlcmd *cmdtable,
 		u32 cmdtableidx, u32 cmdtablesz, enum swchnlcmd_id cmdid,
 		u32 para1, u32 para2, u32 msdelay)
drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.h +0 -1
index bbe9ef77225e..a9bfe54f2802 100644
@@ -83,7 +83,6 @@ void rtl92d_phy_set_poweron(struct ieee80211_hw *hw);
 bool rtl92d_phy_check_poweroff(struct ieee80211_hw *hw);
 void rtl92d_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t);
 void rtl92d_update_bbrf_configuration(struct ieee80211_hw *hw);
-void rtl92d_phy_ap_calibrate(struct ieee80211_hw *hw, s8 delta);
 void rtl92d_phy_iq_calibrate(struct ieee80211_hw *hw);
 void rtl92d_phy_reload_iqk_setting(struct ieee80211_hw *hw, u8 channel);
 
drivers/net/wireless/realtek/rtlwifi/rtl8192du/phy.c +0 -5
index 289ec71ce3e5..8c2167cc1f13 100644
@@ -2445,11 +2445,6 @@ void rtl92du_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t)
 	RTPRINT(rtlpriv, FINIT, INIT_IQK,  "LCK:Finish!!!\n");
 }
 
-void rtl92du_phy_ap_calibrate(struct ieee80211_hw *hw, s8 delta)
-{
-	/* Nothing to do. */
-}
-
 u8 rtl92du_phy_sw_chnl(struct ieee80211_hw *hw)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
drivers/net/wireless/realtek/rtlwifi/rtl8192du/phy.h +0 -1
index 090a6203db7e..a107a5a76beb 100644
@@ -24,7 +24,6 @@ void rtl92du_phy_set_poweron(struct ieee80211_hw *hw);
 bool rtl92du_phy_check_poweroff(struct ieee80211_hw *hw);
 void rtl92du_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t);
 void rtl92du_update_bbrf_configuration(struct ieee80211_hw *hw);
-void rtl92du_phy_ap_calibrate(struct ieee80211_hw *hw, s8 delta);
 void rtl92du_phy_iq_calibrate(struct ieee80211_hw *hw);
 void rtl92du_phy_reload_iqk_setting(struct ieee80211_hw *hw, u8 channel);
 void rtl92du_phy_init_pa_bias(struct ieee80211_hw *hw);
drivers/net/wireless/realtek/rtlwifi/rtl8192ee/phy.c +0 -4
index 73ef602bfb01..1e7f0cd1c86e 100644
@@ -2926,10 +2926,6 @@ void rtl92ee_phy_lc_calibrate(struct ieee80211_hw *hw)
 	rtlphy->lck_inprogress = false;
 }
 
-void rtl92ee_phy_ap_calibrate(struct ieee80211_hw *hw, s8 delta)
-{
-}
-
 void rtl92ee_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain)
 {
 	_rtl92ee_phy_set_rfpath_switch(hw, bmain, false);
drivers/net/wireless/realtek/rtlwifi/rtl8192ee/phy.h +0 -1
index 1a5dbc628379..ec4c26b81c48 100644
@@ -119,7 +119,6 @@ void rtl92ee_phy_set_bw_mode(struct ieee80211_hw *hw,
 void rtl92ee_phy_sw_chnl_callback(struct ieee80211_hw *hw);
 u8 rtl92ee_phy_sw_chnl(struct ieee80211_hw *hw);
 void rtl92ee_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery);
-void rtl92ee_phy_ap_calibrate(struct ieee80211_hw *hw, s8 delta);
 void rtl92ee_phy_lc_calibrate(struct ieee80211_hw *hw);
 void rtl92ee_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain);
 bool rtl92ee_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c +0 -4
index 9eddbada8af1..13a05066e8a6 100644
@@ -4586,10 +4586,6 @@ void rtl8821ae_phy_lc_calibrate(struct ieee80211_hw *hw)
 {
 }
 
-void rtl8821ae_phy_ap_calibrate(struct ieee80211_hw *hw, s8 delta)
-{
-}
-
 void rtl8821ae_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain)
 {
 	_rtl8821ae_phy_set_rfpath_switch(hw, bmain);
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.h +0 -1
index 35b7d0f70125..90bf5462a3f8 100644
@@ -214,7 +214,6 @@ void rtl8821ae_phy_iq_calibrate(struct ieee80211_hw *hw,
 				bool b_recovery);
 void rtl8812ae_phy_iq_calibrate(struct ieee80211_hw *hw,
 				bool b_recovery);
-void rtl8821ae_phy_ap_calibrate(struct ieee80211_hw *hw, s8 delta);
 void rtl8821ae_phy_lc_calibrate(struct ieee80211_hw *hw);
 void rtl8821ae_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain);
 bool rtl8812ae_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
Signature · 1 line
2.49.0
#6 lore raw

PATCH 3/3 wifi: rtlwifi: Remove unused rtl_bb_delay()

In reply to [email protected]

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

The last use of rtl_bb_delay() was removed in 2014's
commit 5c99f04fec93 ("rtlwifi: rtl8723be: Update driver to match Realtek release of 06/28/14")

Remove it.

---
 drivers/net/wireless/realtek/rtlwifi/core.c | 11 -----------
 drivers/net/wireless/realtek/rtlwifi/core.h |  1 -
 2 files changed, 12 deletions(-)
drivers/net/wireless/realtek/rtlwifi/core.c +0 -11
index 7537f04b1930..819cf519e66e 100644
@@ -58,17 +58,6 @@ void rtl_rfreg_delay(struct ieee80211_hw *hw, enum radio_path rfpath, u32 addr,
 }
 EXPORT_SYMBOL(rtl_rfreg_delay);
 
-void rtl_bb_delay(struct ieee80211_hw *hw, u32 addr, u32 data)
-{
-	if (addr >= 0xf9 && addr <= 0xfe) {
-		rtl_addr_delay(addr);
-	} else {
-		rtl_set_bbreg(hw, addr, MASKDWORD, data);
-		udelay(1);
-	}
-}
-EXPORT_SYMBOL(rtl_bb_delay);
-
 static void rtl_fw_do_work(const struct firmware *firmware, void *context,
 			   bool is_wow)
 {
drivers/net/wireless/realtek/rtlwifi/core.h +0 -1
index 42c2d9e13bb8..45225d89ac5e 100644
@@ -58,7 +58,6 @@ void rtl_wowlan_fw_cb(const struct firmware *firmware, void *context);
 void rtl_addr_delay(u32 addr);
 void rtl_rfreg_delay(struct ieee80211_hw *hw, enum radio_path rfpath, u32 addr,
 		     u32 mask, u32 data);
-void rtl_bb_delay(struct ieee80211_hw *hw, u32 addr, u32 data);
 bool rtl_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb);
 bool rtl_btc_status_false(void);
 void rtl_dm_diginit(struct ieee80211_hw *hw, u32 cur_igval);
Signature · 1 line
2.49.0