[PATCH v2 2/4] staging: rtl8723bs: remove dead RX FIFO overflow logic

Ethan Tidmore posted 4 patches 1 week, 4 days ago
[PATCH v2 2/4] staging: rtl8723bs: remove dead RX FIFO overflow logic
Posted by Ethan Tidmore 1 week, 4 days ago
The function rtw_hal_check_rxfifo_full() populates debug variables in
struct debug_priv that are never read. These variables (dbg_rx_fifo_*)
are write-only and the function itself is a skeletal implementation.

Additionally, remove a redundant hw_init_completed check in the caller
rtl8723b_HalDmWatchDog(), as it is already covered by a guard clause.

Removing this dead code saves unnecessary I/O cycles and cleans up
the driver's internal debug structures.

Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
---
 drivers/staging/rtl8723bs/hal/hal_com.c     | 19 -------------------
 drivers/staging/rtl8723bs/hal/rtl8723b_dm.c |  7 -------
 drivers/staging/rtl8723bs/include/hal_com.h |  1 -
 3 files changed, 27 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c
index 70b5b289f9cb..fae251c332d3 100644
--- a/drivers/staging/rtl8723bs/hal/hal_com.c
+++ b/drivers/staging/rtl8723bs/hal/hal_com.c
@@ -780,25 +780,6 @@ bool GetU1ByteIntegerFromStringInDecimal(char *Str, u8 *pInt)
 	return true;
 }
 
-void rtw_hal_check_rxfifo_full(struct adapter *adapter)
-{
-	struct dvobj_priv *psdpriv = adapter->dvobj;
-	struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
-	int save_cnt = false;
-
-	/* switch counter to RX fifo */
-	rtw_write8(adapter, REG_RXERR_RPT+3, rtw_read8(adapter, REG_RXERR_RPT+3)|0xf0);
-	save_cnt = true;
-	/* todo: other chips */
-
-	if (save_cnt) {
-		/* rtw_write8(adapter, REG_RXERR_RPT+3, rtw_read8(adapter, REG_RXERR_RPT+3)|0xa0); */
-		pdbgpriv->dbg_rx_fifo_last_overflow = pdbgpriv->dbg_rx_fifo_curr_overflow;
-		pdbgpriv->dbg_rx_fifo_curr_overflow = rtw_read16(adapter, REG_RXERR_RPT);
-		pdbgpriv->dbg_rx_fifo_diff_overflow = pdbgpriv->dbg_rx_fifo_curr_overflow-pdbgpriv->dbg_rx_fifo_last_overflow;
-	}
-}
-
 static u32 Array_kfreemap[] = {
 	0xf8, 0xe,
 	0xf6, 0xc,
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c b/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c
index 928226679ab4..3e1ec33fe829 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_dm.c
@@ -137,13 +137,6 @@ void rtl8723b_HalDmWatchDog(struct adapter *Adapter)
 	fw_current_in_ps_mode = adapter_to_pwrctl(Adapter)->fw_current_in_ps_mode;
 	rtw_hal_get_hwreg(Adapter, HW_VAR_FWLPS_RF_ON, (u8 *)(&bFwPSAwake));
 
-	if (
-		(hw_init_completed == true) &&
-		((!fw_current_in_ps_mode) && bFwPSAwake)
-	) {
-		rtw_hal_check_rxfifo_full(Adapter);
-	}
-
 	/* ODM */
 	if (hw_init_completed == true) {
 		u8 bLinked = false;
diff --git a/drivers/staging/rtl8723bs/include/hal_com.h b/drivers/staging/rtl8723bs/include/hal_com.h
index 74d6c892c401..24e7fd8ee4dc 100644
--- a/drivers/staging/rtl8723bs/include/hal_com.h
+++ b/drivers/staging/rtl8723bs/include/hal_com.h
@@ -136,7 +136,6 @@ void rtw_hal_update_sta_rate_mask(struct adapter *padapter, struct sta_info *pst
 
 void SetHwReg(struct adapter *padapter, u8 variable, u8 *val);
 void GetHwReg(struct adapter *padapter, u8 variable, u8 *val);
-void rtw_hal_check_rxfifo_full(struct adapter *adapter);
 
 u8 GetHalDefVar(struct adapter *adapter, enum hal_def_variable variable,
 		void *value);
-- 
2.52.0
Re: [PATCH v2 2/4] staging: rtl8723bs: remove dead RX FIFO overflow logic
Posted by kernel test robot 1 week, 4 days ago
Hi Ethan,

kernel test robot noticed the following build warnings:

[auto build test WARNING on staging/staging-testing]

url:    https://github.com/intel-lab-lkp/linux/commits/Ethan-Tidmore/staging-rtl8723bs-remove-dead-RX-info-reset-logic/20260128-084338
base:   staging/staging-testing
patch link:    https://lore.kernel.org/r/20260128004009.51095-3-ethantidmore06%40gmail.com
patch subject: [PATCH v2 2/4] staging: rtl8723bs: remove dead RX FIFO  overflow logic
config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20260128/202601281752.mqChL1f6-lkp@intel.com/config)
compiler: sh4-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260128/202601281752.mqChL1f6-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202601281752.mqChL1f6-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/staging/rtl8723bs/hal/rtl8723b_dm.c: In function 'rtl8723b_HalDmWatchDog':
>> drivers/staging/rtl8723bs/hal/rtl8723b_dm.c:127:14: warning: variable 'fw_current_in_ps_mode' set but not used [-Wunused-but-set-variable]
     127 |         bool fw_current_in_ps_mode = false;
         |              ^~~~~~~~~~~~~~~~~~~~~


vim +/fw_current_in_ps_mode +127 drivers/staging/rtl8723bs/hal/rtl8723b_dm.c

554c0a3abf216c Hans de Goede         2017-03-29  124  
554c0a3abf216c Hans de Goede         2017-03-29  125  void rtl8723b_HalDmWatchDog(struct adapter *Adapter)
554c0a3abf216c Hans de Goede         2017-03-29  126  {
90b69822a5cb6b Fabio M. De Francesco 2021-04-11 @127  	bool fw_current_in_ps_mode = false;
554c0a3abf216c Hans de Goede         2017-03-29  128  	bool bFwPSAwake = true;
554c0a3abf216c Hans de Goede         2017-03-29  129  	u8 hw_init_completed = false;
554c0a3abf216c Hans de Goede         2017-03-29  130  	struct hal_com_data *pHalData = GET_HAL_DATA(Adapter);
554c0a3abf216c Hans de Goede         2017-03-29  131  
554c0a3abf216c Hans de Goede         2017-03-29  132  	hw_init_completed = Adapter->hw_init_completed;
554c0a3abf216c Hans de Goede         2017-03-29  133  
554c0a3abf216c Hans de Goede         2017-03-29  134  	if (hw_init_completed == false)
554c0a3abf216c Hans de Goede         2017-03-29  135  		goto skip_dm;
554c0a3abf216c Hans de Goede         2017-03-29  136  
90b69822a5cb6b Fabio M. De Francesco 2021-04-11  137  	fw_current_in_ps_mode = adapter_to_pwrctl(Adapter)->fw_current_in_ps_mode;
554c0a3abf216c Hans de Goede         2017-03-29  138  	rtw_hal_get_hwreg(Adapter, HW_VAR_FWLPS_RF_ON, (u8 *)(&bFwPSAwake));
554c0a3abf216c Hans de Goede         2017-03-29  139  
554c0a3abf216c Hans de Goede         2017-03-29  140  	/* ODM */
554c0a3abf216c Hans de Goede         2017-03-29  141  	if (hw_init_completed == true) {
554c0a3abf216c Hans de Goede         2017-03-29  142  		u8 bLinked = false;
554c0a3abf216c Hans de Goede         2017-03-29  143  		u8 bsta_state = false;
14c77a18375db3 Nishka Dasgupta       2019-07-02  144  		bool bBtDisabled = true;
554c0a3abf216c Hans de Goede         2017-03-29  145  
554c0a3abf216c Hans de Goede         2017-03-29  146  		if (rtw_linked_check(Adapter)) {
554c0a3abf216c Hans de Goede         2017-03-29  147  			bLinked = true;
554c0a3abf216c Hans de Goede         2017-03-29  148  			if (check_fwstate(&Adapter->mlmepriv, WIFI_STATION_STATE))
554c0a3abf216c Hans de Goede         2017-03-29  149  				bsta_state = true;
554c0a3abf216c Hans de Goede         2017-03-29  150  		}
554c0a3abf216c Hans de Goede         2017-03-29  151  
554c0a3abf216c Hans de Goede         2017-03-29  152  		ODM_CmnInfoUpdate(&pHalData->odmpriv, ODM_CMNINFO_LINK, bLinked);
554c0a3abf216c Hans de Goede         2017-03-29  153  		ODM_CmnInfoUpdate(&pHalData->odmpriv, ODM_CMNINFO_STATION_STATE, bsta_state);
554c0a3abf216c Hans de Goede         2017-03-29  154  
554c0a3abf216c Hans de Goede         2017-03-29  155  		/* ODM_CmnInfoUpdate(&pHalData->odmpriv , ODM_CMNINFO_RSSI_MIN, pdmpriv->MinUndecoratedPWDBForDM); */
554c0a3abf216c Hans de Goede         2017-03-29  156  
d1f4b78027202d Nishka Dasgupta       2019-07-01  157  		bBtDisabled = hal_btcoex_IsBtDisabled(Adapter);
554c0a3abf216c Hans de Goede         2017-03-29  158  
a8fa78b8f49752 Javier F. Arias       2019-11-05  159  		ODM_CmnInfoUpdate(&pHalData->odmpriv, ODM_CMNINFO_BT_ENABLED,
c3a12cc1ec4c9c Javier F. Arias       2019-11-05  160  				  !bBtDisabled);
554c0a3abf216c Hans de Goede         2017-03-29  161  
554c0a3abf216c Hans de Goede         2017-03-29  162  		ODM_DMWatchdog(&pHalData->odmpriv);
554c0a3abf216c Hans de Goede         2017-03-29  163  	}
554c0a3abf216c Hans de Goede         2017-03-29  164  
554c0a3abf216c Hans de Goede         2017-03-29  165  skip_dm:
554c0a3abf216c Hans de Goede         2017-03-29  166  	return;
554c0a3abf216c Hans de Goede         2017-03-29  167  }
554c0a3abf216c Hans de Goede         2017-03-29  168  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki