staging: rtl8723bs: replace magic number in InitBeaconParameters
PATCH 1/1 staging: rtl8723bs: replace magic number in InitBeaconParameters
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.
--- drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +5 -2
@@ -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 ))
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerQuoted 6 lines · Ananthan
Per the bitfield comment in
hal_com_reg.h,REG_TBTT_PROHIBITpacks a "setup" time in bits 3:0 and a "hold" time in bits 19:8. Thertw_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.
Quoted 6 lines
Replace the magic number
0x6404with two named constants representing these fields.No functional change.
Signed-off-by Ananthan <[email protected]>
We need a full name please.
Quoted 9 lines
--- drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +0
-0
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c line 15
Quoted 5 lines
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +2
-0@@ -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
PATCH v2 1/1 staging: rtl8723bs: replace magic number in InitBeaconParameters
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.
--- drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +9 -2
@@ -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 ))
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerQuoted 52 lines · Anantha Krishnan
Per the bitfield comment in
hal_com_reg.h,REG_TBTT_PROHIBITpacks a "setup" time in bits 3:0 and a "hold" time in bits 19:8. Thertw_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
0x6404with two named constants representing these fields.No functional change.
Bit-field positions are documented in the comment above
REG_TBTT_PROHIBITindrivers/staging/rtl8723bs/include/hal_com_reg.h.Signed-off-by Anantha Krishnan <[email protected]>--- drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +9
-2@@ -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 ))Signature · 1 line
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
Quoted 24 lines · Anantha Krishnan
Per the bitfield comment in
hal_com_reg.h,REG_TBTT_PROHIBITpacks a "setup" time in bits 3:0 and a "hold" time in bits 19:8. Thertw_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
0x6404with two named constants representing these fields.No functional change.
Bit-field positions are documented in the comment above
REG_TBTT_PROHIBITindrivers/staging/rtl8723bs/include/hal_com_reg.h.Signed-off-by Anantha Krishnan <[email protected]>--- drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +0
-0
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c line 19
Quoted 9 lines
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +6
-0@@ -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/[email protected]/
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.
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c void rtl8723b_InitBeaconParameters(struct adapter *padapter) · line 872
Quoted 12 lines
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +3
-2+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
Quoted 6 lines
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +0
-0/* 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 ))Signature · 1 line
2.43.0
PATCH v2 1/1 staging: rtl8723bs: replace magic number in InitBeaconParameters
In reply to Greg Kroah-HartmanPer 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.
---
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(-)
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +9 -2
@@ -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 ))
Signature · 1 line
2.43.0
Quoted 11 lines · Anantha Krishnan
Per the bitfield comment in
hal_com_reg.h,REG_TBTT_PROHIBITpacks a "setup" time in bits 3:0 and a "hold" time in bits 19:8. Thertw_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
0x6404with two named constants representing these fields.No functional change.
Quoted 8 lines
Bit-field positions are documented in the comment above
REG_TBTT_PROHIBITindrivers/staging/rtl8723bs/include/hal_com_reg.h.Signed-off-by Anantha Krishnan <[email protected]>---
v2: Use full name in Signed-off-by and document the source of the
bitfield values (comment aboveREG_TBTT_PROHIBITinhal_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
Greg Kroah-Hartman
maintainerQuoted 14 lines · Anantha Krishnan
Per the bitfield comment in
hal_com_reg.h,REG_TBTT_PROHIBITpacks a "setup" time in bits 3:0 and a "hold" time in bits 19:8. Thertw_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
0x6404with two named constants representing these fields.No functional change.
Bit-field positions are documented in the comment above
REG_TBTT_PROHIBITindrivers/staging/rtl8723bs/include/hal_com_reg.h.
Quoted 7 lines
Signed-off-by Anantha Krishnan <[email protected]>---
v2: Use full name in Signed-off-by and document the source of the
bitfield values (comment aboveREG_TBTT_PROHIBITinhal_com_reg.h) per Greg's review.drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
This should be v3, as you already sent a v2 :(