Skip to contentSkip to conversation

staging: rtl8723bs: replace TBTT magic numbers with macros

PATCH In review [email protected] 2 participants 2 messages Apr 23 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8723bs: replace TBTT magic numbers with macros

From: Kenet Jovan Sokoli <[email protected]>

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

---
 drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 7 +++----
 drivers/staging/rtl8723bs/include/rtl8723b_hal.h  | 6 ++++++
 2 files changed, 9 insertions(+), 4 deletions(-)
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +3 -4
index e794fe3caf9d..1461166c5231 100644
@@ -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);
 }
drivers/staging/rtl8723bs/include/rtl8723b_hal.h +6 -0
index ffd03927841c..13f77c2bf442 100644
@@ -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
Signature · 1 line
2.43.0
#1 lore raw
Quoted 7 lines · On Thu, Apr 23, 2026 at 04:12:13PM +0200, [email protected] wrote:

From: Kenet Jovan Sokoli <[email protected]>

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

---

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