* [PATCH 1/4] staging: rtl8723bs: fix logic bug in WRITEEF4BYTE macro
2026-03-28 14:27 [PATCH 0/4] staging: rtl8723bs: macro fixes in basic_types.h Mashiro Chen
@ 2026-03-28 14:27 ` Mashiro Chen
2026-03-30 9:35 ` Dan Carpenter
2026-03-28 14:27 ` [PATCH 2/4] staging: rtl8723bs: wrap complex macros with parentheses Mashiro Chen
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Mashiro Chen @ 2026-03-28 14:27 UTC (permalink / raw)
To: gregkh; +Cc: linux-staging, linux-kernel, Mashiro Chen
The WRITEEF4BYTE macro incorrectly used EF2BYTE for
4-byte memory writes. Fix it to use EF4BYTE instead.
Signed-off-by: Mashiro Chen <mashiro.chen@mailbox.org>
---
drivers/staging/rtl8723bs/include/basic_types.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/rtl8723bs/include/basic_types.h b/drivers/staging/rtl8723bs/include/basic_types.h
index 8adb95f9f..99b12c724 100644
--- a/drivers/staging/rtl8723bs/include/basic_types.h
+++ b/drivers/staging/rtl8723bs/include/basic_types.h
@@ -64,7 +64,7 @@
#define WRITEEF4BYTE(_ptr, _val) \
do { \
- (*((u32 *)(_ptr))) = EF2BYTE(_val); \
+ (*((u32 *)(_ptr))) = EF4BYTE(_val); \
} while (0)
/*
--
2.53.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 1/4] staging: rtl8723bs: fix logic bug in WRITEEF4BYTE macro
2026-03-28 14:27 ` [PATCH 1/4] staging: rtl8723bs: fix logic bug in WRITEEF4BYTE macro Mashiro Chen
@ 2026-03-30 9:35 ` Dan Carpenter
2026-03-30 11:32 ` Mashiro Chen
0 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2026-03-30 9:35 UTC (permalink / raw)
To: Mashiro Chen; +Cc: gregkh, linux-staging, linux-kernel
On Sat, Mar 28, 2026 at 10:27:06PM +0800, Mashiro Chen wrote:
> The WRITEEF4BYTE macro incorrectly used EF2BYTE for
> 4-byte memory writes. Fix it to use EF4BYTE instead.
>
> Signed-off-by: Mashiro Chen <mashiro.chen@mailbox.org>
> ---
> drivers/staging/rtl8723bs/include/basic_types.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/rtl8723bs/include/basic_types.h b/drivers/staging/rtl8723bs/include/basic_types.h
> index 8adb95f9f..99b12c724 100644
> --- a/drivers/staging/rtl8723bs/include/basic_types.h
> +++ b/drivers/staging/rtl8723bs/include/basic_types.h
> @@ -64,7 +64,7 @@
>
> #define WRITEEF4BYTE(_ptr, _val) \
This macro is never used so just delete it instead.
regards,
dan carpenter
> do { \
> - (*((u32 *)(_ptr))) = EF2BYTE(_val); \
> + (*((u32 *)(_ptr))) = EF4BYTE(_val); \
> } while (0)
>
> /*
> --
> 2.53.0
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/4] staging: rtl8723bs: wrap complex macros with parentheses
2026-03-28 14:27 [PATCH 0/4] staging: rtl8723bs: macro fixes in basic_types.h Mashiro Chen
2026-03-28 14:27 ` [PATCH 1/4] staging: rtl8723bs: fix logic bug in WRITEEF4BYTE macro Mashiro Chen
@ 2026-03-28 14:27 ` Mashiro Chen
2026-03-28 14:27 ` [PATCH 3/4] staging: rtl8723bs: remove unnecessary do-while for macros Mashiro Chen
2026-03-28 14:27 ` [PATCH 4/4] staging: rtl8723bs: remove redundant blank lines in basic_types.h Mashiro Chen
3 siblings, 0 replies; 7+ messages in thread
From: Mashiro Chen @ 2026-03-28 14:27 UTC (permalink / raw)
To: gregkh; +Cc: linux-staging, linux-kernel, Mashiro Chen
Fix "COMPLEX_MACRO" errors reported by checkpatch.pl
by wrapping macro values in parentheses to ensure
correct operator precedence.
Signed-off-by: Mashiro Chen <mashiro.chen@mailbox.org>
---
drivers/staging/rtl8723bs/include/basic_types.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/rtl8723bs/include/basic_types.h b/drivers/staging/rtl8723bs/include/basic_types.h
index 99b12c724..edd64bcf2 100644
--- a/drivers/staging/rtl8723bs/include/basic_types.h
+++ b/drivers/staging/rtl8723bs/include/basic_types.h
@@ -154,25 +154,25 @@
* Set subfield of little-endian 4-byte value to specified value.
*/
#define SET_BITS_TO_LE_4BYTE(__pstart, __bitoffset, __bitlen, __val) \
- *((u32 *)(__pstart)) = \
+ (*((u32 *)(__pstart)) = \
( \
LE_BITS_CLEARED_TO_4BYTE(__pstart, __bitoffset, __bitlen) | \
((((u32)__val) & BIT_LEN_MASK_32(__bitlen)) << (__bitoffset)) \
- )
+ ))
#define SET_BITS_TO_LE_2BYTE(__pstart, __bitoffset, __bitlen, __val) \
- *((u16 *)(__pstart)) = \
+ (*((u16 *)(__pstart)) = \
( \
LE_BITS_CLEARED_TO_2BYTE(__pstart, __bitoffset, __bitlen) | \
((((u16)__val) & BIT_LEN_MASK_16(__bitlen)) << (__bitoffset)) \
- )
+ ))
#define SET_BITS_TO_LE_1BYTE(__pstart, __bitoffset, __bitlen, __val) \
- *((u8 *)(__pstart)) = EF1BYTE \
+ (*((u8 *)(__pstart)) = EF1BYTE \
( \
LE_BITS_CLEARED_TO_1BYTE(__pstart, __bitoffset, __bitlen) | \
((((u8)__val) & BIT_LEN_MASK_8(__bitlen)) << (__bitoffset)) \
- )
+ ))
#define LE_BITS_CLEARED_TO_1BYTE_8BIT(__pStart, __BitOffset, __BitLen) \
(\
--
2.53.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/4] staging: rtl8723bs: remove unnecessary do-while for macros
2026-03-28 14:27 [PATCH 0/4] staging: rtl8723bs: macro fixes in basic_types.h Mashiro Chen
2026-03-28 14:27 ` [PATCH 1/4] staging: rtl8723bs: fix logic bug in WRITEEF4BYTE macro Mashiro Chen
2026-03-28 14:27 ` [PATCH 2/4] staging: rtl8723bs: wrap complex macros with parentheses Mashiro Chen
@ 2026-03-28 14:27 ` Mashiro Chen
2026-03-28 14:27 ` [PATCH 4/4] staging: rtl8723bs: remove redundant blank lines in basic_types.h Mashiro Chen
3 siblings, 0 replies; 7+ messages in thread
From: Mashiro Chen @ 2026-03-28 14:27 UTC (permalink / raw)
To: gregkh; +Cc: linux-staging, linux-kernel, Mashiro Chen
Remove unnecessary do-while loops and trailing semicolons
for single statement macros to comply with Linux kernel
coding style.
Signed-off-by: Mashiro Chen <mashiro.chen@mailbox.org>
---
drivers/staging/rtl8723bs/include/basic_types.h | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/rtl8723bs/include/basic_types.h b/drivers/staging/rtl8723bs/include/basic_types.h
index edd64bcf2..02965403e 100644
--- a/drivers/staging/rtl8723bs/include/basic_types.h
+++ b/drivers/staging/rtl8723bs/include/basic_types.h
@@ -53,19 +53,14 @@
/* Write data to memory */
#define WRITEEF1BYTE(_ptr, _val) \
- do { \
- (*((u8 *)(_ptr))) = EF1BYTE(_val); \
- } while (0)
+ ((*((u8 *)(_ptr))) = EF1BYTE(_val))
+
/* Write le data to memory in host ordering */
#define WRITEEF2BYTE(_ptr, _val) \
- do { \
- (*((u16 *)(_ptr))) = EF2BYTE(_val); \
- } while (0)
+ ((*((u16 *)(_ptr))) = EF2BYTE(_val))
#define WRITEEF4BYTE(_ptr, _val) \
- do { \
- (*((u32 *)(_ptr))) = EF4BYTE(_val); \
- } while (0)
+ ((*((u32 *)(_ptr))) = EF4BYTE(_val))
/*
* Create a bit mask
--
2.53.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 4/4] staging: rtl8723bs: remove redundant blank lines in basic_types.h
2026-03-28 14:27 [PATCH 0/4] staging: rtl8723bs: macro fixes in basic_types.h Mashiro Chen
` (2 preceding siblings ...)
2026-03-28 14:27 ` [PATCH 3/4] staging: rtl8723bs: remove unnecessary do-while for macros Mashiro Chen
@ 2026-03-28 14:27 ` Mashiro Chen
3 siblings, 0 replies; 7+ messages in thread
From: Mashiro Chen @ 2026-03-28 14:27 UTC (permalink / raw)
To: gregkh; +Cc: linux-staging, linux-kernel, Mashiro Chen
Remove redundant blank lines at the top of the file to improve
code cleanliness.
Signed-off-by: Mashiro Chen <mashiro.chen@mailbox.org>
---
drivers/staging/rtl8723bs/include/basic_types.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/staging/rtl8723bs/include/basic_types.h b/drivers/staging/rtl8723bs/include/basic_types.h
index 02965403e..304a17daa 100644
--- a/drivers/staging/rtl8723bs/include/basic_types.h
+++ b/drivers/staging/rtl8723bs/include/basic_types.h
@@ -7,7 +7,6 @@
#ifndef __BASIC_TYPES_H__
#define __BASIC_TYPES_H__
-
#define SUCCESS 0
#define FAIL (-1)
--
2.53.0
^ permalink raw reply related [flat|nested] 7+ messages in thread