public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8723bs: replace TBTT magic numbers with macros
@ 2026-04-23 14:12 deep
  2026-04-23 15:09 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: deep @ 2026-04-23 14:12 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Kenet Jovan Sokoli

From: Kenet Jovan Sokoli <deep@crimson.net.eu.org>

Replace magic numbers related to the TBTT prohibit settings
with descriptive macros in the header file

Signed-off-by: Kenet Jovan Sokoli <deep@crimson.net.eu.org>
---
 drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 7 +++----
 drivers/staging/rtl8723bs/include/rtl8723b_hal.h  | 6 ++++++
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
index e794fe3caf9d..1461166c5231 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
@@ -878,8 +878,7 @@ void rtl8723b_InitBeaconParameters(struct adapter *padapter)
 
 	rtw_write16(padapter, REG_BCN_CTRL, val16);
 
-	/*  TODO: Remove these magic number */
-	rtw_write16(padapter, REG_TBTT_PROHIBIT, 0x6404);/*  ms */
+	rtw_write16(padapter, REG_TBTT_PROHIBIT, BCN_TBTT_PROHIBIT_VAL_8723B);/*  ms */
 	/*  Firmware will control REG_DRVERLYINT when power saving is enable, */
 	/*  so don't set this register on STA mode. */
 	if (check_fwstate(&padapter->mlmepriv, WIFI_STATION_STATE) == false)
@@ -928,7 +927,7 @@ static void ResumeTxBeacon(struct adapter *padapter)
 
 	pHalData->RegFwHwTxQCtrl |= BIT(6);
 	rtw_write8(padapter, REG_FWHW_TXQ_CTRL+2, pHalData->RegFwHwTxQCtrl);
-	rtw_write8(padapter, REG_TBTT_PROHIBIT+1, 0xff);
+	rtw_write8(padapter, REG_TBTT_PROHIBIT+1, BCN_TBTT_PROHIBIT_RESUME_8723B);
 	pHalData->RegReg542 |= BIT(0);
 	rtw_write8(padapter, REG_TBTT_PROHIBIT+2, pHalData->RegReg542);
 }
@@ -939,7 +938,7 @@ static void StopTxBeacon(struct adapter *padapter)
 
 	pHalData->RegFwHwTxQCtrl &= ~BIT(6);
 	rtw_write8(padapter, REG_FWHW_TXQ_CTRL+2, pHalData->RegFwHwTxQCtrl);
-	rtw_write8(padapter, REG_TBTT_PROHIBIT+1, 0x64);
+	rtw_write8(padapter, REG_TBTT_PROHIBIT+1, BCN_TBTT_PROHIBIT_INTVL_8723B);
 	pHalData->RegReg542 &= ~BIT(0);
 	rtw_write8(padapter, REG_TBTT_PROHIBIT+2, pHalData->RegReg542);
 }
diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h
index ffd03927841c..13f77c2bf442 100644
--- a/drivers/staging/rtl8723bs/include/rtl8723b_hal.h
+++ b/drivers/staging/rtl8723bs/include/rtl8723b_hal.h
@@ -72,6 +72,12 @@ struct rt_firmware_hdr {
 #define DRIVER_EARLY_INT_TIME_8723B  0x05
 #define BCN_DMA_ATIME_INT_TIME_8723B 0x02
 
+#define BCN_TBTT_PROHIBIT_INTVL_8723B   0x64
+#define BCN_TBTT_PROHIBIT_OFFSET_8723B  0x04
+#define BCN_TBTT_PROHIBIT_RESUME_8723B  0xff
+#define BCN_TBTT_PROHIBIT_VAL_8723B \
+	((BCN_TBTT_PROHIBIT_INTVL_8723B << 8) | BCN_TBTT_PROHIBIT_OFFSET_8723B)
+
 /* for 8723B */
 /* TX 32K, RX 16K, Page size 128B for TX, 8B for RX */
 #define PAGE_SIZE_TX_8723B 128
-- 
2.43.0


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

* Re: [PATCH] staging: rtl8723bs: replace TBTT magic numbers with macros
  2026-04-23 14:12 [PATCH] staging: rtl8723bs: replace TBTT magic numbers with macros deep
@ 2026-04-23 15:09 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2026-04-23 15:09 UTC (permalink / raw)
  To: deep; +Cc: gregkh, linux-staging, linux-kernel

On Thu, Apr 23, 2026 at 04:12:13PM +0200, deep@crimson.net.eu.org wrote:
> From: Kenet Jovan Sokoli <deep@crimson.net.eu.org>
> 
> Replace magic numbers related to the TBTT prohibit settings
> with descriptive macros in the header file
> 
> Signed-off-by: Kenet Jovan Sokoli <deep@crimson.net.eu.org>
> ---

There are a bunch of people going around looking for TODO in the code
and then using AI to "fix" the TODO.

The last time I looked at this code, it was someone doing AI.  And then
when I asked them how they came up with it, they fed my question into
an AI and it hallucinated up part of a spec file which they quoted.
I'm pretty sure it was a hallucination.  I downloaded the spec file
they "quoted" and the section didn't exist and none of the information
was in it.  They later admitted it was from an AI when I asked them to
provide the link.

I worry that you are getting your information from the fake spec.  Or
maybe you have a link to the real spec?

regards,
dan carpenter


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

end of thread, other threads:[~2026-04-23 15:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-23 14:12 [PATCH] staging: rtl8723bs: replace TBTT magic numbers with macros deep
2026-04-23 15:09 ` Dan Carpenter

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