All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/15] staging: rtl8723bs: fix checkpatch errors on macros
@ 2021-03-26  9:09 Fabio Aiuto
  2021-03-26  9:09 ` [PATCH 01/15] staging: rtl8723bs: inlcude macros in a do..while loop in core/rtw_security.c Fabio Aiuto
                   ` (14 more replies)
  0 siblings, 15 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-26  9:09 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Fabio Aiuto

Fix all checkpatch errors on macros but the following:

ERROR: Macros with complex values should be enclosed in parentheses
#41: FILE: drivers/staging/rtl8723bs/include/hal_pwr_seq.h:41:
+#define RTL8723B_TRANS_CARDEMU_TO_ACT														\
--
ERROR: Macros with complex values should be enclosed in parentheses
#67: FILE: drivers/staging/rtl8723bs/include/hal_pwr_seq.h:67:
+#define RTL8723B_TRANS_ACT_TO_CARDEMU													\
--
ERROR: Macros with complex values should be enclosed in parentheses
#80: FILE: drivers/staging/rtl8723bs/include/hal_pwr_seq.h:80:
+#define RTL8723B_TRANS_CARDEMU_TO_SUS													\
--
ERROR: Macros with complex values should be enclosed in parentheses
#91: FILE: drivers/staging/rtl8723bs/include/hal_pwr_seq.h:91:
+#define RTL8723B_TRANS_SUS_TO_CARDEMU													\
--
ERROR: Macros with complex values should be enclosed in parentheses
#100: FILE: drivers/staging/rtl8723bs/include/hal_pwr_seq.h:100:
+#define RTL8723B_TRANS_CARDEMU_TO_CARDDIS													\
--
ERROR: Macros with complex values should be enclosed in parentheses
#111: FILE: drivers/staging/rtl8723bs/include/hal_pwr_seq.h:111:
+#define RTL8723B_TRANS_CARDDIS_TO_CARDEMU													\
--
ERROR: Macros with complex values should be enclosed in parentheses
#123: FILE: drivers/staging/rtl8723bs/include/hal_pwr_seq.h:123:
+#define RTL8723B_TRANS_CARDEMU_TO_PDN												\
--
ERROR: Macros with complex values should be enclosed in parentheses
#136: FILE: drivers/staging/rtl8723bs/include/hal_pwr_seq.h:136:
+#define RTL8723B_TRANS_ACT_TO_LPS														\
--
ERROR: Macros with complex values should be enclosed in parentheses
#154: FILE: drivers/staging/rtl8723bs/include/hal_pwr_seq.h:154:
+#define RTL8723B_TRANS_LPS_TO_ACT															\
--
ERROR: Macros with complex values should be enclosed in parentheses
#170: FILE: drivers/staging/rtl8723bs/include/hal_pwr_seq.h:170:
+ #define RTL8723B_TRANS_ACT_TO_SWLPS														\
--
ERROR: Macros with complex values should be enclosed in parentheses
#197: FILE: drivers/staging/rtl8723bs/include/hal_pwr_seq.h:197:
+#define RTL8723B_TRANS_SWLPS_TO_ACT															\
--

I counld't put braces for they are meant to be expanded inside an 
array definition

ERROR: Macros with complex values should be enclosed in parentheses
#108: FILE: drivers/staging/rtl8723bs/include/osdep_service_linux.h:108:
+#define FUNC_NDEV_ARG(ndev) __func__, ndev->name
--
ERROR: Macros with complex values should be enclosed in parentheses
#110: FILE: drivers/staging/rtl8723bs/include/osdep_service_linux.h:110:
+#define FUNC_ADPT_ARG(adapter) __func__, adapter->pnetdev->nam

All those macros are not used to generate expressions but arguments of
a functions.

If someone knows how to silence those errors as well,
please tell me.

Fabio Aiuto (15):
  staging: rtl8723bs: inlcude macros in a do..while loop in
    core/rtw_security.c
  staging: rtl8723bs: put parentheses on macros with complex values in
    hal/HalBtcOutSrc.h
  staging: rtl8723bs: put parentheses on macros with complex values in
    hal/odm_debug.h
  staging: rtl8723bs: put parentheses on macros with complex values in
    include/basic_types.h
  staging: rtl8723bs: put parentheses on macros with complex values in
    include/drv_types.h
  staging: rtl8723bs: put parentheses on macros with complex values in
    include/hal_com.h
  staging: rtl8723bs: put parentheses on macros with complex values in
    include/hal_com_reg.h
  staging: rtl8723bs: put parentheses on macros with complex values in
    include/hal_data.h
  staging: rtl8723bs: put parentheses on macros with complex values in
    include/hal_phy.h
  staging: rtl8723bs: put parentheses on macros with complex values in
    include/ieee80211.h
  staging: rtl8723bs: put parentheses on macros with complex values in
    include/rtw_debug.h
  staging: rtl8723bs: put parentheses on macros with complex values in
    include/rtw_pwrctrl.h
  staging: rtl8723bs: add spaces around operator in
    include/rtw_pwrctrl.h
  staging: rtl8723bs:  put parentheses on macros with complex values in
    include/sta_info.h
  staging: rtl8723bs:  put parentheses on macros with complex values in
    include/wifi.h

 drivers/staging/rtl8723bs/core/rtw_security.c | 94 +++++++++++--------
 drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h  |  6 +-
 drivers/staging/rtl8723bs/hal/odm_debug.h     |  6 +-
 .../staging/rtl8723bs/include/basic_types.h   | 30 +++---
 drivers/staging/rtl8723bs/include/drv_types.h |  4 +-
 drivers/staging/rtl8723bs/include/hal_com.h   |  8 +-
 .../staging/rtl8723bs/include/hal_com_reg.h   | 14 +--
 drivers/staging/rtl8723bs/include/hal_data.h  |  6 +-
 drivers/staging/rtl8723bs/include/hal_phy.h   |  2 +-
 drivers/staging/rtl8723bs/include/ieee80211.h |  4 +-
 drivers/staging/rtl8723bs/include/rtw_debug.h | 28 +++---
 .../staging/rtl8723bs/include/rtw_pwrctrl.h   |  6 +-
 drivers/staging/rtl8723bs/include/sta_info.h  | 12 +--
 drivers/staging/rtl8723bs/include/wifi.h      | 38 ++++----
 14 files changed, 140 insertions(+), 118 deletions(-)

-- 
2.20.1


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

* [PATCH 01/15] staging: rtl8723bs: inlcude macros in a do..while loop in core/rtw_security.c
  2021-03-26  9:09 [PATCH 00/15] staging: rtl8723bs: fix checkpatch errors on macros Fabio Aiuto
@ 2021-03-26  9:09 ` Fabio Aiuto
  2021-03-26  9:52   ` Dan Carpenter
  2021-03-26  9:09 ` [PATCH 02/15] staging: rtl8723bs: put parentheses on macros with complex values in hal/HalBtcOutSrc.h Fabio Aiuto
                   ` (13 subsequent siblings)
  14 siblings, 1 reply; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-26  9:09 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Fabio Aiuto

fix the following checkpatch warning:

ERROR: Macros starting with if should be enclosed by a do - while
loop to avoid possible if/else logic defects
33: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:33:
+#define WEP_SW_ENC_CNT_INC(sec, ra) \
--
ERROR: Macros starting with if should be enclosed by a do - while
loop to avoid possible if/else logic defects
41: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:41:
+#define WEP_SW_DEC_CNT_INC(sec, ra) \
--
ERROR: Macros starting with if should be enclosed by a do - while
loop to avoid possible if/else logic defects
49: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:49:
+#define TKIP_SW_ENC_CNT_INC(sec, ra) \
--
ERROR: Macros starting with if should be enclosed by a do - while
loop to avoid possible if/else logic defects
57: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:57:
+#define TKIP_SW_DEC_CNT_INC(sec, ra) \
--
ERROR: Macros starting with if should be enclosed by a do - while
loop to avoid possible if/else logic defects
65: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:65:
+#define AES_SW_ENC_CNT_INC(sec, ra) \
--
ERROR: Macros starting with if should be enclosed by a do - while
loop to avoid possible if/else logic defects
73: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:73:
+#define AES_SW_DEC_CNT_INC(sec, ra) \
--
ERROR: Macros with multiple statements should be enclosed in a
do - while loop
2082: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:2082:
+#define ROUND(i, d, s) \

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_security.c | 94 +++++++++++--------
 1 file changed, 54 insertions(+), 40 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c
index 44e2b362c867..c92984fcf42d 100644
--- a/drivers/staging/rtl8723bs/core/rtw_security.c
+++ b/drivers/staging/rtl8723bs/core/rtw_security.c
@@ -31,52 +31,64 @@ const char *security_type_str(u8 value)
 
 #ifdef DBG_SW_SEC_CNT
 #define WEP_SW_ENC_CNT_INC(sec, ra) \
-	if (is_broadcast_mac_addr(ra)) \
-		sec->wep_sw_enc_cnt_bc++; \
-	else if (is_multicast_mac_addr(ra)) \
-		sec->wep_sw_enc_cnt_mc++; \
-	else \
-		sec->wep_sw_enc_cnt_uc++;
+	do { \
+		if (is_broadcast_mac_addr(ra)) \
+			sec->wep_sw_enc_cnt_bc++; \
+		else if (is_multicast_mac_addr(ra)) \
+			sec->wep_sw_enc_cnt_mc++; \
+		else \
+			sec->wep_sw_enc_cnt_uc++; \
+	} while (0)
 
 #define WEP_SW_DEC_CNT_INC(sec, ra) \
-	if (is_broadcast_mac_addr(ra)) \
-		sec->wep_sw_dec_cnt_bc++; \
-	else if (is_multicast_mac_addr(ra)) \
-		sec->wep_sw_dec_cnt_mc++; \
-	else \
-		sec->wep_sw_dec_cnt_uc++;
+	do { \
+		if (is_broadcast_mac_addr(ra)) \
+			sec->wep_sw_dec_cnt_bc++; \
+		else if (is_multicast_mac_addr(ra)) \
+			sec->wep_sw_dec_cnt_mc++; \
+		else \
+			sec->wep_sw_dec_cnt_uc++; \
+	} while (0)
 
 #define TKIP_SW_ENC_CNT_INC(sec, ra) \
-	if (is_broadcast_mac_addr(ra)) \
-		sec->tkip_sw_enc_cnt_bc++; \
-	else if (is_multicast_mac_addr(ra)) \
-		sec->tkip_sw_enc_cnt_mc++; \
-	else \
-		sec->tkip_sw_enc_cnt_uc++;
+	do { \
+		if (is_broadcast_mac_addr(ra)) \
+			sec->tkip_sw_enc_cnt_bc++; \
+		else if (is_multicast_mac_addr(ra)) \
+			sec->tkip_sw_enc_cnt_mc++; \
+		else \
+			sec->tkip_sw_enc_cnt_uc++; \
+	} while (0)
 
 #define TKIP_SW_DEC_CNT_INC(sec, ra) \
-	if (is_broadcast_mac_addr(ra)) \
-		sec->tkip_sw_dec_cnt_bc++; \
-	else if (is_multicast_mac_addr(ra)) \
-		sec->tkip_sw_dec_cnt_mc++; \
-	else \
-		sec->tkip_sw_dec_cnt_uc++;
+	do { \
+		if (is_broadcast_mac_addr(ra)) \
+			sec->tkip_sw_dec_cnt_bc++; \
+		else if (is_multicast_mac_addr(ra)) \
+			sec->tkip_sw_dec_cnt_mc++; \
+		else \
+			sec->tkip_sw_dec_cnt_uc++; \
+	} while (0)
 
 #define AES_SW_ENC_CNT_INC(sec, ra) \
-	if (is_broadcast_mac_addr(ra)) \
-		sec->aes_sw_enc_cnt_bc++; \
-	else if (is_multicast_mac_addr(ra)) \
-		sec->aes_sw_enc_cnt_mc++; \
-	else \
-		sec->aes_sw_enc_cnt_uc++;
+	do { \
+		if (is_broadcast_mac_addr(ra)) \
+			sec->aes_sw_enc_cnt_bc++; \
+		else if (is_multicast_mac_addr(ra)) \
+			sec->aes_sw_enc_cnt_mc++; \
+		else \
+			sec->aes_sw_enc_cnt_uc++; \
+	} while (0)
 
 #define AES_SW_DEC_CNT_INC(sec, ra) \
-	if (is_broadcast_mac_addr(ra)) \
-		sec->aes_sw_dec_cnt_bc++; \
-	else if (is_multicast_mac_addr(ra)) \
-		sec->aes_sw_dec_cnt_mc++; \
-	else \
-		sec->aes_sw_dec_cnt_uc++;
+	do { \
+		if (is_broadcast_mac_addr(ra)) \
+			sec->aes_sw_dec_cnt_bc++; \
+		else if (is_multicast_mac_addr(ra)) \
+			sec->aes_sw_dec_cnt_mc++; \
+		else \
+			sec->aes_sw_dec_cnt_uc++; \
+	} while (0)
 #else
 #define WEP_SW_ENC_CNT_INC(sec, ra)
 #define WEP_SW_DEC_CNT_INC(sec, ra)
@@ -2080,10 +2092,12 @@ static void rijndaelEncrypt(u32 rk[/*44*/], u8 pt[16], u8 ct[16])
 	s3 = GETU32(pt + 12) ^ rk[3];
 
 #define ROUND(i, d, s) \
-d##0 = TE0(s##0) ^ TE1(s##1) ^ TE2(s##2) ^ TE3(s##3) ^ rk[4 * i]; \
-d##1 = TE0(s##1) ^ TE1(s##2) ^ TE2(s##3) ^ TE3(s##0) ^ rk[4 * i + 1]; \
-d##2 = TE0(s##2) ^ TE1(s##3) ^ TE2(s##0) ^ TE3(s##1) ^ rk[4 * i + 2]; \
-d##3 = TE0(s##3) ^ TE1(s##0) ^ TE2(s##1) ^ TE3(s##2) ^ rk[4 * i + 3]
+	do { \
+		d##0 = TE0(s##0) ^ TE1(s##1) ^ TE2(s##2) ^ TE3(s##3) ^ rk[4 * i]; \
+		d##1 = TE0(s##1) ^ TE1(s##2) ^ TE2(s##3) ^ TE3(s##0) ^ rk[4 * i + 1]; \
+		d##2 = TE0(s##2) ^ TE1(s##3) ^ TE2(s##0) ^ TE3(s##1) ^ rk[4 * i + 2]; \
+		d##3 = TE0(s##3) ^ TE1(s##0) ^ TE2(s##1) ^ TE3(s##2) ^ rk[4 * i + 3]; \
+	} while (0)
 
 	/* Nr - 1 full rounds: */
 	r = Nr >> 1;
-- 
2.20.1


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

* [PATCH 02/15] staging: rtl8723bs: put parentheses on macros with complex values in hal/HalBtcOutSrc.h
  2021-03-26  9:09 [PATCH 00/15] staging: rtl8723bs: fix checkpatch errors on macros Fabio Aiuto
  2021-03-26  9:09 ` [PATCH 01/15] staging: rtl8723bs: inlcude macros in a do..while loop in core/rtw_security.c Fabio Aiuto
@ 2021-03-26  9:09 ` Fabio Aiuto
  2021-03-26  9:54   ` Dan Carpenter
  2021-03-26  9:09 ` [PATCH 03/15] staging: rtl8723bs: put parentheses on macros with complex values in hal/odm_debug.h Fabio Aiuto
                   ` (12 subsequent siblings)
  14 siblings, 1 reply; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-26  9:09 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Fabio Aiuto

fix the following checkpatch warning:

ERROR: Macros with complex values should be enclosed in parentheses
152: FILE: drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h:152:
+#define BTC_PRINT(dbgtype, dbgflag, printstr) \
no_printk printstr
--
ERROR: Macros with complex values should be enclosed in parentheses
153: FILE: drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h:153:
+#define BTC_PRINT_F(dbgtype, dbgflag, printstr) \
no_printk printstr
--
ERROR: Macros with complex values should be enclosed in parentheses
154: FILE: drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h:154:
+#define BTC_PRINT_ADDR(dbgtype, dbgflag, printstr, _Ptr) \
no_printk printstr

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
---
 drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h b/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h
index 10c021024b24..1926a1f7a7e5 100644
--- a/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h
+++ b/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h
@@ -149,9 +149,9 @@ extern u32 		GLBtcDbgType[];
 }
 
 #else
-#define BTC_PRINT(dbgtype, dbgflag, printstr)		 no_printk printstr
-#define BTC_PRINT_F(dbgtype, dbgflag, printstr)		 no_printk printstr
-#define BTC_PRINT_ADDR(dbgtype, dbgflag, printstr, _Ptr) no_printk printstr
+#define BTC_PRINT(dbgtype, dbgflag, printstr)		 (no_printk printstr)
+#define BTC_PRINT_F(dbgtype, dbgflag, printstr)		 (no_printk printstr)
+#define BTC_PRINT_ADDR(dbgtype, dbgflag, printstr, _Ptr) (no_printk printstr)
 #define BTC_PRINT_DATA(dbgtype, dbgflag, _TitleString, _HexData, _HexDataLen) \
 			no_printk("%s %p %zu", _TitleString, _HexData, _HexDataLen)
 #endif
-- 
2.20.1


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

* [PATCH 03/15] staging: rtl8723bs: put parentheses on macros with complex values in hal/odm_debug.h
  2021-03-26  9:09 [PATCH 00/15] staging: rtl8723bs: fix checkpatch errors on macros Fabio Aiuto
  2021-03-26  9:09 ` [PATCH 01/15] staging: rtl8723bs: inlcude macros in a do..while loop in core/rtw_security.c Fabio Aiuto
  2021-03-26  9:09 ` [PATCH 02/15] staging: rtl8723bs: put parentheses on macros with complex values in hal/HalBtcOutSrc.h Fabio Aiuto
@ 2021-03-26  9:09 ` Fabio Aiuto
  2021-03-26  9:09 ` [PATCH 04/15] staging: rtl8723bs: put parentheses on macros with complex values in include/basic_types.h Fabio Aiuto
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-26  9:09 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Fabio Aiuto

fix the following checkpatch warnings:

ERROR: Macros with complex values should be enclosed in parentheses
153: FILE: drivers/staging/rtl8723bs/hal/odm_debug.h:153:
+#define ODM_RT_TRACE(pDM_Odm, comp, level, fmt) \
no_printk fmt
--
ERROR: Macros with complex values should be enclosed in parentheses
154: FILE: drivers/staging/rtl8723bs/hal/odm_debug.h:154:
+#define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt) \
no_printk fmt
--
ERROR: Macros with complex values should be enclosed in parentheses
155: FILE: drivers/staging/rtl8723bs/hal/odm_debug.h:155:
+#define ODM_RT_ASSERT(pDM_Odm, expr, fmt) \
no_printk fmt

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
---
 drivers/staging/rtl8723bs/hal/odm_debug.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/odm_debug.h b/drivers/staging/rtl8723bs/hal/odm_debug.h
index be0d4c49a747..e6eb517c8685 100644
--- a/drivers/staging/rtl8723bs/hal/odm_debug.h
+++ b/drivers/staging/rtl8723bs/hal/odm_debug.h
@@ -150,9 +150,9 @@
 		} \
 	} while (0)
 #else
-#define ODM_RT_TRACE(pDM_Odm, comp, level, fmt)		no_printk fmt
-#define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt)	no_printk fmt
-#define ODM_RT_ASSERT(pDM_Odm, expr, fmt)		no_printk fmt
+#define ODM_RT_TRACE(pDM_Odm, comp, level, fmt)		(no_printk fmt)
+#define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt)	(no_printk fmt)
+#define ODM_RT_ASSERT(pDM_Odm, expr, fmt)		(no_printk fmt)
 #define ODM_dbg_enter()					do {} while (0)
 #define ODM_dbg_exit()					do {} while (0)
 #define ODM_dbg_trace(str)				no_printk("%s", str)
-- 
2.20.1


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

* [PATCH 04/15] staging: rtl8723bs: put parentheses on macros with complex values in include/basic_types.h
  2021-03-26  9:09 [PATCH 00/15] staging: rtl8723bs: fix checkpatch errors on macros Fabio Aiuto
                   ` (2 preceding siblings ...)
  2021-03-26  9:09 ` [PATCH 03/15] staging: rtl8723bs: put parentheses on macros with complex values in hal/odm_debug.h Fabio Aiuto
@ 2021-03-26  9:09 ` Fabio Aiuto
  2021-03-26 10:04   ` Dan Carpenter
  2021-03-26  9:09 ` [PATCH 05/15] staging: rtl8723bs: put parentheses on macros with complex values in include/drv_types.h Fabio Aiuto
                   ` (10 subsequent siblings)
  14 siblings, 1 reply; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-26  9:09 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Fabio Aiuto

fix the following checkpatch warnings:

ERROR: Macros with complex values should be enclosed in parentheses
154: FILE: drivers/staging/rtl8723bs/include/basic_types.h:154:
+#define SET_BITS_TO_LE_4BYTE(__pstart, __bitoffset, __bitlen, __val) \
--
ERROR: Macros with multiple statements should be enclosed in
a do - while loop
161: FILE: drivers/staging/rtl8723bs/include/basic_types.h:161:
+#define SET_BITS_TO_LE_2BYTE(__pstart, __bitoffset, __bitlen, __val) \
--
ERROR: Macros with complex values should be enclosed in parentheses
168: FILE: drivers/staging/rtl8723bs/include/basic_types.h:168:
+#define SET_BITS_TO_LE_1BYTE(__pstart, __bitoffset, __bitlen, __val) \

parentheses solution preferred for all fixes and made macros more
readables

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
---
 .../staging/rtl8723bs/include/basic_types.h   | 30 +++++++++++--------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8723bs/include/basic_types.h b/drivers/staging/rtl8723bs/include/basic_types.h
index 76304086107a..5054c2e3384c 100644
--- a/drivers/staging/rtl8723bs/include/basic_types.h
+++ b/drivers/staging/rtl8723bs/include/basic_types.h
@@ -152,24 +152,30 @@
 /* 		Set subfield of little-endian 4-byte value to specified value. */
 /*  */
 #define SET_BITS_TO_LE_4BYTE(__pstart, __bitoffset, __bitlen, __val) \
-		*((u32 *)(__pstart)) =				\
-		(						\
-		LE_BITS_CLEARED_TO_4BYTE(__pstart, __bitoffset, __bitlen) | \
-		((((u32)__val) & BIT_LEN_MASK_32(__bitlen)) << (__bitoffset)) \
+		(\
+			*((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)) =				\
-		(					\
-		LE_BITS_CLEARED_TO_2BYTE(__pstart, __bitoffset, __bitlen) | \
-		((((u16)__val) & BIT_LEN_MASK_16(__bitlen)) << (__bitoffset)) \
+		(\
+			*((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			\
-		(					\
-		LE_BITS_CLEARED_TO_1BYTE(__pstart, __bitoffset, __bitlen) | \
-		((((u8)__val) & BIT_LEN_MASK_8(__bitlen)) << (__bitoffset)) \
+		(\
+			*((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.20.1


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

* [PATCH 05/15] staging: rtl8723bs: put parentheses on macros with complex values in include/drv_types.h
  2021-03-26  9:09 [PATCH 00/15] staging: rtl8723bs: fix checkpatch errors on macros Fabio Aiuto
                   ` (3 preceding siblings ...)
  2021-03-26  9:09 ` [PATCH 04/15] staging: rtl8723bs: put parentheses on macros with complex values in include/basic_types.h Fabio Aiuto
@ 2021-03-26  9:09 ` Fabio Aiuto
  2021-03-26 14:22   ` Dan Carpenter
  2021-03-26  9:09 ` [PATCH 06/15] staging: rtl8723bs: put parentheses on macros with complex values in include/hal_com.h Fabio Aiuto
                   ` (9 subsequent siblings)
  14 siblings, 1 reply; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-26  9:09 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Fabio Aiuto

fix the following checkpatch warning:

ERROR: Macros with complex values should be enclosed in parentheses
279: FILE: drivers/staging/rtl8723bs/include/drv_types.h:279:
+#define KEY_ARG(x) ((u8 *)(x))[0], ((u8 *)(x))[1],
((u8 *)(x))[2], ((u8 *)(x))[3], ((u8 *)(x))[4], ((u8 *)(x))[5], \

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
---
 drivers/staging/rtl8723bs/include/drv_types.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h
index 1658450b386e..ead4cb9c1e5a 100644
--- a/drivers/staging/rtl8723bs/include/drv_types.h
+++ b/drivers/staging/rtl8723bs/include/drv_types.h
@@ -276,9 +276,9 @@ struct cam_entry_cache {
 };
 
 #define KEY_FMT "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
-#define KEY_ARG(x) ((u8 *)(x))[0], ((u8 *)(x))[1], ((u8 *)(x))[2], ((u8 *)(x))[3], ((u8 *)(x))[4], ((u8 *)(x))[5], \
+#define KEY_ARG(x) (((u8 *)(x))[0], ((u8 *)(x))[1], ((u8 *)(x))[2], ((u8 *)(x))[3], ((u8 *)(x))[4], ((u8 *)(x))[5], \
 	((u8 *)(x))[6], ((u8 *)(x))[7], ((u8 *)(x))[8], ((u8 *)(x))[9], ((u8 *)(x))[10], ((u8 *)(x))[11], \
-	((u8 *)(x))[12], ((u8 *)(x))[13], ((u8 *)(x))[14], ((u8 *)(x))[15]
+	((u8 *)(x))[12], ((u8 *)(x))[13], ((u8 *)(x))[14], ((u8 *)(x))[15])
 
 struct dvobj_priv {
 	/*-------- below is common data --------*/
-- 
2.20.1


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

* [PATCH 06/15] staging: rtl8723bs: put parentheses on macros with complex values in include/hal_com.h
  2021-03-26  9:09 [PATCH 00/15] staging: rtl8723bs: fix checkpatch errors on macros Fabio Aiuto
                   ` (4 preceding siblings ...)
  2021-03-26  9:09 ` [PATCH 05/15] staging: rtl8723bs: put parentheses on macros with complex values in include/drv_types.h Fabio Aiuto
@ 2021-03-26  9:09 ` Fabio Aiuto
  2021-03-26  9:09 ` [PATCH 07/15] staging: rtl8723bs: put parentheses on macros with complex values in include/hal_com_reg.h Fabio Aiuto
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-26  9:09 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Fabio Aiuto

fix the following checkpatch warnings:

ERROR: Macros with complex values should be enclosed in parentheses
187: FILE: drivers/staging/rtl8723bs/include/hal_com.h:187:
+#define PageNum_128(_Len)
		(u32)(((_Len)>>7) + ((_Len)&0x7F ? 1:0))
--
ERROR: Macros with complex values should be enclosed in parentheses
188: FILE: drivers/staging/rtl8723bs/include/hal_com.h:188:
+#define PageNum_256(_Len)
		(u32)(((_Len)>>8) + ((_Len)&0xFF ? 1:0))
--
ERROR: Macros with complex values should be enclosed in parentheses
189: FILE: drivers/staging/rtl8723bs/include/hal_com.h:189:
+#define PageNum_512(_Len)
		(u32)(((_Len)>>9) + ((_Len)&0x1FF ? 1:0))
--
ERROR: Macros with complex values should be enclosed in parentheses
190: FILE: drivers/staging/rtl8723bs/include/hal_com.h:190:
+#define PageNum(_Len, _Size)
		(u32)(((_Len)/(_Size)) + ((_Len)&((_Size) - 1) ? 1:0))

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
---
 drivers/staging/rtl8723bs/include/hal_com.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8723bs/include/hal_com.h b/drivers/staging/rtl8723bs/include/hal_com.h
index 28451385dec3..0bc0e1361765 100644
--- a/drivers/staging/rtl8723bs/include/hal_com.h
+++ b/drivers/staging/rtl8723bs/include/hal_com.h
@@ -184,10 +184,10 @@ enum firmware_source {
 #define TX_SELE_NQ			BIT(2)		/*  Normal Queue */
 #define TX_SELE_EQ			BIT(3)		/*  Extern Queue */
 
-#define PageNum_128(_Len)		(u32)(((_Len)>>7) + ((_Len)&0x7F ? 1:0))
-#define PageNum_256(_Len)		(u32)(((_Len)>>8) + ((_Len)&0xFF ? 1:0))
-#define PageNum_512(_Len)		(u32)(((_Len)>>9) + ((_Len)&0x1FF ? 1:0))
-#define PageNum(_Len, _Size)		(u32)(((_Len)/(_Size)) + ((_Len)&((_Size) - 1) ? 1:0))
+#define PageNum_128(_Len)		((u32)(((_Len)>>7) + ((_Len)&0x7F ? 1:0)))
+#define PageNum_256(_Len)		((u32)(((_Len)>>8) + ((_Len)&0xFF ? 1:0)))
+#define PageNum_512(_Len)		((u32)(((_Len)>>9) + ((_Len)&0x1FF ? 1:0)))
+#define PageNum(_Len, _Size)		((u32)(((_Len)/(_Size)) + ((_Len)&((_Size) - 1) ? 1:0)))
 
 
 u8 rtw_hal_data_init(struct adapter *padapter);
-- 
2.20.1


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

* [PATCH 07/15] staging: rtl8723bs: put parentheses on macros with complex values in include/hal_com_reg.h
  2021-03-26  9:09 [PATCH 00/15] staging: rtl8723bs: fix checkpatch errors on macros Fabio Aiuto
                   ` (5 preceding siblings ...)
  2021-03-26  9:09 ` [PATCH 06/15] staging: rtl8723bs: put parentheses on macros with complex values in include/hal_com.h Fabio Aiuto
@ 2021-03-26  9:09 ` Fabio Aiuto
  2021-03-26  9:09 ` [PATCH 08/15] staging: rtl8723bs: put parentheses on macros with complex values in include/hal_data.h Fabio Aiuto
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-26  9:09 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Fabio Aiuto

fix the following checkpatch warnings:

ERROR: Macros with complex values should be enclosed in parentheses
710: FILE: drivers/staging/rtl8723bs/include/hal_com_reg.h:710:
+#define	RATE_ALL_CCK
			RATR_1M | RATR_2M | RATR_55M | RATR_11M
--
ERROR: Macros with complex values should be enclosed in parentheses
711: FILE: drivers/staging/rtl8723bs/include/hal_com_reg.h:711:
+#define	RATE_ALL_OFDM_AG
		RATR_6M | RATR_9M | RATR_12M | RATR_18M | RATR_24M |\
--
ERROR: Macros with complex values should be enclosed in parentheses
713: FILE: drivers/staging/rtl8723bs/include/hal_com_reg.h:713:
+#define	RATE_ALL_OFDM_1SS
		RATR_MCS0 | RATR_MCS1 | RATR_MCS2 | RATR_MCS3 |\
--
ERROR: Macros with complex values should be enclosed in parentheses
715: FILE: drivers/staging/rtl8723bs/include/hal_com_reg.h:715:
+#define	RATE_ALL_OFDM_2SS
		RATR_MCS8 | RATR_MCS9 | RATR_MCS10 | RATR_MCS11 |\

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
---
 drivers/staging/rtl8723bs/include/hal_com_reg.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8723bs/include/hal_com_reg.h b/drivers/staging/rtl8723bs/include/hal_com_reg.h
index b555826760d0..b5610dedc23e 100644
--- a/drivers/staging/rtl8723bs/include/hal_com_reg.h
+++ b/drivers/staging/rtl8723bs/include/hal_com_reg.h
@@ -707,13 +707,13 @@ Default: 00b.
 
 
 /*  ALL CCK Rate */
-#define	RATE_ALL_CCK				RATR_1M | RATR_2M | RATR_55M | RATR_11M
-#define	RATE_ALL_OFDM_AG			RATR_6M | RATR_9M | RATR_12M | RATR_18M | RATR_24M |\
-						RATR_36M | RATR_48M | RATR_54M
-#define	RATE_ALL_OFDM_1SS			RATR_MCS0 | RATR_MCS1 | RATR_MCS2 | RATR_MCS3 |\
-						RATR_MCS4 | RATR_MCS5 | RATR_MCS6 | RATR_MCS7
-#define	RATE_ALL_OFDM_2SS			RATR_MCS8 | RATR_MCS9 | RATR_MCS10 | RATR_MCS11 |\
-						RATR_MCS12 | RATR_MCS13 | RATR_MCS14 | RATR_MCS15
+#define	RATE_ALL_CCK				(RATR_1M | RATR_2M | RATR_55M | RATR_11M)
+#define	RATE_ALL_OFDM_AG			(RATR_6M | RATR_9M | RATR_12M | RATR_18M | RATR_24M |\
+						RATR_36M | RATR_48M | RATR_54M)
+#define	RATE_ALL_OFDM_1SS			(RATR_MCS0 | RATR_MCS1 | RATR_MCS2 | RATR_MCS3 |\
+						RATR_MCS4 | RATR_MCS5 | RATR_MCS6 | RATR_MCS7)
+#define	RATE_ALL_OFDM_2SS			(RATR_MCS8 | RATR_MCS9 | RATR_MCS10 | RATR_MCS11 |\
+						RATR_MCS12 | RATR_MCS13 | RATR_MCS14 | RATR_MCS15)
 
 #define RATE_BITMAP_ALL			0xFFFFF
 
-- 
2.20.1


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

* [PATCH 08/15] staging: rtl8723bs: put parentheses on macros with complex values in include/hal_data.h
  2021-03-26  9:09 [PATCH 00/15] staging: rtl8723bs: fix checkpatch errors on macros Fabio Aiuto
                   ` (6 preceding siblings ...)
  2021-03-26  9:09 ` [PATCH 07/15] staging: rtl8723bs: put parentheses on macros with complex values in include/hal_com_reg.h Fabio Aiuto
@ 2021-03-26  9:09 ` Fabio Aiuto
  2021-03-26  9:09 ` [PATCH 09/15] staging: rtl8723bs: put parentheses on macros with complex values in include/hal_phy.h Fabio Aiuto
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-26  9:09 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Fabio Aiuto

fix the following checkpatch warnings:

ERROR: Macros with complex values should be enclosed in parentheses
49: FILE: drivers/staging/rtl8723bs/include/hal_data.h:49:
+#define CHANNEL_MAX_NUMBER
		14+24+21	/*  14 is the max channel number */
--
ERROR: Macros with complex values should be enclosed in parentheses
53: FILE: drivers/staging/rtl8723bs/include/hal_data.h:53:
+#define CHANNEL_GROUP_MAX
		3+9	/*  ch1~3, ch4~9, ch10~14 total three groups */
--
ERROR: Macros with complex values should be enclosed in parentheses
76: FILE: drivers/staging/rtl8723bs/include/hal_data.h:76:
+#define IQK_Matrix_Settings_NUM_92D	1+24+21

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
---
 drivers/staging/rtl8723bs/include/hal_data.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/include/hal_data.h b/drivers/staging/rtl8723bs/include/hal_data.h
index b5a0be35a6ce..2f73540dd738 100644
--- a/drivers/staging/rtl8723bs/include/hal_data.h
+++ b/drivers/staging/rtl8723bs/include/hal_data.h
@@ -46,11 +46,11 @@ enum rt_ampdu_burst {
 	RT_AMPDU_BURST_8723B	= 7,
 };
 
-#define CHANNEL_MAX_NUMBER		14+24+21	/*  14 is the max channel number */
+#define CHANNEL_MAX_NUMBER		(14+24+21)	/*  14 is the max channel number */
 #define CHANNEL_MAX_NUMBER_2G		14
 #define CHANNEL_MAX_NUMBER_5G		54			/*  Please refer to "phy_GetChnlGroup8812A" and "Hal_ReadTxPowerInfo8812A" */
 #define CHANNEL_MAX_NUMBER_5G_80M	7
-#define CHANNEL_GROUP_MAX		3+9	/*  ch1~3, ch4~9, ch10~14 total three groups */
+#define CHANNEL_GROUP_MAX		(3+9)	/*  ch1~3, ch4~9, ch10~14 total three groups */
 #define MAX_PG_GROUP			13
 
 /*  Tx Power Limit Table Size */
@@ -73,7 +73,7 @@ enum rt_ampdu_burst {
 #define IQK_BB_REG_NUM_92D	10
 #define IQK_BB_REG_NUM_test	6
 
-#define IQK_Matrix_Settings_NUM_92D	1+24+21
+#define IQK_Matrix_Settings_NUM_92D	(1+24+21)
 
 /* define HP_THERMAL_NUM		8 */
 /*  duplicate code, will move to ODM ######### */
-- 
2.20.1


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

* [PATCH 09/15] staging: rtl8723bs: put parentheses on macros with complex values in include/hal_phy.h
  2021-03-26  9:09 [PATCH 00/15] staging: rtl8723bs: fix checkpatch errors on macros Fabio Aiuto
                   ` (7 preceding siblings ...)
  2021-03-26  9:09 ` [PATCH 08/15] staging: rtl8723bs: put parentheses on macros with complex values in include/hal_data.h Fabio Aiuto
@ 2021-03-26  9:09 ` Fabio Aiuto
  2021-03-26  9:09 ` [PATCH 10/15] staging: rtl8723bs: put parentheses on macros with complex values in include/ieee80211.h Fabio Aiuto
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-26  9:09 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Fabio Aiuto

fix the following checkpatch warning:

ERROR: Macros with complex values should be enclosed in parentheses
27: FILE: drivers/staging/rtl8723bs/include/hal_phy.h:27:
+#define	RF6052_MAX_REG	\

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
---
 drivers/staging/rtl8723bs/include/hal_phy.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/include/hal_phy.h b/drivers/staging/rtl8723bs/include/hal_phy.h
index 90bb5d784674..5aec04f705b1 100644
--- a/drivers/staging/rtl8723bs/include/hal_phy.h
+++ b/drivers/staging/rtl8723bs/include/hal_phy.h
@@ -25,7 +25,7 @@
 #define	RF6052_MAX_REG_92C			0x7F
 
 #define	RF6052_MAX_REG	\
-		(RF6052_MAX_REG_88E > RF6052_MAX_REG_92C) ? RF6052_MAX_REG_88E : RF6052_MAX_REG_92C
+		((RF6052_MAX_REG_88E > RF6052_MAX_REG_92C) ? RF6052_MAX_REG_88E : RF6052_MAX_REG_92C)
 
 #define GET_RF6052_REAL_MAX_REG(_Adapter)	RF6052_MAX_REG_92C
 
-- 
2.20.1


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

* [PATCH 10/15] staging: rtl8723bs: put parentheses on macros with complex values in include/ieee80211.h
  2021-03-26  9:09 [PATCH 00/15] staging: rtl8723bs: fix checkpatch errors on macros Fabio Aiuto
                   ` (8 preceding siblings ...)
  2021-03-26  9:09 ` [PATCH 09/15] staging: rtl8723bs: put parentheses on macros with complex values in include/hal_phy.h Fabio Aiuto
@ 2021-03-26  9:09 ` Fabio Aiuto
  2021-03-26  9:09 ` [PATCH 11/15] staging: rtl8723bs: put parentheses on macros with complex values in include/rtw_debug.h Fabio Aiuto
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-26  9:09 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Fabio Aiuto

fix the following checkpatch warning:

ERROR: Macros with complex values should be enclosed in parentheses
823: FILE: drivers/staging/rtl8723bs/include/ieee80211.h:823:
+#define CHAN_ARG(channel) \

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
---
 drivers/staging/rtl8723bs/include/ieee80211.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/include/ieee80211.h b/drivers/staging/rtl8723bs/include/ieee80211.h
index 8a10bca876b8..80df24c1c6ed 100644
--- a/drivers/staging/rtl8723bs/include/ieee80211.h
+++ b/drivers/staging/rtl8723bs/include/ieee80211.h
@@ -823,8 +823,8 @@ struct rtw_ieee80211_channel {
 #define CHAN_ARG(channel) \
 	/*(channel)->band*/ \
 	/*, (channel)->center_freq*/ \
-	(channel)->hw_value \
-	, (channel)->flags \
+	((channel)->hw_value \
+	, (channel)->flags) \
 	/*, (channel)->max_antenna_gain*/ \
 	/*, (channel)->max_power*/ \
 	/*, (channel)->max_reg_power*/ \
-- 
2.20.1


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

* [PATCH 11/15] staging: rtl8723bs: put parentheses on macros with complex values in include/rtw_debug.h
  2021-03-26  9:09 [PATCH 00/15] staging: rtl8723bs: fix checkpatch errors on macros Fabio Aiuto
                   ` (9 preceding siblings ...)
  2021-03-26  9:09 ` [PATCH 10/15] staging: rtl8723bs: put parentheses on macros with complex values in include/ieee80211.h Fabio Aiuto
@ 2021-03-26  9:09 ` Fabio Aiuto
  2021-03-26  9:09 ` [PATCH 12/15] staging: rtl8723bs: put parentheses on macros with complex values in include/rtw_pwrctrl.h Fabio Aiuto
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-26  9:09 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Fabio Aiuto

fix the following checkpatch warning:

ERROR: Macros starting with if should be enclosed by a
do - while loop to avoid possible if/else logic defects
+	#define RT_PRINT_DATA(_Comp, _Level,
	_TitleString, _HexData, _HexDataLen)			\

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
---
 drivers/staging/rtl8723bs/include/rtw_debug.h | 28 ++++++++++---------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/rtl8723bs/include/rtw_debug.h b/drivers/staging/rtl8723bs/include/rtw_debug.h
index d1c557818305..b00f8a6c4312 100644
--- a/drivers/staging/rtl8723bs/include/rtw_debug.h
+++ b/drivers/staging/rtl8723bs/include/rtw_debug.h
@@ -236,19 +236,21 @@
 #if	defined(_dbgdump)
 	#undef RT_PRINT_DATA
 	#define RT_PRINT_DATA(_Comp, _Level, _TitleString, _HexData, _HexDataLen)			\
-		if (((_Comp) & GlobalDebugComponents) && (_Level <= GlobalDebugLevel))	\
-		{									\
-			int __i;								\
-			u8 *ptr = (u8 *)_HexData;				\
-			_dbgdump("%s", DRIVER_PREFIX);						\
-			_dbgdump(_TitleString);						\
-			for (__i = 0; __i < (int)_HexDataLen; __i++)				\
-			{								\
-				_dbgdump("%02X%s", ptr[__i], (((__i + 1) % 4) == 0)?"  ":" ");	\
-				if (((__i + 1) % 16) == 0)	_dbgdump("\n");			\
-			}								\
-			_dbgdump("\n");							\
-		}
+		do { \
+			if (((_Comp) & GlobalDebugComponents) && (_Level <= GlobalDebugLevel))	\
+			{									\
+				int __i;								\
+				u8 *ptr = (u8 *)_HexData;				\
+				_dbgdump("%s", DRIVER_PREFIX);						\
+				_dbgdump(_TitleString);						\
+				for (__i = 0; __i < (int)_HexDataLen; __i++)				\
+				{								\
+					_dbgdump("%02X%s", ptr[__i], (((__i + 1) % 4) == 0)?"  ":" ");	\
+					if (((__i + 1) % 16) == 0)	_dbgdump("\n");			\
+				}								\
+				_dbgdump("\n");							\
+			} \
+		} while (0)
 #endif /* defined(_dbgdump) */
 #endif /* DEBUG_RTL871X */
 
-- 
2.20.1


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

* [PATCH 12/15] staging: rtl8723bs: put parentheses on macros with complex values in include/rtw_pwrctrl.h
  2021-03-26  9:09 [PATCH 00/15] staging: rtl8723bs: fix checkpatch errors on macros Fabio Aiuto
                   ` (10 preceding siblings ...)
  2021-03-26  9:09 ` [PATCH 11/15] staging: rtl8723bs: put parentheses on macros with complex values in include/rtw_debug.h Fabio Aiuto
@ 2021-03-26  9:09 ` Fabio Aiuto
  2021-03-26  9:09 ` [PATCH 13/15] staging: rtl8723bs: add spaces around operator " Fabio Aiuto
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-26  9:09 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Fabio Aiuto

fix the following checkpatch warnings:

ERROR: Macros with complex values should be enclosed in parentheses
92: FILE: drivers/staging/rtl8723bs/include/rtw_pwrctrl.h:92:
+#define LPS_DELAY_TIME	1*HZ /*  1 sec */
--
ERROR: Macros with complex values should be enclosed in parentheses
241: FILE: drivers/staging/rtl8723bs/include/rtw_pwrctrl.h:241:
+#define rtw_get_ips_mode_req(pwrctl) \
--
ERROR: Macros with complex values should be enclosed in parentheses
244: FILE: drivers/staging/rtl8723bs/include/rtw_pwrctrl.h:244:
+#define rtw_ips_mode_req(pwrctl, ips_mode) \

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
---
 drivers/staging/rtl8723bs/include/rtw_pwrctrl.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
index cec9fc0cf794..688436cf3610 100644
--- a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
+++ b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
@@ -89,7 +89,7 @@ struct reportpwrstate_parm {
 	unsigned short rsvd;
 };
 
-#define LPS_DELAY_TIME	1*HZ /*  1 sec */
+#define LPS_DELAY_TIME	(1*HZ) /*  1 sec */
 
 #define EXE_PWR_NONE	0x01
 #define EXE_PWR_IPS		0x02
@@ -239,10 +239,10 @@ struct pwrctrl_priv {
 };
 
 #define rtw_get_ips_mode_req(pwrctl) \
-	(pwrctl)->ips_mode_req
+	((pwrctl)->ips_mode_req)
 
 #define rtw_ips_mode_req(pwrctl, ips_mode) \
-	(pwrctl)->ips_mode_req = (ips_mode)
+	((pwrctl)->ips_mode_req = (ips_mode))
 
 #define RTW_PWR_STATE_CHK_INTERVAL 2000
 
-- 
2.20.1


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

* [PATCH 13/15] staging: rtl8723bs: add spaces around operator in include/rtw_pwrctrl.h
  2021-03-26  9:09 [PATCH 00/15] staging: rtl8723bs: fix checkpatch errors on macros Fabio Aiuto
                   ` (11 preceding siblings ...)
  2021-03-26  9:09 ` [PATCH 12/15] staging: rtl8723bs: put parentheses on macros with complex values in include/rtw_pwrctrl.h Fabio Aiuto
@ 2021-03-26  9:09 ` Fabio Aiuto
  2021-03-26  9:09 ` [PATCH 14/15] staging: rtl8723bs: put parentheses on macros with complex values in include/sta_info.h Fabio Aiuto
  2021-03-26  9:09 ` [PATCH 15/15] staging: rtl8723bs: put parentheses on macros with complex values in include/wifi.h Fabio Aiuto
  14 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-26  9:09 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Fabio Aiuto

fix post-commit hook checkpatch warning:

add a space around that '*'

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
---
 drivers/staging/rtl8723bs/include/rtw_pwrctrl.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
index 688436cf3610..88e66211e0e3 100644
--- a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
+++ b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
@@ -89,7 +89,7 @@ struct reportpwrstate_parm {
 	unsigned short rsvd;
 };
 
-#define LPS_DELAY_TIME	(1*HZ) /*  1 sec */
+#define LPS_DELAY_TIME	(1 * HZ) /*  1 sec */
 
 #define EXE_PWR_NONE	0x01
 #define EXE_PWR_IPS		0x02
-- 
2.20.1


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

* [PATCH 14/15] staging: rtl8723bs:  put parentheses on macros with complex values in include/sta_info.h
  2021-03-26  9:09 [PATCH 00/15] staging: rtl8723bs: fix checkpatch errors on macros Fabio Aiuto
                   ` (12 preceding siblings ...)
  2021-03-26  9:09 ` [PATCH 13/15] staging: rtl8723bs: add spaces around operator " Fabio Aiuto
@ 2021-03-26  9:09 ` Fabio Aiuto
  2021-03-26 13:39   ` David Laight
  2021-03-26  9:09 ` [PATCH 15/15] staging: rtl8723bs: put parentheses on macros with complex values in include/wifi.h Fabio Aiuto
  14 siblings, 1 reply; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-26  9:09 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Fabio Aiuto

fix the following checkpatch warnings:

ERROR: Macros with complex values should be enclosed in parentheses
284: FILE: drivers/staging/rtl8723bs/include/sta_info.h:284:
+#define STA_RX_PKTS_ARG(sta) \
--
ERROR: Macros with complex values should be enclosed in parentheses
289: FILE: drivers/staging/rtl8723bs/include/sta_info.h:289:
+#define STA_LAST_RX_PKTS_ARG(sta) \
--
ERROR: Macros with complex values should be enclosed in parentheses
294: FILE: drivers/staging/rtl8723bs/include/sta_info.h:294:
+#define STA_RX_PKTS_DIFF_ARG(sta) \

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
---
 drivers/staging/rtl8723bs/include/sta_info.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8723bs/include/sta_info.h b/drivers/staging/rtl8723bs/include/sta_info.h
index abde3e3df988..1cdf93ec3b66 100644
--- a/drivers/staging/rtl8723bs/include/sta_info.h
+++ b/drivers/staging/rtl8723bs/include/sta_info.h
@@ -282,19 +282,19 @@ struct sta_info {
 	} while (0)
 
 #define STA_RX_PKTS_ARG(sta) \
-	sta->sta_stats.rx_mgnt_pkts \
+	(sta->sta_stats.rx_mgnt_pkts \
 	, sta->sta_stats.rx_ctrl_pkts \
-	, sta->sta_stats.rx_data_pkts
+	, sta->sta_stats.rx_data_pkts)
 
 #define STA_LAST_RX_PKTS_ARG(sta) \
-	sta->sta_stats.last_rx_mgnt_pkts \
+	(sta->sta_stats.last_rx_mgnt_pkts \
 	, sta->sta_stats.last_rx_ctrl_pkts \
-	, sta->sta_stats.last_rx_data_pkts
+	, sta->sta_stats.last_rx_data_pkts)
 
 #define STA_RX_PKTS_DIFF_ARG(sta) \
-	sta->sta_stats.rx_mgnt_pkts - sta->sta_stats.last_rx_mgnt_pkts \
+	(sta->sta_stats.rx_mgnt_pkts - sta->sta_stats.last_rx_mgnt_pkts \
 	, sta->sta_stats.rx_ctrl_pkts - sta->sta_stats.last_rx_ctrl_pkts \
-	, sta->sta_stats.rx_data_pkts - sta->sta_stats.last_rx_data_pkts
+	, sta->sta_stats.rx_data_pkts - sta->sta_stats.last_rx_data_pkts)
 
 #define STA_PKTS_FMT "(m:%llu, c:%llu, d:%llu)"
 
-- 
2.20.1


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

* [PATCH 15/15] staging: rtl8723bs:  put parentheses on macros with complex values in include/wifi.h
  2021-03-26  9:09 [PATCH 00/15] staging: rtl8723bs: fix checkpatch errors on macros Fabio Aiuto
                   ` (13 preceding siblings ...)
  2021-03-26  9:09 ` [PATCH 14/15] staging: rtl8723bs: put parentheses on macros with complex values in include/sta_info.h Fabio Aiuto
@ 2021-03-26  9:09 ` Fabio Aiuto
  14 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-26  9:09 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Fabio Aiuto

fix the following checkpatch warnings:

ERROR: Macros with complex values should be enclosed in parentheses
114: FILE: drivers/staging/rtl8723bs/include/wifi.h:114:
+#define SetToDs(pbuf)	\
--
ERROR: Macros with complex values should be enclosed in parentheses
119: FILE: drivers/staging/rtl8723bs/include/wifi.h:119:
+#define ClearToDs(pbuf)	\
--
ERROR: Macros with complex values should be enclosed in parentheses
122: FILE: drivers/staging/rtl8723bs/include/wifi.h:122:
+#define SetFrDs(pbuf)	\
--
ERROR: Macros with complex values should be enclosed in parentheses
127: FILE: drivers/staging/rtl8723bs/include/wifi.h:127:
+#define ClearFrDs(pbuf)	\
--
ERROR: Macros with complex values should be enclosed in parentheses
132: FILE: drivers/staging/rtl8723bs/include/wifi.h:132:
+#define SetMFrag(pbuf)	\
--
ERROR: Macros with complex values should be enclosed in parentheses
137: FILE: drivers/staging/rtl8723bs/include/wifi.h:137:
+#define ClearMFrag(pbuf)	\
--
ERROR: Macros with complex values should be enclosed in parentheses
140: FILE: drivers/staging/rtl8723bs/include/wifi.h:140:
+#define SetRetry(pbuf)	\
--
ERROR: Macros with complex values should be enclosed in parentheses
145: FILE: drivers/staging/rtl8723bs/include/wifi.h:145:
+#define ClearRetry(pbuf)	\
--
ERROR: Macros with complex values should be enclosed in parentheses
148: FILE: drivers/staging/rtl8723bs/include/wifi.h:148:
+#define SetPwrMgt(pbuf)	\
--
ERROR: Macros with complex values should be enclosed in parentheses
153: FILE: drivers/staging/rtl8723bs/include/wifi.h:153:
+#define ClearPwrMgt(pbuf)	\
--
ERROR: Macros with complex values should be enclosed in parentheses
156: FILE: drivers/staging/rtl8723bs/include/wifi.h:156:
+#define SetMData(pbuf)	\
--
ERROR: Macros with complex values should be enclosed in parentheses
161: FILE: drivers/staging/rtl8723bs/include/wifi.h:161:
+#define ClearMData(pbuf)	\
--
ERROR: Macros with complex values should be enclosed in parentheses
164: FILE: drivers/staging/rtl8723bs/include/wifi.h:164:
+#define SetPrivacy(pbuf)	\
--
ERROR: Macros with complex values should be enclosed in parentheses
170: FILE: drivers/staging/rtl8723bs/include/wifi.h:170:
+#define ClearPrivacy(pbuf)	\
--
ERROR: Macros with complex values should be enclosed in parentheses
220: FILE: drivers/staging/rtl8723bs/include/wifi.h:220:
+#define SetDuration(pbuf, dur) \
--
ERROR: Macros with complex values should be enclosed in parentheses
224: FILE: drivers/staging/rtl8723bs/include/wifi.h:224:
+#define SetPriority(pbuf, tid)	\
--
ERROR: Macros with complex values should be enclosed in parentheses
229: FILE: drivers/staging/rtl8723bs/include/wifi.h:229:
+#define SetEOSP(pbuf, eosp)	\
--
ERROR: Macros with complex values should be enclosed in parentheses
232: FILE: drivers/staging/rtl8723bs/include/wifi.h:232:
+#define SetAckpolicy(pbuf, ack)	\
--
ERROR: Macros with complex values should be enclosed in parentheses
239: FILE: drivers/staging/rtl8723bs/include/wifi.h:239:
+#define SetAMsdu(pbuf, amsdu)	\

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
---
 drivers/staging/rtl8723bs/include/wifi.h | 38 ++++++++++++------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/rtl8723bs/include/wifi.h b/drivers/staging/rtl8723bs/include/wifi.h
index efef549bf811..a9f24fc2bf2f 100644
--- a/drivers/staging/rtl8723bs/include/wifi.h
+++ b/drivers/staging/rtl8723bs/include/wifi.h
@@ -112,63 +112,63 @@ enum wifi_reg_domain {
 #define _ORDER_			BIT(15)
 
 #define SetToDs(pbuf)	\
-	*(__le16 *)(pbuf) |= cpu_to_le16(_TO_DS_)
+	(*(__le16 *)(pbuf) |= cpu_to_le16(_TO_DS_))
 
 #define GetToDs(pbuf)	(((*(__le16 *)(pbuf)) & cpu_to_le16(_TO_DS_)) != 0)
 
 #define ClearToDs(pbuf)	\
-	*(__le16 *)(pbuf) &= (~cpu_to_le16(_TO_DS_))
+	(*(__le16 *)(pbuf) &= (~cpu_to_le16(_TO_DS_)))
 
 #define SetFrDs(pbuf)	\
-	*(__le16 *)(pbuf) |= cpu_to_le16(_FROM_DS_)
+	(*(__le16 *)(pbuf) |= cpu_to_le16(_FROM_DS_))
 
 #define GetFrDs(pbuf)	(((*(__le16 *)(pbuf)) & cpu_to_le16(_FROM_DS_)) != 0)
 
 #define ClearFrDs(pbuf)	\
-	*(__le16 *)(pbuf) &= (~cpu_to_le16(_FROM_DS_))
+	(*(__le16 *)(pbuf) &= (~cpu_to_le16(_FROM_DS_)))
 
 #define get_tofr_ds(pframe)	((GetToDs(pframe) << 1) | GetFrDs(pframe))
 
 #define SetMFrag(pbuf)	\
-	*(__le16 *)(pbuf) |= cpu_to_le16(_MORE_FRAG_)
+	(*(__le16 *)(pbuf) |= cpu_to_le16(_MORE_FRAG_))
 
 #define GetMFrag(pbuf)	(((*(__le16 *)(pbuf)) & cpu_to_le16(_MORE_FRAG_)) != 0)
 
 #define ClearMFrag(pbuf)	\
-	*(__le16 *)(pbuf) &= (~cpu_to_le16(_MORE_FRAG_))
+	(*(__le16 *)(pbuf) &= (~cpu_to_le16(_MORE_FRAG_)))
 
 #define SetRetry(pbuf)	\
-	*(__le16 *)(pbuf) |= cpu_to_le16(_RETRY_)
+	(*(__le16 *)(pbuf) |= cpu_to_le16(_RETRY_))
 
 #define GetRetry(pbuf)	(((*(__le16 *)(pbuf)) & cpu_to_le16(_RETRY_)) != 0)
 
 #define ClearRetry(pbuf)	\
-	*(__le16 *)(pbuf) &= (~cpu_to_le16(_RETRY_))
+	(*(__le16 *)(pbuf) &= (~cpu_to_le16(_RETRY_)))
 
 #define SetPwrMgt(pbuf)	\
-	*(__le16 *)(pbuf) |= cpu_to_le16(_PWRMGT_)
+	(*(__le16 *)(pbuf) |= cpu_to_le16(_PWRMGT_))
 
 #define GetPwrMgt(pbuf)	(((*(__le16 *)(pbuf)) & cpu_to_le16(_PWRMGT_)) != 0)
 
 #define ClearPwrMgt(pbuf)	\
-	*(__le16 *)(pbuf) &= (~cpu_to_le16(_PWRMGT_))
+	(*(__le16 *)(pbuf) &= (~cpu_to_le16(_PWRMGT_)))
 
 #define SetMData(pbuf)	\
-	*(__le16 *)(pbuf) |= cpu_to_le16(_MORE_DATA_)
+	(*(__le16 *)(pbuf) |= cpu_to_le16(_MORE_DATA_))
 
 #define GetMData(pbuf)	(((*(__le16 *)(pbuf)) & cpu_to_le16(_MORE_DATA_)) != 0)
 
 #define ClearMData(pbuf)	\
-	*(__le16 *)(pbuf) &= (~cpu_to_le16(_MORE_DATA_))
+	(*(__le16 *)(pbuf) &= (~cpu_to_le16(_MORE_DATA_)))
 
 #define SetPrivacy(pbuf)	\
-	*(__le16 *)(pbuf) |= cpu_to_le16(_PRIVACY_)
+	(*(__le16 *)(pbuf) |= cpu_to_le16(_PRIVACY_))
 
 #define GetPrivacy(pbuf)					\
 	(((*(__le16 *)(pbuf)) & cpu_to_le16(_PRIVACY_)) != 0)
 
 #define ClearPrivacy(pbuf)	\
-	*(__le16 *)(pbuf) &= (~cpu_to_le16(_PRIVACY_))
+	(*(__le16 *)(pbuf) &= (~cpu_to_le16(_PRIVACY_)))
 
 
 #define GetOrder(pbuf)					\
@@ -218,26 +218,26 @@ enum wifi_reg_domain {
 	} while (0)
 
 #define SetDuration(pbuf, dur) \
-	*(__le16 *)((size_t)(pbuf) + 2) = cpu_to_le16(0xffff & (dur))
+	(*(__le16 *)((size_t)(pbuf) + 2) = cpu_to_le16(0xffff & (dur)))
 
 
 #define SetPriority(pbuf, tid)	\
-	*(__le16 *)(pbuf) |= cpu_to_le16(tid & 0xf)
+	(*(__le16 *)(pbuf) |= cpu_to_le16(tid & 0xf))
 
 #define GetPriority(pbuf)	((le16_to_cpu(*(__le16 *)(pbuf))) & 0xf)
 
 #define SetEOSP(pbuf, eosp)	\
-		*(__le16 *)(pbuf) |= cpu_to_le16((eosp & 1) << 4)
+		(*(__le16 *)(pbuf) |= cpu_to_le16((eosp & 1) << 4))
 
 #define SetAckpolicy(pbuf, ack)	\
-	*(__le16 *)(pbuf) |= cpu_to_le16((ack & 3) << 5)
+	(*(__le16 *)(pbuf) |= cpu_to_le16((ack & 3) << 5))
 
 #define GetAckpolicy(pbuf) (((le16_to_cpu(*(__le16 *)pbuf)) >> 5) & 0x3)
 
 #define GetAMsdu(pbuf) (((le16_to_cpu(*(__le16 *)pbuf)) >> 7) & 0x1)
 
 #define SetAMsdu(pbuf, amsdu)	\
-	*(__le16 *)(pbuf) |= cpu_to_le16((amsdu & 1) << 7)
+	(*(__le16 *)(pbuf) |= cpu_to_le16((amsdu & 1) << 7))
 
 #define GetAid(pbuf)	(le16_to_cpu(*(__le16 *)((size_t)(pbuf) + 2)) & 0x3fff)
 
-- 
2.20.1


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

* Re: [PATCH 01/15] staging: rtl8723bs: inlcude macros in a do..while loop in core/rtw_security.c
  2021-03-26  9:09 ` [PATCH 01/15] staging: rtl8723bs: inlcude macros in a do..while loop in core/rtw_security.c Fabio Aiuto
@ 2021-03-26  9:52   ` Dan Carpenter
  2021-03-26 11:04     ` Fabio Aiuto
  0 siblings, 1 reply; 27+ messages in thread
From: Dan Carpenter @ 2021-03-26  9:52 UTC (permalink / raw)
  To: Fabio Aiuto; +Cc: gregkh, linux-staging, linux-kernel

On Fri, Mar 26, 2021 at 10:09:08AM +0100, Fabio Aiuto wrote:
> fix the following checkpatch warning:
> 
> ERROR: Macros starting with if should be enclosed by a do - while
> loop to avoid possible if/else logic defects
> 33: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:33:
> +#define WEP_SW_ENC_CNT_INC(sec, ra) \
> --
> ERROR: Macros starting with if should be enclosed by a do - while
> loop to avoid possible if/else logic defects
> 41: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:41:
> +#define WEP_SW_DEC_CNT_INC(sec, ra) \
> --
> ERROR: Macros starting with if should be enclosed by a do - while
> loop to avoid possible if/else logic defects
> 49: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:49:
> +#define TKIP_SW_ENC_CNT_INC(sec, ra) \
> --
> ERROR: Macros starting with if should be enclosed by a do - while
> loop to avoid possible if/else logic defects
> 57: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:57:
> +#define TKIP_SW_DEC_CNT_INC(sec, ra) \
> --
> ERROR: Macros starting with if should be enclosed by a do - while
> loop to avoid possible if/else logic defects
> 65: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:65:
> +#define AES_SW_ENC_CNT_INC(sec, ra) \
> --
> ERROR: Macros starting with if should be enclosed by a do - while
> loop to avoid possible if/else logic defects
> 73: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:73:
> +#define AES_SW_DEC_CNT_INC(sec, ra) \
> --
> ERROR: Macros with multiple statements should be enclosed in a
> do - while loop
> 2082: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:2082:
> +#define ROUND(i, d, s) \
> 
> Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
> ---
>  drivers/staging/rtl8723bs/core/rtw_security.c | 94 +++++++++++--------
>  1 file changed, 54 insertions(+), 40 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c
> index 44e2b362c867..c92984fcf42d 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_security.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_security.c
> @@ -31,52 +31,64 @@ const char *security_type_str(u8 value)
>  
>  #ifdef DBG_SW_SEC_CNT
>  #define WEP_SW_ENC_CNT_INC(sec, ra) \
> -	if (is_broadcast_mac_addr(ra)) \
> -		sec->wep_sw_enc_cnt_bc++; \
> -	else if (is_multicast_mac_addr(ra)) \
> -		sec->wep_sw_enc_cnt_mc++; \
> -	else \
> -		sec->wep_sw_enc_cnt_uc++;
> +	do { \
> +		if (is_broadcast_mac_addr(ra)) \
> +			sec->wep_sw_enc_cnt_bc++; \
> +		else if (is_multicast_mac_addr(ra)) \
> +			sec->wep_sw_enc_cnt_mc++; \
> +		else \
> +			sec->wep_sw_enc_cnt_uc++; \
> +	} while (0)

What are these statistics used for?  So far as I can see there not
used at all.  It's probably better to just delete all the
DBG_SW_SEC_CNT code.

regards,
dan carpenter


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

* Re: [PATCH 02/15] staging: rtl8723bs: put parentheses on macros with complex values in hal/HalBtcOutSrc.h
  2021-03-26  9:09 ` [PATCH 02/15] staging: rtl8723bs: put parentheses on macros with complex values in hal/HalBtcOutSrc.h Fabio Aiuto
@ 2021-03-26  9:54   ` Dan Carpenter
  2021-03-26 11:09     ` Fabio Aiuto
  0 siblings, 1 reply; 27+ messages in thread
From: Dan Carpenter @ 2021-03-26  9:54 UTC (permalink / raw)
  To: Fabio Aiuto; +Cc: gregkh, linux-staging, linux-kernel

On Fri, Mar 26, 2021 at 10:09:09AM +0100, Fabio Aiuto wrote:
> fix the following checkpatch warning:
> 
> ERROR: Macros with complex values should be enclosed in parentheses
> 152: FILE: drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h:152:
> +#define BTC_PRINT(dbgtype, dbgflag, printstr) \
> no_printk printstr
> --
> ERROR: Macros with complex values should be enclosed in parentheses
> 153: FILE: drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h:153:
> +#define BTC_PRINT_F(dbgtype, dbgflag, printstr) \
> no_printk printstr
> --
> ERROR: Macros with complex values should be enclosed in parentheses
> 154: FILE: drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h:154:
> +#define BTC_PRINT_ADDR(dbgtype, dbgflag, printstr, _Ptr) \
> no_printk printstr
> 
> Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
> ---
>  drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h b/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h
> index 10c021024b24..1926a1f7a7e5 100644
> --- a/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h
> +++ b/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h
> @@ -149,9 +149,9 @@ extern u32 		GLBtcDbgType[];
>  }
>  
>  #else
> -#define BTC_PRINT(dbgtype, dbgflag, printstr)		 no_printk printstr
> -#define BTC_PRINT_F(dbgtype, dbgflag, printstr)		 no_printk printstr
> -#define BTC_PRINT_ADDR(dbgtype, dbgflag, printstr, _Ptr) no_printk printstr
> +#define BTC_PRINT(dbgtype, dbgflag, printstr)		 (no_printk printstr)
> +#define BTC_PRINT_F(dbgtype, dbgflag, printstr)		 (no_printk printstr)
> +#define BTC_PRINT_ADDR(dbgtype, dbgflag, printstr, _Ptr) (no_printk printstr)

This makes no sense at all.  no_printk is a function.  The BTC_PRINT()
macros are super ugly and this only makes it worse.

regards,
dan carpenter


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

* Re: [PATCH 04/15] staging: rtl8723bs: put parentheses on macros with complex values in include/basic_types.h
  2021-03-26  9:09 ` [PATCH 04/15] staging: rtl8723bs: put parentheses on macros with complex values in include/basic_types.h Fabio Aiuto
@ 2021-03-26 10:04   ` Dan Carpenter
  2021-03-26 11:12     ` Fabio Aiuto
  0 siblings, 1 reply; 27+ messages in thread
From: Dan Carpenter @ 2021-03-26 10:04 UTC (permalink / raw)
  To: Fabio Aiuto; +Cc: gregkh, linux-staging, linux-kernel

On Fri, Mar 26, 2021 at 10:09:11AM +0100, Fabio Aiuto wrote:
> fix the following checkpatch warnings:
> 
> ERROR: Macros with complex values should be enclosed in parentheses
> 154: FILE: drivers/staging/rtl8723bs/include/basic_types.h:154:
> +#define SET_BITS_TO_LE_4BYTE(__pstart, __bitoffset, __bitlen, __val) \
> --
> ERROR: Macros with multiple statements should be enclosed in
> a do - while loop
> 161: FILE: drivers/staging/rtl8723bs/include/basic_types.h:161:
> +#define SET_BITS_TO_LE_2BYTE(__pstart, __bitoffset, __bitlen, __val) \
> --
> ERROR: Macros with complex values should be enclosed in parentheses
> 168: FILE: drivers/staging/rtl8723bs/include/basic_types.h:168:
> +#define SET_BITS_TO_LE_1BYTE(__pstart, __bitoffset, __bitlen, __val) \
> 
> parentheses solution preferred for all fixes and made macros more
> readables
> 
> Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
> ---
>  .../staging/rtl8723bs/include/basic_types.h   | 30 +++++++++++--------
>  1 file changed, 18 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/include/basic_types.h b/drivers/staging/rtl8723bs/include/basic_types.h
> index 76304086107a..5054c2e3384c 100644
> --- a/drivers/staging/rtl8723bs/include/basic_types.h
> +++ b/drivers/staging/rtl8723bs/include/basic_types.h
> @@ -152,24 +152,30 @@
>  /* 		Set subfield of little-endian 4-byte value to specified value. */
>  /*  */
>  #define SET_BITS_TO_LE_4BYTE(__pstart, __bitoffset, __bitlen, __val) \
> -		*((u32 *)(__pstart)) =				\
> -		(						\
> -		LE_BITS_CLEARED_TO_4BYTE(__pstart, __bitoffset, __bitlen) | \
> -		((((u32)__val) & BIT_LEN_MASK_32(__bitlen)) << (__bitoffset)) \
> +		(\
> +			*((u32 *)(__pstart)) =				\
> +			(						\
> +				LE_BITS_CLEARED_TO_4BYTE(__pstart, __bitoffset, __bitlen) | \
> +				((((u32)__val) & BIT_LEN_MASK_32(__bitlen)) << (__bitoffset)) \
> +			)\
>  		)
>  

These macros are terrible and this makes it uglier.  Better to just
ignore checkpatch until we can figure out a way to re-write this
properly.

regards,
dan carpenter


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

* Re: [PATCH 01/15] staging: rtl8723bs: inlcude macros in a do..while loop in core/rtw_security.c
  2021-03-26  9:52   ` Dan Carpenter
@ 2021-03-26 11:04     ` Fabio Aiuto
  0 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-26 11:04 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: gregkh, linux-staging

On Fri, Mar 26, 2021 at 12:52:20PM +0300, Dan Carpenter wrote:
> On Fri, Mar 26, 2021 at 10:09:08AM +0100, Fabio Aiuto wrote:
> > fix the following checkpatch warning:
> > 
> > ERROR: Macros starting with if should be enclosed by a do - while
> > loop to avoid possible if/else logic defects
> > 33: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:33:
> > +#define WEP_SW_ENC_CNT_INC(sec, ra) \
> > --
> > ERROR: Macros starting with if should be enclosed by a do - while
> > loop to avoid possible if/else logic defects
> > 41: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:41:
> > +#define WEP_SW_DEC_CNT_INC(sec, ra) \
> > --
> > ERROR: Macros starting with if should be enclosed by a do - while
> > loop to avoid possible if/else logic defects
> > 49: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:49:
> > +#define TKIP_SW_ENC_CNT_INC(sec, ra) \
> > --
> > ERROR: Macros starting with if should be enclosed by a do - while
> > loop to avoid possible if/else logic defects
> > 57: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:57:
> > +#define TKIP_SW_DEC_CNT_INC(sec, ra) \
> > --
> > ERROR: Macros starting with if should be enclosed by a do - while
> > loop to avoid possible if/else logic defects
> > 65: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:65:
> > +#define AES_SW_ENC_CNT_INC(sec, ra) \
> > --
> > ERROR: Macros starting with if should be enclosed by a do - while
> > loop to avoid possible if/else logic defects
> > 73: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:73:
> > +#define AES_SW_DEC_CNT_INC(sec, ra) \
> > --
> > ERROR: Macros with multiple statements should be enclosed in a
> > do - while loop
> > 2082: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:2082:
> > +#define ROUND(i, d, s) \
> > 
> > Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
> > ---
> >  drivers/staging/rtl8723bs/core/rtw_security.c | 94 +++++++++++--------
> >  1 file changed, 54 insertions(+), 40 deletions(-)
> > 
> > diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c
> > index 44e2b362c867..c92984fcf42d 100644
> > --- a/drivers/staging/rtl8723bs/core/rtw_security.c
> > +++ b/drivers/staging/rtl8723bs/core/rtw_security.c
> > @@ -31,52 +31,64 @@ const char *security_type_str(u8 value)
> >  
> >  #ifdef DBG_SW_SEC_CNT
> >  #define WEP_SW_ENC_CNT_INC(sec, ra) \
> > -	if (is_broadcast_mac_addr(ra)) \
> > -		sec->wep_sw_enc_cnt_bc++; \
> > -	else if (is_multicast_mac_addr(ra)) \
> > -		sec->wep_sw_enc_cnt_mc++; \
> > -	else \
> > -		sec->wep_sw_enc_cnt_uc++;
> > +	do { \
> > +		if (is_broadcast_mac_addr(ra)) \
> > +			sec->wep_sw_enc_cnt_bc++; \
> > +		else if (is_multicast_mac_addr(ra)) \
> > +			sec->wep_sw_enc_cnt_mc++; \
> > +		else \
> > +			sec->wep_sw_enc_cnt_uc++; \
> > +	} while (0)
> 
> What are these statistics used for?  So far as I can see there not
> used at all.  It's probably better to just delete all the
> DBG_SW_SEC_CNT code.
> 
> regards,
> dan carpenter
> 

you are right Dan, I will remove all related fields in
security_priv

thank you,

fabio

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

* Re: [PATCH 02/15] staging: rtl8723bs: put parentheses on macros with complex values in hal/HalBtcOutSrc.h
  2021-03-26  9:54   ` Dan Carpenter
@ 2021-03-26 11:09     ` Fabio Aiuto
  0 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-26 11:09 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: gregkh, linux-staging, linux-kernel

On Fri, Mar 26, 2021 at 12:54:49PM +0300, Dan Carpenter wrote:
> On Fri, Mar 26, 2021 at 10:09:09AM +0100, Fabio Aiuto wrote:
> > fix the following checkpatch warning:
> > 
> > ERROR: Macros with complex values should be enclosed in parentheses
> > 152: FILE: drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h:152:
> > +#define BTC_PRINT(dbgtype, dbgflag, printstr) \
> > no_printk printstr
> > --
> > ERROR: Macros with complex values should be enclosed in parentheses
> > 153: FILE: drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h:153:
> > +#define BTC_PRINT_F(dbgtype, dbgflag, printstr) \
> > no_printk printstr
> > --
> > ERROR: Macros with complex values should be enclosed in parentheses
> > 154: FILE: drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h:154:
> > +#define BTC_PRINT_ADDR(dbgtype, dbgflag, printstr, _Ptr) \
> > no_printk printstr
> > 
> > Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
> > ---
> >  drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h b/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h
> > index 10c021024b24..1926a1f7a7e5 100644
> > --- a/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h
> > +++ b/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h
> > @@ -149,9 +149,9 @@ extern u32 		GLBtcDbgType[];
> >  }
> >  
> >  #else
> > -#define BTC_PRINT(dbgtype, dbgflag, printstr)		 no_printk printstr
> > -#define BTC_PRINT_F(dbgtype, dbgflag, printstr)		 no_printk printstr
> > -#define BTC_PRINT_ADDR(dbgtype, dbgflag, printstr, _Ptr) no_printk printstr
> > +#define BTC_PRINT(dbgtype, dbgflag, printstr)		 (no_printk printstr)
> > +#define BTC_PRINT_F(dbgtype, dbgflag, printstr)		 (no_printk printstr)
> > +#define BTC_PRINT_ADDR(dbgtype, dbgflag, printstr, _Ptr) (no_printk printstr)
> 
> This makes no sense at all.  no_printk is a function.  The BTC_PRINT()
> macros are super ugly and this only makes it worse.
> 
> regards,
> dan carpenter
> 

so I'll just drop the patch in the next v2

thanks,

fabio

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

* Re: [PATCH 04/15] staging: rtl8723bs: put parentheses on macros with complex values in include/basic_types.h
  2021-03-26 10:04   ` Dan Carpenter
@ 2021-03-26 11:12     ` Fabio Aiuto
  2021-03-26 14:06       ` Greg KH
  0 siblings, 1 reply; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-26 11:12 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: gregkh, linux-staging, linux-kernel

On Fri, Mar 26, 2021 at 01:04:08PM +0300, Dan Carpenter wrote:
> On Fri, Mar 26, 2021 at 10:09:11AM +0100, Fabio Aiuto wrote:
> > fix the following checkpatch warnings:
> > 
> > ERROR: Macros with complex values should be enclosed in parentheses
> > 154: FILE: drivers/staging/rtl8723bs/include/basic_types.h:154:
> > +#define SET_BITS_TO_LE_4BYTE(__pstart, __bitoffset, __bitlen, __val) \
> > --
> > ERROR: Macros with multiple statements should be enclosed in
> > a do - while loop
> > 161: FILE: drivers/staging/rtl8723bs/include/basic_types.h:161:
> > +#define SET_BITS_TO_LE_2BYTE(__pstart, __bitoffset, __bitlen, __val) \
> > --
> > ERROR: Macros with complex values should be enclosed in parentheses
> > 168: FILE: drivers/staging/rtl8723bs/include/basic_types.h:168:
> > +#define SET_BITS_TO_LE_1BYTE(__pstart, __bitoffset, __bitlen, __val) \
> > 
> > parentheses solution preferred for all fixes and made macros more
> > readables
> > 
> > Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
> > ---
> >  .../staging/rtl8723bs/include/basic_types.h   | 30 +++++++++++--------
> >  1 file changed, 18 insertions(+), 12 deletions(-)
> > 
> > diff --git a/drivers/staging/rtl8723bs/include/basic_types.h b/drivers/staging/rtl8723bs/include/basic_types.h
> > index 76304086107a..5054c2e3384c 100644
> > --- a/drivers/staging/rtl8723bs/include/basic_types.h
> > +++ b/drivers/staging/rtl8723bs/include/basic_types.h
> > @@ -152,24 +152,30 @@
> >  /* 		Set subfield of little-endian 4-byte value to specified value. */
> >  /*  */
> >  #define SET_BITS_TO_LE_4BYTE(__pstart, __bitoffset, __bitlen, __val) \
> > -		*((u32 *)(__pstart)) =				\
> > -		(						\
> > -		LE_BITS_CLEARED_TO_4BYTE(__pstart, __bitoffset, __bitlen) | \
> > -		((((u32)__val) & BIT_LEN_MASK_32(__bitlen)) << (__bitoffset)) \
> > +		(\
> > +			*((u32 *)(__pstart)) =				\
> > +			(						\
> > +				LE_BITS_CLEARED_TO_4BYTE(__pstart, __bitoffset, __bitlen) | \
> > +				((((u32)__val) & BIT_LEN_MASK_32(__bitlen)) << (__bitoffset)) \
> > +			)\
> >  		)
> >  
> 
> These macros are terrible and this makes it uglier.  Better to just
> ignore checkpatch until we can figure out a way to re-write this
> properly.
> 
> regards,
> dan carpenter
> 

I see, will drop the patch for now.

thanks,

fabio

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

* RE: [PATCH 14/15] staging: rtl8723bs:  put parentheses on macros with complex values in include/sta_info.h
  2021-03-26  9:09 ` [PATCH 14/15] staging: rtl8723bs: put parentheses on macros with complex values in include/sta_info.h Fabio Aiuto
@ 2021-03-26 13:39   ` David Laight
  2021-03-26 13:57     ` Fabio Aiuto
  0 siblings, 1 reply; 27+ messages in thread
From: David Laight @ 2021-03-26 13:39 UTC (permalink / raw)
  To: 'Fabio Aiuto', gregkh; +Cc: linux-staging, linux-kernel

From: Fabio Aiuto 
> Sent: 26 March 2021 09:09
> 
> fix the following checkpatch warnings:
> 
> ERROR: Macros with complex values should be enclosed in parentheses
> 284: FILE: drivers/staging/rtl8723bs/include/sta_info.h:284:
> +#define STA_RX_PKTS_ARG(sta) \
> --
> ERROR: Macros with complex values should be enclosed in parentheses
> 289: FILE: drivers/staging/rtl8723bs/include/sta_info.h:289:
> +#define STA_LAST_RX_PKTS_ARG(sta) \
> --
> ERROR: Macros with complex values should be enclosed in parentheses
> 294: FILE: drivers/staging/rtl8723bs/include/sta_info.h:294:
> +#define STA_RX_PKTS_DIFF_ARG(sta) \
> 
> Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
> ---
>  drivers/staging/rtl8723bs/include/sta_info.h | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/include/sta_info.h
> b/drivers/staging/rtl8723bs/include/sta_info.h
> index abde3e3df988..1cdf93ec3b66 100644
> --- a/drivers/staging/rtl8723bs/include/sta_info.h
> +++ b/drivers/staging/rtl8723bs/include/sta_info.h
> @@ -282,19 +282,19 @@ struct sta_info {
>  	} while (0)
> 
>  #define STA_RX_PKTS_ARG(sta) \
> -	sta->sta_stats.rx_mgnt_pkts \
> +	(sta->sta_stats.rx_mgnt_pkts \
>  	, sta->sta_stats.rx_ctrl_pkts \
> -	, sta->sta_stats.rx_data_pkts
> +	, sta->sta_stats.rx_data_pkts)

That doesn't look right at all.
You've changed what is (probably) a list of arguments to a function
into a comma operator list.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


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

* Re: [PATCH 14/15] staging: rtl8723bs:  put parentheses on macros with complex values in include/sta_info.h
  2021-03-26 13:39   ` David Laight
@ 2021-03-26 13:57     ` Fabio Aiuto
  0 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-26 13:57 UTC (permalink / raw)
  To: David Laight; +Cc: gregkh, dan.carpenter, linux-staging, linux-kernel

On Fri, Mar 26, 2021 at 01:39:24PM +0000, David Laight wrote:
> From: Fabio Aiuto 
> > Sent: 26 March 2021 09:09
> > 
> > fix the following checkpatch warnings:
> > 
> > ERROR: Macros with complex values should be enclosed in parentheses
> > 284: FILE: drivers/staging/rtl8723bs/include/sta_info.h:284:
> > +#define STA_RX_PKTS_ARG(sta) \
> > --
> > ERROR: Macros with complex values should be enclosed in parentheses
> > 289: FILE: drivers/staging/rtl8723bs/include/sta_info.h:289:
> > +#define STA_LAST_RX_PKTS_ARG(sta) \
> > --
> > ERROR: Macros with complex values should be enclosed in parentheses
> > 294: FILE: drivers/staging/rtl8723bs/include/sta_info.h:294:
> > +#define STA_RX_PKTS_DIFF_ARG(sta) \
> > 
> > Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
> > ---
> >  drivers/staging/rtl8723bs/include/sta_info.h | 12 ++++++------
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/staging/rtl8723bs/include/sta_info.h
> > b/drivers/staging/rtl8723bs/include/sta_info.h
> > index abde3e3df988..1cdf93ec3b66 100644
> > --- a/drivers/staging/rtl8723bs/include/sta_info.h
> > +++ b/drivers/staging/rtl8723bs/include/sta_info.h
> > @@ -282,19 +282,19 @@ struct sta_info {
> >  	} while (0)
> > 
> >  #define STA_RX_PKTS_ARG(sta) \
> > -	sta->sta_stats.rx_mgnt_pkts \
> > +	(sta->sta_stats.rx_mgnt_pkts \
> >  	, sta->sta_stats.rx_ctrl_pkts \
> > -	, sta->sta_stats.rx_data_pkts
> > +	, sta->sta_stats.rx_data_pkts)
> 
> That doesn't look right at all.
> You've changed what is (probably) a list of arguments to a function
> into a comma operator list.
> 
> 	David
> 
> -
> Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
> Registration No: 1397386 (Wales)
> 

ops, you're right David, thank you and sorry to all
for noise.

fabio

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

* Re: [PATCH 04/15] staging: rtl8723bs: put parentheses on macros with complex values in include/basic_types.h
  2021-03-26 11:12     ` Fabio Aiuto
@ 2021-03-26 14:06       ` Greg KH
  0 siblings, 0 replies; 27+ messages in thread
From: Greg KH @ 2021-03-26 14:06 UTC (permalink / raw)
  To: Fabio Aiuto; +Cc: Dan Carpenter, linux-staging, linux-kernel

On Fri, Mar 26, 2021 at 12:12:42PM +0100, Fabio Aiuto wrote:
> On Fri, Mar 26, 2021 at 01:04:08PM +0300, Dan Carpenter wrote:
> > On Fri, Mar 26, 2021 at 10:09:11AM +0100, Fabio Aiuto wrote:
> > > fix the following checkpatch warnings:
> > > 
> > > ERROR: Macros with complex values should be enclosed in parentheses
> > > 154: FILE: drivers/staging/rtl8723bs/include/basic_types.h:154:
> > > +#define SET_BITS_TO_LE_4BYTE(__pstart, __bitoffset, __bitlen, __val) \
> > > --
> > > ERROR: Macros with multiple statements should be enclosed in
> > > a do - while loop
> > > 161: FILE: drivers/staging/rtl8723bs/include/basic_types.h:161:
> > > +#define SET_BITS_TO_LE_2BYTE(__pstart, __bitoffset, __bitlen, __val) \
> > > --
> > > ERROR: Macros with complex values should be enclosed in parentheses
> > > 168: FILE: drivers/staging/rtl8723bs/include/basic_types.h:168:
> > > +#define SET_BITS_TO_LE_1BYTE(__pstart, __bitoffset, __bitlen, __val) \
> > > 
> > > parentheses solution preferred for all fixes and made macros more
> > > readables
> > > 
> > > Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
> > > ---
> > >  .../staging/rtl8723bs/include/basic_types.h   | 30 +++++++++++--------
> > >  1 file changed, 18 insertions(+), 12 deletions(-)
> > > 
> > > diff --git a/drivers/staging/rtl8723bs/include/basic_types.h b/drivers/staging/rtl8723bs/include/basic_types.h
> > > index 76304086107a..5054c2e3384c 100644
> > > --- a/drivers/staging/rtl8723bs/include/basic_types.h
> > > +++ b/drivers/staging/rtl8723bs/include/basic_types.h
> > > @@ -152,24 +152,30 @@
> > >  /* 		Set subfield of little-endian 4-byte value to specified value. */
> > >  /*  */
> > >  #define SET_BITS_TO_LE_4BYTE(__pstart, __bitoffset, __bitlen, __val) \
> > > -		*((u32 *)(__pstart)) =				\
> > > -		(						\
> > > -		LE_BITS_CLEARED_TO_4BYTE(__pstart, __bitoffset, __bitlen) | \
> > > -		((((u32)__val) & BIT_LEN_MASK_32(__bitlen)) << (__bitoffset)) \
> > > +		(\
> > > +			*((u32 *)(__pstart)) =				\
> > > +			(						\
> > > +				LE_BITS_CLEARED_TO_4BYTE(__pstart, __bitoffset, __bitlen) | \
> > > +				((((u32)__val) & BIT_LEN_MASK_32(__bitlen)) << (__bitoffset)) \
> > > +			)\
> > >  		)
> > >  
> > 
> > These macros are terrible and this makes it uglier.  Better to just
> > ignore checkpatch until we can figure out a way to re-write this
> > properly.
> > 
> > regards,
> > dan carpenter
> > 
> 
> I see, will drop the patch for now.

Please resend a v2 set of this series so I know what to apply here...

thanks,

greg k-h

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

* Re: [PATCH 05/15] staging: rtl8723bs: put parentheses on macros with complex values in include/drv_types.h
  2021-03-26  9:09 ` [PATCH 05/15] staging: rtl8723bs: put parentheses on macros with complex values in include/drv_types.h Fabio Aiuto
@ 2021-03-26 14:22   ` Dan Carpenter
  2021-03-26 15:12     ` Fabio Aiuto
  0 siblings, 1 reply; 27+ messages in thread
From: Dan Carpenter @ 2021-03-26 14:22 UTC (permalink / raw)
  To: Fabio Aiuto; +Cc: gregkh, linux-staging, linux-kernel

On Fri, Mar 26, 2021 at 10:09:12AM +0100, Fabio Aiuto wrote:
> fix the following checkpatch warning:
> 
> ERROR: Macros with complex values should be enclosed in parentheses
> 279: FILE: drivers/staging/rtl8723bs/include/drv_types.h:279:
> +#define KEY_ARG(x) ((u8 *)(x))[0], ((u8 *)(x))[1],
> ((u8 *)(x))[2], ((u8 *)(x))[3], ((u8 *)(x))[4], ((u8 *)(x))[5], \
> 
> Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
> ---
>  drivers/staging/rtl8723bs/include/drv_types.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h
> index 1658450b386e..ead4cb9c1e5a 100644
> --- a/drivers/staging/rtl8723bs/include/drv_types.h
> +++ b/drivers/staging/rtl8723bs/include/drv_types.h
> @@ -276,9 +276,9 @@ struct cam_entry_cache {
>  };
>  
>  #define KEY_FMT "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
> -#define KEY_ARG(x) ((u8 *)(x))[0], ((u8 *)(x))[1], ((u8 *)(x))[2], ((u8 *)(x))[3], ((u8 *)(x))[4], ((u8 *)(x))[5], \
> +#define KEY_ARG(x) (((u8 *)(x))[0], ((u8 *)(x))[1], ((u8 *)(x))[2], ((u8 *)(x))[3], ((u8 *)(x))[4], ((u8 *)(x))[5], \
>  	((u8 *)(x))[6], ((u8 *)(x))[7], ((u8 *)(x))[8], ((u8 *)(x))[9], ((u8 *)(x))[10], ((u8 *)(x))[11], \
> -	((u8 *)(x))[12], ((u8 *)(x))[13], ((u8 *)(x))[14], ((u8 *)(x))[15]
> +	((u8 *)(x))[12], ((u8 *)(x))[13], ((u8 *)(x))[14], ((u8 *)(x))[15])

KEY_ARG() isn't used anywhere that I can see.  Just delete it.

Please take your time when you re-write this series and think about each
change clearly and fix the underlying badness instead of just making
checkpatch happy.  I would really just throw out the patchset and start
over from scratch.

regards,
dan carpenter


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

* Re: [PATCH 05/15] staging: rtl8723bs: put parentheses on macros with complex values in include/drv_types.h
  2021-03-26 14:22   ` Dan Carpenter
@ 2021-03-26 15:12     ` Fabio Aiuto
  0 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-26 15:12 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: gregkh, david.laight, linux-staging, linux-kernel

On Fri, Mar 26, 2021 at 05:22:57PM +0300, Dan Carpenter wrote:
> On Fri, Mar 26, 2021 at 10:09:12AM +0100, Fabio Aiuto wrote:
> > fix the following checkpatch warning:
> > 
> > ERROR: Macros with complex values should be enclosed in parentheses
> > 279: FILE: drivers/staging/rtl8723bs/include/drv_types.h:279:
> > +#define KEY_ARG(x) ((u8 *)(x))[0], ((u8 *)(x))[1],
> > ((u8 *)(x))[2], ((u8 *)(x))[3], ((u8 *)(x))[4], ((u8 *)(x))[5], \
> > 
> > Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
> > ---
> >  drivers/staging/rtl8723bs/include/drv_types.h | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h
> > index 1658450b386e..ead4cb9c1e5a 100644
> > --- a/drivers/staging/rtl8723bs/include/drv_types.h
> > +++ b/drivers/staging/rtl8723bs/include/drv_types.h
> > @@ -276,9 +276,9 @@ struct cam_entry_cache {
> >  };
> >  
> >  #define KEY_FMT "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
> > -#define KEY_ARG(x) ((u8 *)(x))[0], ((u8 *)(x))[1], ((u8 *)(x))[2], ((u8 *)(x))[3], ((u8 *)(x))[4], ((u8 *)(x))[5], \
> > +#define KEY_ARG(x) (((u8 *)(x))[0], ((u8 *)(x))[1], ((u8 *)(x))[2], ((u8 *)(x))[3], ((u8 *)(x))[4], ((u8 *)(x))[5], \
> >  	((u8 *)(x))[6], ((u8 *)(x))[7], ((u8 *)(x))[8], ((u8 *)(x))[9], ((u8 *)(x))[10], ((u8 *)(x))[11], \
> > -	((u8 *)(x))[12], ((u8 *)(x))[13], ((u8 *)(x))[14], ((u8 *)(x))[15]
> > +	((u8 *)(x))[12], ((u8 *)(x))[13], ((u8 *)(x))[14], ((u8 *)(x))[15])
> 
> KEY_ARG() isn't used anywhere that I can see.  Just delete it.
> 
> Please take your time when you re-write this series and think about each
> change clearly and fix the underlying badness instead of just making
> checkpatch happy.  I would really just throw out the patchset and start
> over from scratch.
> 
> regards,
> dan carpenter
> 

Hi Dan,

KEY_FMT is unused as well. I'm rewriting the whole series, will send
v2.

thank you,

fabio

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

end of thread, other threads:[~2021-03-26 15:12 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-26  9:09 [PATCH 00/15] staging: rtl8723bs: fix checkpatch errors on macros Fabio Aiuto
2021-03-26  9:09 ` [PATCH 01/15] staging: rtl8723bs: inlcude macros in a do..while loop in core/rtw_security.c Fabio Aiuto
2021-03-26  9:52   ` Dan Carpenter
2021-03-26 11:04     ` Fabio Aiuto
2021-03-26  9:09 ` [PATCH 02/15] staging: rtl8723bs: put parentheses on macros with complex values in hal/HalBtcOutSrc.h Fabio Aiuto
2021-03-26  9:54   ` Dan Carpenter
2021-03-26 11:09     ` Fabio Aiuto
2021-03-26  9:09 ` [PATCH 03/15] staging: rtl8723bs: put parentheses on macros with complex values in hal/odm_debug.h Fabio Aiuto
2021-03-26  9:09 ` [PATCH 04/15] staging: rtl8723bs: put parentheses on macros with complex values in include/basic_types.h Fabio Aiuto
2021-03-26 10:04   ` Dan Carpenter
2021-03-26 11:12     ` Fabio Aiuto
2021-03-26 14:06       ` Greg KH
2021-03-26  9:09 ` [PATCH 05/15] staging: rtl8723bs: put parentheses on macros with complex values in include/drv_types.h Fabio Aiuto
2021-03-26 14:22   ` Dan Carpenter
2021-03-26 15:12     ` Fabio Aiuto
2021-03-26  9:09 ` [PATCH 06/15] staging: rtl8723bs: put parentheses on macros with complex values in include/hal_com.h Fabio Aiuto
2021-03-26  9:09 ` [PATCH 07/15] staging: rtl8723bs: put parentheses on macros with complex values in include/hal_com_reg.h Fabio Aiuto
2021-03-26  9:09 ` [PATCH 08/15] staging: rtl8723bs: put parentheses on macros with complex values in include/hal_data.h Fabio Aiuto
2021-03-26  9:09 ` [PATCH 09/15] staging: rtl8723bs: put parentheses on macros with complex values in include/hal_phy.h Fabio Aiuto
2021-03-26  9:09 ` [PATCH 10/15] staging: rtl8723bs: put parentheses on macros with complex values in include/ieee80211.h Fabio Aiuto
2021-03-26  9:09 ` [PATCH 11/15] staging: rtl8723bs: put parentheses on macros with complex values in include/rtw_debug.h Fabio Aiuto
2021-03-26  9:09 ` [PATCH 12/15] staging: rtl8723bs: put parentheses on macros with complex values in include/rtw_pwrctrl.h Fabio Aiuto
2021-03-26  9:09 ` [PATCH 13/15] staging: rtl8723bs: add spaces around operator " Fabio Aiuto
2021-03-26  9:09 ` [PATCH 14/15] staging: rtl8723bs: put parentheses on macros with complex values in include/sta_info.h Fabio Aiuto
2021-03-26 13:39   ` David Laight
2021-03-26 13:57     ` Fabio Aiuto
2021-03-26  9:09 ` [PATCH 15/15] staging: rtl8723bs: put parentheses on macros with complex values in include/wifi.h Fabio Aiuto

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.