The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8723bs: remove static HalDetectPwrDownMode() function
@ 2026-08-06 19:34 Nikolay Kulikov
  2026-08-07  7:03 ` Greg Kroah-Hartman
  2026-08-07  7:53 ` Dan Carpenter
  0 siblings, 2 replies; 5+ messages in thread
From: Nikolay Kulikov @ 2026-08-06 19:34 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, Nikolay Kulikov

The return value of this function is ignored at the call site, and since
the function has no side effects (except for the assignment to
pHalData->pwrdown, which is not used anywhere else), it can be removed.

At the same time, remove the efuse shadow functions, as they are
becoming unused.

Signed-off-by: Nikolay Kulikov <nikolayof23@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_efuse.c    | 75 ---------------------------
 drivers/staging/rtl8723bs/hal/sdio_halinit.c  | 24 ---------
 drivers/staging/rtl8723bs/include/rtw_efuse.h |  1 -
 3 files changed, 100 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_efuse.c b/drivers/staging/rtl8723bs/core/rtw_efuse.c
index 168ecb7a998f..7e215c9845f6 100644
--- a/drivers/staging/rtl8723bs/core/rtw_efuse.c
+++ b/drivers/staging/rtl8723bs/core/rtw_efuse.c
@@ -145,54 +145,6 @@ static void Efuse_ReadAllMap(struct adapter *padapter, u8 efuseType, u8 *Efuse)
 	Hal_EfusePowerSwitch(padapter, false);
 }
 
-/*-----------------------------------------------------------------------------
- * Function:	efuse_ShadowRead1Byte
- *		efuse_ShadowRead2Byte
- *		efuse_ShadowRead4Byte
- *
- * Overview:	Read from efuse init map by one/two/four bytes !!!!!
- *
- * Input:       NONE
- *
- * Output:      NONE
- *
- * Return:      NONE
- *
- * Revised History:
- * When			Who		Remark
- * 11/12/2008	MHC		Create Version 0.
- *
- */
-static void efuse_ShadowRead1Byte(struct adapter *padapter, u16 Offset, u8 *Value)
-{
-	struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
-
-	*Value = pEEPROM->efuse_eeprom_data[Offset];
-
-}	/*  EFUSE_ShadowRead1Byte */
-
-/* Read Two Bytes */
-static void efuse_ShadowRead2Byte(struct adapter *padapter, u16 Offset, u16 *Value)
-{
-	struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
-
-	*Value = pEEPROM->efuse_eeprom_data[Offset];
-	*Value |= pEEPROM->efuse_eeprom_data[Offset + 1] << 8;
-
-}	/*  EFUSE_ShadowRead2Byte */
-
-/* Read Four Bytes */
-static void efuse_ShadowRead4Byte(struct adapter *padapter, u16 Offset, u32 *Value)
-{
-	struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
-
-	*Value = pEEPROM->efuse_eeprom_data[Offset];
-	*Value |= pEEPROM->efuse_eeprom_data[Offset + 1] << 8;
-	*Value |= pEEPROM->efuse_eeprom_data[Offset + 2] << 16;
-	*Value |= pEEPROM->efuse_eeprom_data[Offset + 3] << 24;
-
-}	/*  efuse_ShadowRead4Byte */
-
 /*-----------------------------------------------------------------------------
  * Function:	rtw_efuse_shadow_map_update
  *
@@ -224,30 +176,3 @@ void rtw_efuse_shadow_map_update(struct adapter *padapter, u8 efuseType)
 	/* PlatformMoveMemory((void *)&pHalData->EfuseMap[EFUSE_MODIFY_MAP][0], */
 	/* void *)&pHalData->EfuseMap[EFUSE_INIT_MAP][0], mapLen); */
 } /*  rtw_efuse_shadow_map_update */
-
-/*-----------------------------------------------------------------------------
- * Function:	rtw_efuse_shadow_read
- *
- * Overview:	Read from efuse init map !!!!!
- *
- * Input:       NONE
- *
- * Output:      NONE
- *
- * Return:      NONE
- *
- * Revised History:
- * When			Who		Remark
- * 11/12/2008	MHC		Create Version 0.
- *
- */
-void rtw_efuse_shadow_read(struct adapter *padapter, u8 Type, u16 Offset, u32 *Value)
-{
-	if (Type == 1)
-		efuse_ShadowRead1Byte(padapter, Offset, (u8 *)Value);
-	else if (Type == 2)
-		efuse_ShadowRead2Byte(padapter, Offset, (u16 *)Value);
-	else if (Type == 4)
-		efuse_ShadowRead4Byte(padapter, Offset, (u32 *)Value);
-
-} /* rtw_efuse_shadow_read*/
diff --git a/drivers/staging/rtl8723bs/hal/sdio_halinit.c b/drivers/staging/rtl8723bs/hal/sdio_halinit.c
index 57d2925642e7..001b4b32c02e 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_halinit.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_halinit.c
@@ -538,26 +538,6 @@ static void _RfPowerSave(struct adapter *padapter)
 /* YJ, TODO */
 }
 
-/*  */
-/*  2010/08/09 MH Add for power down check. */
-/*  */
-static bool HalDetectPwrDownMode(struct adapter *Adapter)
-{
-	u8 tmpvalue;
-	struct hal_com_data *pHalData = GET_HAL_DATA(Adapter);
-	struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(Adapter);
-
-	rtw_efuse_shadow_read(Adapter, 1, 0x7B/*EEPROM_RF_OPT3_92C*/, (u32 *)&tmpvalue);
-
-	/*  2010/08/25 MH INF priority > PDN Efuse value. */
-	if (tmpvalue & BIT(4) && pwrctrlpriv->reg_pdnmode)
-		pHalData->pwrdown = true;
-	else
-		pHalData->pwrdown = false;
-
-	return pHalData->pwrdown;
-}	/*  HalDetectPwrDownMode */
-
 u32 rtl8723bs_hal_init(struct adapter *padapter)
 {
 	s32 ret;
@@ -632,10 +612,6 @@ u32 rtl8723bs_hal_init(struct adapter *padapter)
 	if (pwrctrlpriv->reg_rfoff)
 		pwrctrlpriv->rf_pwrstate = rf_off;
 
-	/*  2010/08/09 MH We need to check if we need to turnon or off RF after detecting */
-	/*  HW GPIO pin. Before PHY_RFConfig8192C. */
-	HalDetectPwrDownMode(padapter);
-
 	/*  Save target channel */
 	/*  <Roger_Notes> Current Channel will be updated again later. */
 	pHalData->CurrentChannel = 6;
diff --git a/drivers/staging/rtl8723bs/include/rtw_efuse.h b/drivers/staging/rtl8723bs/include/rtw_efuse.h
index 808ba94a5998..a60e05cf699c 100644
--- a/drivers/staging/rtl8723bs/include/rtw_efuse.h
+++ b/drivers/staging/rtl8723bs/include/rtw_efuse.h
@@ -73,6 +73,5 @@ u8 rtw_efuse_one_byte_read(struct adapter *padapter, u16 addr, u8 *data);
 
 u8 rtw_efuse_read_1_byte(struct adapter *padapter, u16 Address);
 void rtw_efuse_shadow_map_update(struct adapter *padapter, u8 efuseType);
-void rtw_efuse_shadow_read(struct adapter *padapter, u8 Type, u16 Offset, u32 *Value);
 
 #endif

---
base-commit: c6eb4dc5964fdf4086b73b7f0f5dc0d595fb5cf3
change-id: 20260805-rtl8723bs_efuse-61a335b0d1b2

Best regards,
--  
Nikolay Kulikov <nikolayof23@gmail.com>


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

* Re: [PATCH] staging: rtl8723bs: remove static HalDetectPwrDownMode() function
  2026-08-06 19:34 [PATCH] staging: rtl8723bs: remove static HalDetectPwrDownMode() function Nikolay Kulikov
@ 2026-08-07  7:03 ` Greg Kroah-Hartman
  2026-08-07 16:39   ` Nikolay Kulikov
  2026-08-07  7:53 ` Dan Carpenter
  1 sibling, 1 reply; 5+ messages in thread
From: Greg Kroah-Hartman @ 2026-08-07  7:03 UTC (permalink / raw)
  To: Nikolay Kulikov; +Cc: linux-staging, linux-kernel

On Thu, Aug 06, 2026 at 10:34:48PM +0300, Nikolay Kulikov wrote:
> The return value of this function is ignored at the call site, and since
> the function has no side effects (except for the assignment to
> pHalData->pwrdown, which is not used anywhere else), it can be removed.
> 
> At the same time, remove the efuse shadow functions, as they are
> becoming unused.

Why not remove pwrdown first, which shows that it is never actually
used, and then remove the functions in a separate patch?  that would
"prove" that this is a safe change, as-is we need to manually verify
this patch is correct.

thanks,

greg k-h

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

* Re: [PATCH] staging: rtl8723bs: remove static HalDetectPwrDownMode() function
  2026-08-06 19:34 [PATCH] staging: rtl8723bs: remove static HalDetectPwrDownMode() function Nikolay Kulikov
  2026-08-07  7:03 ` Greg Kroah-Hartman
@ 2026-08-07  7:53 ` Dan Carpenter
  2026-08-07 16:41   ` Nikolay Kulikov
  1 sibling, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2026-08-07  7:53 UTC (permalink / raw)
  To: Nikolay Kulikov; +Cc: Greg Kroah-Hartman, linux-staging, linux-kernel

On Thu, Aug 06, 2026 at 10:34:48PM +0300, Nikolay Kulikov wrote:
> The return value of this function is ignored at the call site, and since
> the function has no side effects (except for the assignment to
> pHalData->pwrdown, which is not used anywhere else), it can be removed.
> 

The patch needs to get rid of pwrdown from include/hal_data.h.  There
are two reasons for this.

1) For correctness and cleanliness.
2) It makes the patch easier to review because as the patch is written
   now we need to check the kernel source to see if what you're saying
   is true.  But if we delete it and it is actually used somewhere then
   we can rely on the kbuild-bot to find the mistake.

regards,
dan carpenter



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

* Re: [PATCH] staging: rtl8723bs: remove static HalDetectPwrDownMode() function
  2026-08-07  7:03 ` Greg Kroah-Hartman
@ 2026-08-07 16:39   ` Nikolay Kulikov
  0 siblings, 0 replies; 5+ messages in thread
From: Nikolay Kulikov @ 2026-08-07 16:39 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel

On Fri, Aug 07, 2026 at 09:03:21AM +0200, Greg Kroah-Hartman wrote:
> On Thu, Aug 06, 2026 at 10:34:48PM +0300, Nikolay Kulikov wrote:
> > The return value of this function is ignored at the call site, and since
> > the function has no side effects (except for the assignment to
> > pHalData->pwrdown, which is not used anywhere else), it can be removed.
> > 
> > At the same time, remove the efuse shadow functions, as they are
> > becoming unused.
> 
> Why not remove pwrdown first, which shows that it is never actually
> used, and then remove the functions in a separate patch?  that would
> "prove" that this is a safe change, as-is we need to manually verify
> this patch is correct.

Yes, that really would be better. I will do that in v2.

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

* Re: [PATCH] staging: rtl8723bs: remove static HalDetectPwrDownMode() function
  2026-08-07  7:53 ` Dan Carpenter
@ 2026-08-07 16:41   ` Nikolay Kulikov
  0 siblings, 0 replies; 5+ messages in thread
From: Nikolay Kulikov @ 2026-08-07 16:41 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Greg Kroah-Hartman, linux-staging, linux-kernel

On Fri, Aug 07, 2026 at 10:53:17AM +0300, Dan Carpenter wrote:
> On Thu, Aug 06, 2026 at 10:34:48PM +0300, Nikolay Kulikov wrote:
> > The return value of this function is ignored at the call site, and since
> > the function has no side effects (except for the assignment to
> > pHalData->pwrdown, which is not used anywhere else), it can be removed.
> > 
> 
> The patch needs to get rid of pwrdown from include/hal_data.h.  There
> are two reasons for this.
> 
> 1) For correctness and cleanliness.
> 2) It makes the patch easier to review because as the patch is written
>    now we need to check the kernel source to see if what you're saying
>    is true.  But if we delete it and it is actually used somewhere then
>    we can rely on the kbuild-bot to find the mistake.

Thanks for the review, I'll do this in v2.


Thanks,
Nikolay

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

end of thread, other threads:[~2026-08-07 16:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-06 19:34 [PATCH] staging: rtl8723bs: remove static HalDetectPwrDownMode() function Nikolay Kulikov
2026-08-07  7:03 ` Greg Kroah-Hartman
2026-08-07 16:39   ` Nikolay Kulikov
2026-08-07  7:53 ` Dan Carpenter
2026-08-07 16:41   ` Nikolay Kulikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox