* [PATCH] staging: rtl8723bs: replace magic number in InitBeaconParameters
@ 2026-07-11 2:40 Ananthan
2026-07-11 5:11 ` Greg Kroah-Hartman
0 siblings, 1 reply; 7+ messages in thread
From: Ananthan @ 2026-07-11 2:40 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, Ananthan
Per the bitfield comment in hal_com_reg.h, REG_TBTT_PROHIBIT packs
a "setup" time in bits 3:0 and a "hold" time in bits 19:8. The
rtw_write16() call here only writes the low 16 bits of that
register, covering the full setup field and the low byte of the
hold field.
Replace the magic number 0x6404 with two named constants
representing these fields.
No functional change.
Signed-off-by: Ananthan <ananthanr.off@gmail.com>
---
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
index bcaf63b2893c..9609ae025736 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
@@ -11,6 +11,9 @@
#include <rtl8723b_hal.h>
#include "hal_com_h2c.h"
+#define TBTT_PROHIBIT_SETUP 0x04 /* bits 3:0: setup time, unit 32us */
+#define TBTT_PROHIBIT_HOLD_LOW 0x64 /* bits 15:8: low byte of 12-bit hold time, unit 32us */
+
static void _FWDownloadEnable(struct adapter *padapter, bool enable)
{
u8 tmp, count = 0;
@@ -861,8 +864,8 @@ 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,
+ (TBTT_PROHIBIT_HOLD_LOW << 8) | TBTT_PROHIBIT_SETUP);/* 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))
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] staging: rtl8723bs: replace magic number in InitBeaconParameters
2026-07-11 2:40 [PATCH] staging: rtl8723bs: replace magic number in InitBeaconParameters Ananthan
@ 2026-07-11 5:11 ` Greg Kroah-Hartman
2026-07-11 6:22 ` [PATCH v2] " Anantha Krishnan
2026-07-11 6:39 ` Anantha Krishnan
0 siblings, 2 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2026-07-11 5:11 UTC (permalink / raw)
To: Ananthan; +Cc: linux-staging, linux-kernel
On Sat, Jul 11, 2026 at 08:10:06AM +0530, Ananthan wrote:
> Per the bitfield comment in hal_com_reg.h, REG_TBTT_PROHIBIT packs
> a "setup" time in bits 3:0 and a "hold" time in bits 19:8. The
> rtw_write16() call here only writes the low 16 bits of that
> register, covering the full setup field and the low byte of the
> hold field.
>
> Replace the magic number 0x6404 with two named constants
> representing these fields.
>
> No functional change.
>
> Signed-off-by: Ananthan <ananthanr.off@gmail.com>
We need a full name please.
> ---
> drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
> index bcaf63b2893c..9609ae025736 100644
> --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
> +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
> @@ -11,6 +11,9 @@
> #include <rtl8723b_hal.h>
> #include "hal_com_h2c.h"
>
> +#define TBTT_PROHIBIT_SETUP 0x04 /* bits 3:0: setup time, unit 32us */
> +#define TBTT_PROHIBIT_HOLD_LOW 0x64 /* bits 15:8: low byte of 12-bit hold time, unit 32us */
Where did that information come from? Please document that.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2] staging: rtl8723bs: replace magic number in InitBeaconParameters
2026-07-11 5:11 ` Greg Kroah-Hartman
@ 2026-07-11 6:22 ` Anantha Krishnan
2026-07-11 6:29 ` Greg Kroah-Hartman
2026-07-11 6:41 ` Dan Carpenter
2026-07-11 6:39 ` Anantha Krishnan
1 sibling, 2 replies; 7+ messages in thread
From: Anantha Krishnan @ 2026-07-11 6:22 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, Anantha Krishnan
Per the bitfield comment in hal_com_reg.h, REG_TBTT_PROHIBIT packs
a "setup" time in bits 3:0 and a "hold" time in bits 19:8. The
rtw_write16() call here only writes the low 16 bits of that
register, covering the full setup field and the low byte of the
hold field.
Replace the magic number 0x6404 with two named constants
representing these fields.
No functional change.
Bit-field positions are documented in the comment above
REG_TBTT_PROHIBIT in drivers/staging/rtl8723bs/include/hal_com_reg.h.
Signed-off-by: Anantha Krishnan <ananthanr.off@gmail.com>
---
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
index bcaf63b2893c..699e24f52392 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
@@ -11,6 +11,13 @@
#include <rtl8723b_hal.h>
#include "hal_com_h2c.h"
+/*
+ * Bitfield layout per the comment above REG_TBTT_PROHIBIT in
+ * drivers/staging/rtl8723bs/include/hal_com_reg.h.
+ */
+#define TBTT_PROHIBIT_SETUP 0x04 /* bits 3:0: setup time, unit 32us */
+#define TBTT_PROHIBIT_HOLD_LOW 0x64 /* bits 15:8: low byte of 12-bit hold time, unit 32us */
+
static void _FWDownloadEnable(struct adapter *padapter, bool enable)
{
u8 tmp, count = 0;
@@ -861,8 +868,8 @@ 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,
+ (TBTT_PROHIBIT_HOLD_LOW << 8) | TBTT_PROHIBIT_SETUP);/* 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))
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2] staging: rtl8723bs: replace magic number in InitBeaconParameters
2026-07-11 6:22 ` [PATCH v2] " Anantha Krishnan
@ 2026-07-11 6:29 ` Greg Kroah-Hartman
2026-07-11 6:41 ` Dan Carpenter
1 sibling, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2026-07-11 6:29 UTC (permalink / raw)
To: Anantha Krishnan; +Cc: linux-staging, linux-kernel
On Sat, Jul 11, 2026 at 11:52:49AM +0530, Anantha Krishnan wrote:
> Per the bitfield comment in hal_com_reg.h, REG_TBTT_PROHIBIT packs
> a "setup" time in bits 3:0 and a "hold" time in bits 19:8. The
> rtw_write16() call here only writes the low 16 bits of that
> register, covering the full setup field and the low byte of the
> hold field.
>
> Replace the magic number 0x6404 with two named constants
> representing these fields.
>
> No functional change.
>
> Bit-field positions are documented in the comment above
> REG_TBTT_PROHIBIT in drivers/staging/rtl8723bs/include/hal_com_reg.h.
>
> Signed-off-by: Anantha Krishnan <ananthanr.off@gmail.com>
> ---
> drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
> index bcaf63b2893c..699e24f52392 100644
> --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
> +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
> @@ -11,6 +11,13 @@
> #include <rtl8723b_hal.h>
> #include "hal_com_h2c.h"
>
> +/*
> + * Bitfield layout per the comment above REG_TBTT_PROHIBIT in
> + * drivers/staging/rtl8723bs/include/hal_com_reg.h.
> + */
> +#define TBTT_PROHIBIT_SETUP 0x04 /* bits 3:0: setup time, unit 32us */
> +#define TBTT_PROHIBIT_HOLD_LOW 0x64 /* bits 15:8: low byte of 12-bit hold time, unit 32us */
> +
> static void _FWDownloadEnable(struct adapter *padapter, bool enable)
> {
> u8 tmp, count = 0;
> @@ -861,8 +868,8 @@ 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,
> + (TBTT_PROHIBIT_HOLD_LOW << 8) | TBTT_PROHIBIT_SETUP);/* 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))
> --
> 2.43.0
>
>
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.
You are receiving this message because of the following common error(s)
as indicated below:
- This looks like a new version of a previously submitted patch, but you
did not list below the --- line any changes from the previous version.
Please read the section entitled "The canonical patch format" in the
kernel file, Documentation/process/submitting-patches.rst for what
needs to be done here to properly describe this.
If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.
thanks,
greg k-h's patch email bot
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2] staging: rtl8723bs: replace magic number in InitBeaconParameters
2026-07-11 5:11 ` Greg Kroah-Hartman
2026-07-11 6:22 ` [PATCH v2] " Anantha Krishnan
@ 2026-07-11 6:39 ` Anantha Krishnan
2026-07-11 6:42 ` Dan Carpenter
1 sibling, 1 reply; 7+ messages in thread
From: Anantha Krishnan @ 2026-07-11 6:39 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, Anantha Krishnan
Per the bitfield comment in hal_com_reg.h, REG_TBTT_PROHIBIT packs
a "setup" time in bits 3:0 and a "hold" time in bits 19:8. The
rtw_write16() call here only writes the low 16 bits of that
register, covering the full setup field and the low byte of the
hold field.
Replace the magic number 0x6404 with two named constants
representing these fields.
No functional change.
Bit-field positions are documented in the comment above
REG_TBTT_PROHIBIT in drivers/staging/rtl8723bs/include/hal_com_reg.h.
Signed-off-by: Anantha Krishnan <ananthanr.off@gmail.com>
---
v2: Use full name in Signed-off-by and document the source of the
bitfield values (comment above REG_TBTT_PROHIBIT in hal_com_reg.h)
per Greg's review.
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
index bcaf63b2893c..699e24f52392 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
@@ -11,6 +11,13 @@
#include <rtl8723b_hal.h>
#include "hal_com_h2c.h"
+/*
+ * Bitfield layout per the comment above REG_TBTT_PROHIBIT in
+ * drivers/staging/rtl8723bs/include/hal_com_reg.h.
+ */
+#define TBTT_PROHIBIT_SETUP 0x04 /* bits 3:0: setup time, unit 32us */
+#define TBTT_PROHIBIT_HOLD_LOW 0x64 /* bits 15:8: low byte of 12-bit hold time, unit 32us */
+
static void _FWDownloadEnable(struct adapter *padapter, bool enable)
{
u8 tmp, count = 0;
@@ -861,8 +868,8 @@ 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,
+ (TBTT_PROHIBIT_HOLD_LOW << 8) | TBTT_PROHIBIT_SETUP);/* 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))
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2] staging: rtl8723bs: replace magic number in InitBeaconParameters
2026-07-11 6:22 ` [PATCH v2] " Anantha Krishnan
2026-07-11 6:29 ` Greg Kroah-Hartman
@ 2026-07-11 6:41 ` Dan Carpenter
1 sibling, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2026-07-11 6:41 UTC (permalink / raw)
To: Anantha Krishnan; +Cc: Greg Kroah-Hartman, linux-staging, linux-kernel
On Sat, Jul 11, 2026 at 11:52:49AM +0530, Anantha Krishnan wrote:
> Per the bitfield comment in hal_com_reg.h, REG_TBTT_PROHIBIT packs
> a "setup" time in bits 3:0 and a "hold" time in bits 19:8. The
> rtw_write16() call here only writes the low 16 bits of that
> register, covering the full setup field and the low byte of the
> hold field.
>
> Replace the magic number 0x6404 with two named constants
> representing these fields.
>
> No functional change.
>
> Bit-field positions are documented in the comment above
> REG_TBTT_PROHIBIT in drivers/staging/rtl8723bs/include/hal_com_reg.h.
>
> Signed-off-by: Anantha Krishnan <ananthanr.off@gmail.com>
> ---
> drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
> index bcaf63b2893c..699e24f52392 100644
> --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
> +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
> @@ -11,6 +11,13 @@
> #include <rtl8723b_hal.h>
> #include "hal_com_h2c.h"
>
> +/*
> + * Bitfield layout per the comment above REG_TBTT_PROHIBIT in
> + * drivers/staging/rtl8723bs/include/hal_com_reg.h.
> + */
> +#define TBTT_PROHIBIT_SETUP 0x04 /* bits 3:0: setup time, unit 32us */
> +#define TBTT_PROHIBIT_HOLD_LOW 0x64 /* bits 15:8: low byte of 12-bit hold time, unit 32us */
Jad already sent a version of this.
https://lore.kernel.org/all/20260708150930.1813224-1-inasj268@gmail.com/
The "_LOW", I guess, means "low byte" which is misleading because
it suggests that this is a low byte and that a high byte exists...
The 15 should really be 19.
> +
> static void _FWDownloadEnable(struct adapter *padapter, bool enable)
> {
> u8 tmp, count = 0;
> @@ -861,8 +868,8 @@ 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,
> + (TBTT_PROHIBIT_HOLD_LOW << 8) | TBTT_PROHIBIT_SETUP);/* ms */
The comments still say "ms" when really it's in units of 32us.
regards,
dan carpenter
> /* 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))
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] staging: rtl8723bs: replace magic number in InitBeaconParameters
2026-07-11 6:39 ` Anantha Krishnan
@ 2026-07-11 6:42 ` Dan Carpenter
0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2026-07-11 6:42 UTC (permalink / raw)
To: Anantha Krishnan; +Cc: Greg Kroah-Hartman, linux-staging, linux-kernel
On Sat, Jul 11, 2026 at 12:09:02PM +0530, Anantha Krishnan wrote:
> Per the bitfield comment in hal_com_reg.h, REG_TBTT_PROHIBIT packs
> a "setup" time in bits 3:0 and a "hold" time in bits 19:8. The
> rtw_write16() call here only writes the low 16 bits of that
> register, covering the full setup field and the low byte of the
> hold field.
>
> Replace the magic number 0x6404 with two named constants
> representing these fields.
>
> No functional change.
>
> Bit-field positions are documented in the comment above
> REG_TBTT_PROHIBIT in drivers/staging/rtl8723bs/include/hal_com_reg.h.
>
> Signed-off-by: Anantha Krishnan <ananthanr.off@gmail.com>
> ---
> v2: Use full name in Signed-off-by and document the source of the
> bitfield values (comment above REG_TBTT_PROHIBIT in hal_com_reg.h)
> per Greg's review.
Please wait 24 hours between resends. Otherwise it feels like we're
holding your hand while you write code. It's overwhelming for
reviewers.
https://staticthinking.wordpress.com/2022/07/27/how-to-send-a-v2-patch/
regards,
dan carpenter
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-07-11 6:42 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-11 2:40 [PATCH] staging: rtl8723bs: replace magic number in InitBeaconParameters Ananthan
2026-07-11 5:11 ` Greg Kroah-Hartman
2026-07-11 6:22 ` [PATCH v2] " Anantha Krishnan
2026-07-11 6:29 ` Greg Kroah-Hartman
2026-07-11 6:41 ` Dan Carpenter
2026-07-11 6:39 ` Anantha Krishnan
2026-07-11 6:42 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox