linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/20] fix checkpatch error on macros
@ 2021-03-27 14:23 Fabio Aiuto
  2021-03-27 14:24 ` [PATCH v2 01/20] staging: rtl8723bs: remove unused macros in include/hal_com.h Fabio Aiuto
                   ` (19 more replies)
  0 siblings, 20 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-27 14:23 UTC (permalink / raw)
  To: gregkh
  Cc: dan.carpenter, david.laight, linux-staging, linux-kernel, Fabio Aiuto

this patchset fixes, where possible, some checkpatch errors on macros.
Delete unused macros and some unused struct fields tied
to removed macros.

Changes in v2:
	- deleted unused macros
	- ignored following checkpatch issues on macro:
		* issues requiring to add parentheses to macro
		  expanding in args of a function
		* issues requiring to add parentheses to
		  very complex and unreadable macro

Fabio Aiuto (20):
  staging: rtl8723bs: remove unused macros in include/hal_com.h
  staging: rtl8723bs: put parentheses on macro with complex values in
    include/hal_com.h
  staging: rtl8723bs: added spaces around operators in a macro in
    include/hal_com.h
  staging: rtl8723bs: remove unused macros in include/hal_com_reg.h
  staging: rtl8723bs: remove unused macros in include/hal_data.h
  staging: rtl8723bs: put parentheses on macros with complex values in
    include/hal_data.h
  staging: rtl8723bs: add spaces around operators in include/hal_data.h
  staging: rtl8723bs: remove unused macros in include/hal_phy.h
  staging: rtl8723bs: put parentheses on macros with complex values in
    include/rtw_debug.h
  staging: rtl8723bs: remove unused macro in include/rtw_pwrctrl.h
  staging: rtl8723bs: remove unused field in rereg_nd_name_data struct
  staging: rtl8723bs: remove commented code line in os_dep/ioctl_linux.c
  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: remove unused macros in include/wifi.h
  staging: rtl8723bs: put parentheses on macros with complex values in
    include/wifi.h
  staging: rtl8723bs: remove macros updating unused fields in struct
    security_priv
  staging: rtl8723bs: remove unused fields in struct security_priv
  staging: rtl8723bs: include macro in a do - while loop in
    core/rtw_security.c
  staging: rtl8723bs: remove unused macros in include/drv_types.c

 drivers/staging/rtl8723bs/core/rtw_security.c | 78 ++-----------------
 drivers/staging/rtl8723bs/include/drv_types.h |  6 --
 drivers/staging/rtl8723bs/include/hal_com.h   |  6 +-
 .../staging/rtl8723bs/include/hal_com_reg.h   |  8 --
 drivers/staging/rtl8723bs/include/hal_data.h  |  9 +--
 drivers/staging/rtl8723bs/include/hal_phy.h   | 11 ---
 drivers/staging/rtl8723bs/include/rtw_debug.h | 28 +++----
 .../staging/rtl8723bs/include/rtw_pwrctrl.h   |  7 +-
 .../staging/rtl8723bs/include/rtw_security.h  | 23 ------
 drivers/staging/rtl8723bs/include/wifi.h      | 48 ++++--------
 .../staging/rtl8723bs/os_dep/ioctl_linux.c    |  1 -
 11 files changed, 39 insertions(+), 186 deletions(-)

-- 
2.20.1


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

* [PATCH v2 01/20] staging: rtl8723bs: remove unused macros in include/hal_com.h
  2021-03-27 14:23 [PATCH v2 00/20] fix checkpatch error on macros Fabio Aiuto
@ 2021-03-27 14:24 ` Fabio Aiuto
  2021-03-27 14:24 ` [PATCH v2 02/20] staging: rtl8723bs: put parentheses on macro with complex values " Fabio Aiuto
                   ` (18 subsequent siblings)
  19 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-27 14:24 UTC (permalink / raw)
  To: gregkh
  Cc: dan.carpenter, david.laight, linux-staging, linux-kernel, Fabio Aiuto

remove declarations of unused macros in include/hal_com.h

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

diff --git a/drivers/staging/rtl8723bs/include/hal_com.h b/drivers/staging/rtl8723bs/include/hal_com.h
index 3629b912698a..dc023dd17534 100644
--- a/drivers/staging/rtl8723bs/include/hal_com.h
+++ b/drivers/staging/rtl8723bs/include/hal_com.h
@@ -181,10 +181,6 @@ enum rt_media_status {
 #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))
-
 
 u8 rtw_hal_data_init(struct adapter *padapter);
 void rtw_hal_data_deinit(struct adapter *padapter);
-- 
2.20.1


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

* [PATCH v2 02/20] staging: rtl8723bs: put parentheses on macro with complex values in include/hal_com.h
  2021-03-27 14:23 [PATCH v2 00/20] fix checkpatch error on macros Fabio Aiuto
  2021-03-27 14:24 ` [PATCH v2 01/20] staging: rtl8723bs: remove unused macros in include/hal_com.h Fabio Aiuto
@ 2021-03-27 14:24 ` Fabio Aiuto
  2021-03-27 14:24 ` [PATCH v2 03/20] staging: rtl8723bs: added spaces around operators in a macro " Fabio Aiuto
                   ` (17 subsequent siblings)
  19 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-27 14:24 UTC (permalink / raw)
  To: gregkh
  Cc: dan.carpenter, david.laight, linux-staging, linux-kernel, Fabio Aiuto

fix the following checkpatch warning:

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))

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

diff --git a/drivers/staging/rtl8723bs/include/hal_com.h b/drivers/staging/rtl8723bs/include/hal_com.h
index dc023dd17534..55f9caee6610 100644
--- a/drivers/staging/rtl8723bs/include/hal_com.h
+++ b/drivers/staging/rtl8723bs/include/hal_com.h
@@ -180,7 +180,7 @@ enum rt_media_status {
 #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_128(_Len)		((u32)(((_Len)>>7) + ((_Len)&0x7F ? 1:0)))
 
 u8 rtw_hal_data_init(struct adapter *padapter);
 void rtw_hal_data_deinit(struct adapter *padapter);
-- 
2.20.1


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

* [PATCH v2 03/20] staging: rtl8723bs: added spaces around operators in a macro in include/hal_com.h
  2021-03-27 14:23 [PATCH v2 00/20] fix checkpatch error on macros Fabio Aiuto
  2021-03-27 14:24 ` [PATCH v2 01/20] staging: rtl8723bs: remove unused macros in include/hal_com.h Fabio Aiuto
  2021-03-27 14:24 ` [PATCH v2 02/20] staging: rtl8723bs: put parentheses on macro with complex values " Fabio Aiuto
@ 2021-03-27 14:24 ` Fabio Aiuto
  2021-03-27 14:24 ` [PATCH v2 04/20] staging: rtl8723bs: remove unused macros in include/hal_com_reg.h Fabio Aiuto
                   ` (16 subsequent siblings)
  19 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-27 14:24 UTC (permalink / raw)
  To: gregkh
  Cc: dan.carpenter, david.laight, linux-staging, linux-kernel, Fabio Aiuto

added spaces around operators in macro expression

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

diff --git a/drivers/staging/rtl8723bs/include/hal_com.h b/drivers/staging/rtl8723bs/include/hal_com.h
index 55f9caee6610..a1e1b76b5d8a 100644
--- a/drivers/staging/rtl8723bs/include/hal_com.h
+++ b/drivers/staging/rtl8723bs/include/hal_com.h
@@ -180,7 +180,7 @@ enum rt_media_status {
 #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_128(_Len)		((u32)(((_Len) >> 7) + ((_Len) & 0x7F ? 1 : 0)))
 
 u8 rtw_hal_data_init(struct adapter *padapter);
 void rtw_hal_data_deinit(struct adapter *padapter);
-- 
2.20.1


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

* [PATCH v2 04/20] staging: rtl8723bs: remove unused macros in include/hal_com_reg.h
  2021-03-27 14:23 [PATCH v2 00/20] fix checkpatch error on macros Fabio Aiuto
                   ` (2 preceding siblings ...)
  2021-03-27 14:24 ` [PATCH v2 03/20] staging: rtl8723bs: added spaces around operators in a macro " Fabio Aiuto
@ 2021-03-27 14:24 ` Fabio Aiuto
  2021-03-27 14:24 ` [PATCH v2 05/20] staging: rtl8723bs: remove unused macros in include/hal_data.h Fabio Aiuto
                   ` (15 subsequent siblings)
  19 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-27 14:24 UTC (permalink / raw)
  To: gregkh
  Cc: dan.carpenter, david.laight, linux-staging, linux-kernel, Fabio Aiuto

remove declarations of unused macros in include/hal_com_reg.h

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

diff --git a/drivers/staging/rtl8723bs/include/hal_com_reg.h b/drivers/staging/rtl8723bs/include/hal_com_reg.h
index b555826760d0..2cd18eb57244 100644
--- a/drivers/staging/rtl8723bs/include/hal_com_reg.h
+++ b/drivers/staging/rtl8723bs/include/hal_com_reg.h
@@ -707,14 +707,6 @@ 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_BITMAP_ALL			0xFFFFF
 
 /*  Only use CCK 1M rate for ACK */
-- 
2.20.1


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

* [PATCH v2 05/20] staging: rtl8723bs: remove unused macros in include/hal_data.h
  2021-03-27 14:23 [PATCH v2 00/20] fix checkpatch error on macros Fabio Aiuto
                   ` (3 preceding siblings ...)
  2021-03-27 14:24 ` [PATCH v2 04/20] staging: rtl8723bs: remove unused macros in include/hal_com_reg.h Fabio Aiuto
@ 2021-03-27 14:24 ` Fabio Aiuto
  2021-03-27 14:24 ` [PATCH v2 06/20] staging: rtl8723bs: put parentheses on macros with complex values " Fabio Aiuto
                   ` (14 subsequent siblings)
  19 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-27 14:24 UTC (permalink / raw)
  To: gregkh
  Cc: dan.carpenter, david.laight, linux-staging, linux-kernel, Fabio Aiuto

remove declarations of unused macros in include/hal_data.h

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

diff --git a/drivers/staging/rtl8723bs/include/hal_data.h b/drivers/staging/rtl8723bs/include/hal_data.h
index b5a0be35a6ce..93ee20e8e860 100644
--- a/drivers/staging/rtl8723bs/include/hal_data.h
+++ b/drivers/staging/rtl8723bs/include/hal_data.h
@@ -50,12 +50,10 @@ enum rt_ampdu_burst {
 #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 MAX_PG_GROUP			13
 
 /*  Tx Power Limit Table Size */
 #define MAX_REGULATION_NUM			4
-#define MAX_RF_PATH_NUM_IN_POWER_LIMIT_TABLE	4
 #define MAX_2_4G_BANDWIDTH_NUM			4
 #define MAX_RATE_SECTION_NUM			10
 #define MAX_5G_BANDWIDTH_NUM			4
@@ -69,11 +67,6 @@ enum rt_ampdu_burst {
 /* define IQK_ADDA_REG_NUM		16 */
 
 /* define IQK_BB_REG_NUM			10 */
-#define IQK_BB_REG_NUM_92C	9
-#define IQK_BB_REG_NUM_92D	10
-#define IQK_BB_REG_NUM_test	6
-
-#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 v2 06/20] staging: rtl8723bs: put parentheses on macros with complex values in include/hal_data.h
  2021-03-27 14:23 [PATCH v2 00/20] fix checkpatch error on macros Fabio Aiuto
                   ` (4 preceding siblings ...)
  2021-03-27 14:24 ` [PATCH v2 05/20] staging: rtl8723bs: remove unused macros in include/hal_data.h Fabio Aiuto
@ 2021-03-27 14:24 ` Fabio Aiuto
  2021-03-27 14:24 ` [PATCH v2 07/20] staging: rtl8723bs: add spaces around operators " Fabio Aiuto
                   ` (13 subsequent siblings)
  19 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-27 14:24 UTC (permalink / raw)
  To: gregkh
  Cc: dan.carpenter, david.laight, linux-staging, linux-kernel, Fabio Aiuto

fix the following checkpatch warning:

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 */

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

diff --git a/drivers/staging/rtl8723bs/include/hal_data.h b/drivers/staging/rtl8723bs/include/hal_data.h
index 93ee20e8e860..655528ab8c7c 100644
--- a/drivers/staging/rtl8723bs/include/hal_data.h
+++ b/drivers/staging/rtl8723bs/include/hal_data.h
@@ -46,7 +46,7 @@ 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
-- 
2.20.1


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

* [PATCH v2 07/20] staging: rtl8723bs: add spaces around operators in include/hal_data.h
  2021-03-27 14:23 [PATCH v2 00/20] fix checkpatch error on macros Fabio Aiuto
                   ` (5 preceding siblings ...)
  2021-03-27 14:24 ` [PATCH v2 06/20] staging: rtl8723bs: put parentheses on macros with complex values " Fabio Aiuto
@ 2021-03-27 14:24 ` Fabio Aiuto
  2021-03-27 14:24 ` [PATCH v2 08/20] staging: rtl8723bs: remove unused macros in include/hal_phy.h Fabio Aiuto
                   ` (12 subsequent siblings)
  19 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-27 14:24 UTC (permalink / raw)
  To: gregkh
  Cc: dan.carpenter, david.laight, linux-staging, linux-kernel, Fabio Aiuto

add spaces around operators in a macro

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

diff --git a/drivers/staging/rtl8723bs/include/hal_data.h b/drivers/staging/rtl8723bs/include/hal_data.h
index 655528ab8c7c..df5c7b747498 100644
--- a/drivers/staging/rtl8723bs/include/hal_data.h
+++ b/drivers/staging/rtl8723bs/include/hal_data.h
@@ -46,7 +46,7 @@ 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
-- 
2.20.1


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

* [PATCH v2 08/20] staging: rtl8723bs: remove unused macros in include/hal_phy.h
  2021-03-27 14:23 [PATCH v2 00/20] fix checkpatch error on macros Fabio Aiuto
                   ` (6 preceding siblings ...)
  2021-03-27 14:24 ` [PATCH v2 07/20] staging: rtl8723bs: add spaces around operators " Fabio Aiuto
@ 2021-03-27 14:24 ` Fabio Aiuto
  2021-03-27 14:24 ` [PATCH v2 09/20] staging: rtl8723bs: put parentheses on macros with complex values in include/rtw_debug.h Fabio Aiuto
                   ` (11 subsequent siblings)
  19 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-27 14:24 UTC (permalink / raw)
  To: gregkh
  Cc: dan.carpenter, david.laight, linux-staging, linux-kernel, Fabio Aiuto

remove declarations of unused macros in include/hal_phy.h

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

diff --git a/drivers/staging/rtl8723bs/include/hal_phy.h b/drivers/staging/rtl8723bs/include/hal_phy.h
index bf17a85b5959..521eb1c2efad 100644
--- a/drivers/staging/rtl8723bs/include/hal_phy.h
+++ b/drivers/staging/rtl8723bs/include/hal_phy.h
@@ -20,17 +20,6 @@
 #define	HAL_RF_ENABLE				1
 #endif
 
-#define	RF6052_MAX_TX_PWR			0x3F
-#define	RF6052_MAX_REG_88E			0xFF
-#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
-
-#define GET_RF6052_REAL_MAX_REG(_Adapter)	RF6052_MAX_REG_92C
-
-#define	RF6052_MAX_PATH				2
-
 /*  */
 /*  Antenna detection method, i.e., using single tone detection or RSSI reported from each antenna detected. */
 /*  Added by Roger, 2013.05.22. */
-- 
2.20.1


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

* [PATCH v2 09/20] staging: rtl8723bs: put parentheses on macros with complex values in include/rtw_debug.h
  2021-03-27 14:23 [PATCH v2 00/20] fix checkpatch error on macros Fabio Aiuto
                   ` (7 preceding siblings ...)
  2021-03-27 14:24 ` [PATCH v2 08/20] staging: rtl8723bs: remove unused macros in include/hal_phy.h Fabio Aiuto
@ 2021-03-27 14:24 ` Fabio Aiuto
  2021-03-28  8:39   ` Joe Perches
  2021-03-28 12:08   ` Greg KH
  2021-03-27 14:24 ` [PATCH v2 10/20] staging: rtl8723bs: remove unused macro in include/rtw_pwrctrl.h Fabio Aiuto
                   ` (10 subsequent siblings)
  19 siblings, 2 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-27 14:24 UTC (permalink / raw)
  To: gregkh
  Cc: dan.carpenter, david.laight, 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 v2 10/20] staging: rtl8723bs: remove unused macro in include/rtw_pwrctrl.h
  2021-03-27 14:23 [PATCH v2 00/20] fix checkpatch error on macros Fabio Aiuto
                   ` (8 preceding siblings ...)
  2021-03-27 14:24 ` [PATCH v2 09/20] staging: rtl8723bs: put parentheses on macros with complex values in include/rtw_debug.h Fabio Aiuto
@ 2021-03-27 14:24 ` Fabio Aiuto
  2021-03-27 14:24 ` [PATCH v2 11/20] staging: rtl8723bs: remove unused field in rereg_nd_name_data struct Fabio Aiuto
                   ` (9 subsequent siblings)
  19 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-27 14:24 UTC (permalink / raw)
  To: gregkh
  Cc: dan.carpenter, david.laight, linux-staging, linux-kernel, Fabio Aiuto

remove unused macro reading field ips_mode_req of struct
pwrctrl_priv

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

diff --git a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
index 2d77446e9482..36d9ec82a7dc 100644
--- a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
+++ b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
@@ -237,9 +237,6 @@ struct pwrctrl_priv {
 	unsigned long PS_BBRegBackup[PSBBREG_TOTALCNT];
 };
 
-#define rtw_get_ips_mode_req(pwrctl) \
-	(pwrctl)->ips_mode_req
-
 #define rtw_ips_mode_req(pwrctl, ips_mode) \
 	(pwrctl)->ips_mode_req = (ips_mode)
 
-- 
2.20.1


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

* [PATCH v2 11/20] staging: rtl8723bs: remove unused field in rereg_nd_name_data struct
  2021-03-27 14:23 [PATCH v2 00/20] fix checkpatch error on macros Fabio Aiuto
                   ` (9 preceding siblings ...)
  2021-03-27 14:24 ` [PATCH v2 10/20] staging: rtl8723bs: remove unused macro in include/rtw_pwrctrl.h Fabio Aiuto
@ 2021-03-27 14:24 ` Fabio Aiuto
  2021-03-27 14:24 ` [PATCH v2 12/20] staging: rtl8723bs: remove commented code line in os_dep/ioctl_linux.c Fabio Aiuto
                   ` (8 subsequent siblings)
  19 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-27 14:24 UTC (permalink / raw)
  To: gregkh
  Cc: dan.carpenter, david.laight, linux-staging, linux-kernel, Fabio Aiuto

remove unused field old_ips_mode in struct rereg_nd_name_data

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

diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h
index df1dd9fa7b90..7eb59a16d00e 100644
--- a/drivers/staging/rtl8723bs/include/drv_types.h
+++ b/drivers/staging/rtl8723bs/include/drv_types.h
@@ -412,7 +412,6 @@ struct adapter {
 	struct rereg_nd_name_data {
 		struct net_device *old_pnetdev;
 		char old_ifname[IFNAMSIZ];
-		u8 old_ips_mode;
 		u8 old_bRegUseLed;
 	} rereg_nd_name_priv;
 
-- 
2.20.1


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

* [PATCH v2 12/20] staging: rtl8723bs: remove commented code line in os_dep/ioctl_linux.c
  2021-03-27 14:23 [PATCH v2 00/20] fix checkpatch error on macros Fabio Aiuto
                   ` (10 preceding siblings ...)
  2021-03-27 14:24 ` [PATCH v2 11/20] staging: rtl8723bs: remove unused field in rereg_nd_name_data struct Fabio Aiuto
@ 2021-03-27 14:24 ` Fabio Aiuto
  2021-03-27 14:24 ` [PATCH v2 13/20] staging: rtl8723bs: put parentheses on macros with complex values in include/rtw_pwrctrl.h Fabio Aiuto
                   ` (7 subsequent siblings)
  19 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-27 14:24 UTC (permalink / raw)
  To: gregkh
  Cc: dan.carpenter, david.laight, linux-staging, linux-kernel, Fabio Aiuto

remove commented code line using obsolete definitions

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
---
 drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index eac98e455413..354441e6a667 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -2618,7 +2618,6 @@ static int rtw_rereg_nd_name(struct net_device *dev,
 		rtw_free_network_queue(padapter, true);
 
 		/*  the interface is being "disabled", we can do deeper IPS */
-		/* rereg_priv->old_ips_mode = rtw_get_ips_mode_req(&padapter->pwrctrlpriv); */
 		/* rtw_ips_mode_req(&padapter->pwrctrlpriv, IPS_NORMAL); */
 	}
 exit:
-- 
2.20.1


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

* [PATCH v2 13/20] staging: rtl8723bs: put parentheses on macros with complex values in include/rtw_pwrctrl.h
  2021-03-27 14:23 [PATCH v2 00/20] fix checkpatch error on macros Fabio Aiuto
                   ` (11 preceding siblings ...)
  2021-03-27 14:24 ` [PATCH v2 12/20] staging: rtl8723bs: remove commented code line in os_dep/ioctl_linux.c Fabio Aiuto
@ 2021-03-27 14:24 ` Fabio Aiuto
  2021-03-27 14:24 ` [PATCH v2 14/20] staging: rtl8723bs: add spaces around operator " Fabio Aiuto
                   ` (6 subsequent siblings)
  19 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-27 14:24 UTC (permalink / raw)
  To: gregkh
  Cc: dan.carpenter, david.laight, 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
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 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h b/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h
index 36d9ec82a7dc..6b2be97c2c07 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
@@ -238,7 +238,7 @@ struct pwrctrl_priv {
 };
 
 #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 v2 14/20] staging: rtl8723bs: add spaces around operator in include/rtw_pwrctrl.h
  2021-03-27 14:23 [PATCH v2 00/20] fix checkpatch error on macros Fabio Aiuto
                   ` (12 preceding siblings ...)
  2021-03-27 14:24 ` [PATCH v2 13/20] staging: rtl8723bs: put parentheses on macros with complex values in include/rtw_pwrctrl.h Fabio Aiuto
@ 2021-03-27 14:24 ` Fabio Aiuto
  2021-03-27 14:24 ` [PATCH v2 15/20] staging: rtl8723bs: remove unused macros in include/wifi.h Fabio Aiuto
                   ` (5 subsequent siblings)
  19 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-27 14:24 UTC (permalink / raw)
  To: gregkh
  Cc: dan.carpenter, david.laight, 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 6b2be97c2c07..b052b86944c4 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 v2 15/20] staging: rtl8723bs: remove unused macros in include/wifi.h
  2021-03-27 14:23 [PATCH v2 00/20] fix checkpatch error on macros Fabio Aiuto
                   ` (13 preceding siblings ...)
  2021-03-27 14:24 ` [PATCH v2 14/20] staging: rtl8723bs: add spaces around operator " Fabio Aiuto
@ 2021-03-27 14:24 ` Fabio Aiuto
  2021-03-27 14:24 ` [PATCH v2 16/20] staging: rtl8723bs: put parentheses on macros with complex values " Fabio Aiuto
                   ` (4 subsequent siblings)
  19 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-27 14:24 UTC (permalink / raw)
  To: gregkh
  Cc: dan.carpenter, david.laight, linux-staging, linux-kernel, Fabio Aiuto

remove declarations of unused macros in include/wifi.h

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

diff --git a/drivers/staging/rtl8723bs/include/wifi.h b/drivers/staging/rtl8723bs/include/wifi.h
index 48db55419bb3..4f8d08c00694 100644
--- a/drivers/staging/rtl8723bs/include/wifi.h
+++ b/drivers/staging/rtl8723bs/include/wifi.h
@@ -102,17 +102,11 @@ enum {
 
 #define GetToDs(pbuf)	(((*(__le16 *)(pbuf)) & cpu_to_le16(_TO_DS_)) != 0)
 
-#define ClearToDs(pbuf)	\
-	*(__le16 *)(pbuf) &= (~cpu_to_le16(_TO_DS_))
-
 #define SetFrDs(pbuf)	\
 	*(__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_))
-
 #define get_tofr_ds(pframe)	((GetToDs(pframe) << 1) | GetFrDs(pframe))
 
 #define SetMFrag(pbuf)	\
@@ -123,9 +117,6 @@ enum {
 #define ClearMFrag(pbuf)	\
 	*(__le16 *)(pbuf) &= (~cpu_to_le16(_MORE_FRAG_))
 
-#define SetRetry(pbuf)	\
-	*(__le16 *)(pbuf) |= cpu_to_le16(_RETRY_)
-
 #define GetRetry(pbuf)	(((*(__le16 *)(pbuf)) & cpu_to_le16(_RETRY_)) != 0)
 
 #define ClearRetry(pbuf)	\
@@ -153,10 +144,6 @@ enum {
 #define GetPrivacy(pbuf)					\
 	(((*(__le16 *)(pbuf)) & cpu_to_le16(_PRIVACY_)) != 0)
 
-#define ClearPrivacy(pbuf)	\
-	*(__le16 *)(pbuf) &= (~cpu_to_le16(_PRIVACY_))
-
-
 #define GetOrder(pbuf)					\
 	(((*(__le16 *)(pbuf)) & cpu_to_le16(_ORDER_)) != 0)
 
@@ -222,15 +209,8 @@ enum {
 
 #define GetAMsdu(pbuf) (((le16_to_cpu(*(__le16 *)pbuf)) >> 7) & 0x1)
 
-#define SetAMsdu(pbuf, amsdu)	\
-	*(__le16 *)(pbuf) |= cpu_to_le16((amsdu & 1) << 7)
-
 #define GetAid(pbuf)	(le16_to_cpu(*(__le16 *)((size_t)(pbuf) + 2)) & 0x3fff)
 
-#define GetTid(pbuf)	(le16_to_cpu(*(__le16 *)((size_t)(pbuf) +	\
-			(((GetToDs(pbuf)<<1) | GetFrDs(pbuf)) == 3 ?	\
-			30 : 24))) & 0x000f)
-
 #define GetAddr1Ptr(pbuf)	((unsigned char *)((size_t)(pbuf) + 4))
 
 #define GetAddr2Ptr(pbuf)	((unsigned char *)((size_t)(pbuf) + 10))
-- 
2.20.1


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

* [PATCH v2 16/20] staging: rtl8723bs: put parentheses on macros with complex values in include/wifi.h
  2021-03-27 14:23 [PATCH v2 00/20] fix checkpatch error on macros Fabio Aiuto
                   ` (14 preceding siblings ...)
  2021-03-27 14:24 ` [PATCH v2 15/20] staging: rtl8723bs: remove unused macros in include/wifi.h Fabio Aiuto
@ 2021-03-27 14:24 ` Fabio Aiuto
  2021-03-27 14:24 ` [PATCH v2 17/20] staging: rtl8723bs: remove macros updating unused fields in struct security_priv Fabio Aiuto
                   ` (3 subsequent siblings)
  19 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-27 14:24 UTC (permalink / raw)
  To: gregkh
  Cc: dan.carpenter, david.laight, 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
122: FILE: drivers/staging/rtl8723bs/include/wifi.h:122:
+#define SetFrDs(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
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
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)	\

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

diff --git a/drivers/staging/rtl8723bs/include/wifi.h b/drivers/staging/rtl8723bs/include/wifi.h
index 4f8d08c00694..69e714a6d87c 100644
--- a/drivers/staging/rtl8723bs/include/wifi.h
+++ b/drivers/staging/rtl8723bs/include/wifi.h
@@ -98,48 +98,48 @@ enum {
 #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 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 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 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)
@@ -191,19 +191,19 @@ enum {
 	} 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)
 
-- 
2.20.1


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

* [PATCH v2 17/20] staging: rtl8723bs: remove macros updating unused fields in struct security_priv
  2021-03-27 14:23 [PATCH v2 00/20] fix checkpatch error on macros Fabio Aiuto
                   ` (15 preceding siblings ...)
  2021-03-27 14:24 ` [PATCH v2 16/20] staging: rtl8723bs: put parentheses on macros with complex values " Fabio Aiuto
@ 2021-03-27 14:24 ` Fabio Aiuto
  2021-03-27 14:24 ` [PATCH v2 18/20] staging: rtl8723bs: remove " Fabio Aiuto
                   ` (2 subsequent siblings)
  19 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-27 14:24 UTC (permalink / raw)
  To: gregkh
  Cc: dan.carpenter, david.laight, linux-staging, linux-kernel, Fabio Aiuto

remove macros updating statistic fields in struct security_priv

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

diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c
index 44e2b362c867..0ddd7667a986 100644
--- a/drivers/staging/rtl8723bs/core/rtw_security.c
+++ b/drivers/staging/rtl8723bs/core/rtw_security.c
@@ -29,63 +29,6 @@ const char *security_type_str(u8 value)
 	return NULL;
 }
 
-#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++;
-
-#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++;
-
-#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++;
-
-#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++;
-
-#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++;
-
-#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++;
-#else
-#define WEP_SW_ENC_CNT_INC(sec, ra)
-#define WEP_SW_DEC_CNT_INC(sec, ra)
-#define TKIP_SW_ENC_CNT_INC(sec, ra)
-#define TKIP_SW_DEC_CNT_INC(sec, ra)
-#define AES_SW_ENC_CNT_INC(sec, ra)
-#define AES_SW_DEC_CNT_INC(sec, ra)
-#endif /* DBG_SW_SEC_CNT */
-
 /* WEP related ===== */
 
 struct arc4context {
@@ -256,8 +199,6 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe)
 				pframe = (u8 *)round_up((SIZE_PTR)(pframe), 4);
 			}
 		}
-
-		WEP_SW_ENC_CNT_INC(psecuritypriv, pattrib->ra);
 	}
 }
 
@@ -305,8 +246,6 @@ void rtw_wep_decrypt(struct adapter  *padapter, u8 *precvframe)
 					crc[1], payload[length - 3],
 					crc[0], payload[length - 4]));
 		}
-
-		WEP_SW_DEC_CNT_INC(psecuritypriv, prxattrib->ra);
 	}
 }
 
@@ -710,8 +649,6 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe)
 					pframe = (u8 *)round_up((SIZE_PTR)(pframe), 4);
 				}
 			}
-
-			TKIP_SW_ENC_CNT_INC(psecuritypriv, pattrib->ra);
 		}
 	}
 	return res;
@@ -812,8 +749,6 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe)
 						crc[0], payload[length - 4]));
 				res = _FAIL;
 			}
-
-			TKIP_SW_DEC_CNT_INC(psecuritypriv, prxattrib->ra);
 		} else {
 			RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("%s: stainfo == NULL!!!\n", __func__));
 			res = _FAIL;
@@ -1465,8 +1400,6 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe)
 				pframe = (u8 *)round_up((SIZE_PTR)(pframe), 4);
 			}
 		}
-
-		AES_SW_ENC_CNT_INC(psecuritypriv, pattrib->ra);
 	}
 	return res;
 }
@@ -1772,7 +1705,6 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe)
 
 			res = aes_decipher(prwskey, prxattrib->hdrlen, pframe, length);
 
-			AES_SW_DEC_CNT_INC(psecuritypriv, prxattrib->ra);
 		} else {
 			RT_TRACE(_module_rtl871x_security_c_,
 				 _drv_err_,
-- 
2.20.1


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

* [PATCH v2 18/20] staging: rtl8723bs: remove unused fields in struct security_priv
  2021-03-27 14:23 [PATCH v2 00/20] fix checkpatch error on macros Fabio Aiuto
                   ` (16 preceding siblings ...)
  2021-03-27 14:24 ` [PATCH v2 17/20] staging: rtl8723bs: remove macros updating unused fields in struct security_priv Fabio Aiuto
@ 2021-03-27 14:24 ` Fabio Aiuto
  2021-03-27 14:24 ` [PATCH v2 19/20] staging: rtl8723bs: include macro in a do - while loop in core/rtw_security.c Fabio Aiuto
  2021-03-27 14:24 ` [PATCH v2 20/20] staging: rtl8723bs: remove unused macros in include/drv_types.c Fabio Aiuto
  19 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-27 14:24 UTC (permalink / raw)
  To: gregkh
  Cc: dan.carpenter, david.laight, linux-staging, linux-kernel, Fabio Aiuto

remove unused fields in struct security_priv

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
---
 .../staging/rtl8723bs/include/rtw_security.h  | 23 -------------------
 1 file changed, 23 deletions(-)

diff --git a/drivers/staging/rtl8723bs/include/rtw_security.h b/drivers/staging/rtl8723bs/include/rtw_security.h
index 60b05a620eee..b71f0959108b 100644
--- a/drivers/staging/rtl8723bs/include/rtw_security.h
+++ b/drivers/staging/rtl8723bs/include/rtw_security.h
@@ -168,29 +168,6 @@ struct security_priv {
 
 	u8 bWepDefaultKeyIdxSet;
 
-#define DBG_SW_SEC_CNT
-#ifdef DBG_SW_SEC_CNT
-	u64 wep_sw_enc_cnt_bc;
-	u64 wep_sw_enc_cnt_mc;
-	u64 wep_sw_enc_cnt_uc;
-	u64 wep_sw_dec_cnt_bc;
-	u64 wep_sw_dec_cnt_mc;
-	u64 wep_sw_dec_cnt_uc;
-
-	u64 tkip_sw_enc_cnt_bc;
-	u64 tkip_sw_enc_cnt_mc;
-	u64 tkip_sw_enc_cnt_uc;
-	u64 tkip_sw_dec_cnt_bc;
-	u64 tkip_sw_dec_cnt_mc;
-	u64 tkip_sw_dec_cnt_uc;
-
-	u64 aes_sw_enc_cnt_bc;
-	u64 aes_sw_enc_cnt_mc;
-	u64 aes_sw_enc_cnt_uc;
-	u64 aes_sw_dec_cnt_bc;
-	u64 aes_sw_dec_cnt_mc;
-	u64 aes_sw_dec_cnt_uc;
-#endif /* DBG_SW_SEC_CNT */
 };
 
 #define GET_ENCRY_ALGO(psecuritypriv, psta, encry_algo, bmcst)\
-- 
2.20.1


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

* [PATCH v2 19/20] staging: rtl8723bs: include macro in a do - while loop in core/rtw_security.c
  2021-03-27 14:23 [PATCH v2 00/20] fix checkpatch error on macros Fabio Aiuto
                   ` (17 preceding siblings ...)
  2021-03-27 14:24 ` [PATCH v2 18/20] staging: rtl8723bs: remove " Fabio Aiuto
@ 2021-03-27 14:24 ` Fabio Aiuto
  2021-03-28 12:10   ` Greg KH
  2021-03-27 14:24 ` [PATCH v2 20/20] staging: rtl8723bs: remove unused macros in include/drv_types.c Fabio Aiuto
  19 siblings, 1 reply; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-27 14:24 UTC (permalink / raw)
  To: gregkh
  Cc: dan.carpenter, david.laight, linux-staging, linux-kernel, Fabio Aiuto

fix the following checkpatch warning:

ERROR: Macros with multiple statements should be enclosed
in a do - while loop
2014: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:2014:
+#define ROUND(i, d, s) \

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

diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c
index 0ddd7667a986..8a447e149438 100644
--- a/drivers/staging/rtl8723bs/core/rtw_security.c
+++ b/drivers/staging/rtl8723bs/core/rtw_security.c
@@ -2012,10 +2012,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 v2 20/20] staging: rtl8723bs: remove unused macros in include/drv_types.c
  2021-03-27 14:23 [PATCH v2 00/20] fix checkpatch error on macros Fabio Aiuto
                   ` (18 preceding siblings ...)
  2021-03-27 14:24 ` [PATCH v2 19/20] staging: rtl8723bs: include macro in a do - while loop in core/rtw_security.c Fabio Aiuto
@ 2021-03-27 14:24 ` Fabio Aiuto
  19 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-27 14:24 UTC (permalink / raw)
  To: gregkh
  Cc: dan.carpenter, david.laight, linux-staging, linux-kernel, Fabio Aiuto

remove declarations of unused macros

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

diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h
index 7eb59a16d00e..a454a6390537 100644
--- a/drivers/staging/rtl8723bs/include/drv_types.h
+++ b/drivers/staging/rtl8723bs/include/drv_types.h
@@ -266,11 +266,6 @@ struct cam_entry_cache {
 	u8 key[16];
 };
 
-#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], \
-	((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]
-
 struct dvobj_priv {
 	/*-------- below is common data --------*/
 	struct adapter *if1; /* PRIMARY_ADAPTER */
-- 
2.20.1


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

* Re: [PATCH v2 09/20] staging: rtl8723bs: put parentheses on macros with complex values in include/rtw_debug.h
  2021-03-27 14:24 ` [PATCH v2 09/20] staging: rtl8723bs: put parentheses on macros with complex values in include/rtw_debug.h Fabio Aiuto
@ 2021-03-28  8:39   ` Joe Perches
  2021-03-28 12:08   ` Greg KH
  1 sibling, 0 replies; 27+ messages in thread
From: Joe Perches @ 2021-03-28  8:39 UTC (permalink / raw)
  To: Fabio Aiuto, gregkh
  Cc: dan.carpenter, david.laight, linux-staging, linux-kernel

On Sat, 2021-03-27 at 15:24 +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
> +	#define RT_PRINT_DATA(_Comp, _Level,
> 	_TitleString, _HexData, _HexDataLen)			\
> 
> Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>

It's good to use checkpatch as a guide to improve code, but this
particular code is just a mess to begin with and it makes a
complete mess of the the dmesg log if it's actually enabled.

Try substituting print_hex_dump_debug for this instead.

> ---
>  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 */
>  
> 



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

* Re: [PATCH v2 09/20] staging: rtl8723bs: put parentheses on macros with complex values in include/rtw_debug.h
  2021-03-27 14:24 ` [PATCH v2 09/20] staging: rtl8723bs: put parentheses on macros with complex values in include/rtw_debug.h Fabio Aiuto
  2021-03-28  8:39   ` Joe Perches
@ 2021-03-28 12:08   ` Greg KH
  2021-03-28 14:43     ` Fabio Aiuto
  1 sibling, 1 reply; 27+ messages in thread
From: Greg KH @ 2021-03-28 12:08 UTC (permalink / raw)
  To: Fabio Aiuto; +Cc: dan.carpenter, david.laight, linux-staging, linux-kernel

On Sat, Mar 27, 2021 at 03:24:08PM +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
> +	#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");							\
> -		}

This whole nightmare needs to just be deleted and any callers of it need
to use the in-kernel functions for this instead.

thanks,

greg k-h

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

* Re: [PATCH v2 19/20] staging: rtl8723bs: include macro in a do - while loop in core/rtw_security.c
  2021-03-27 14:24 ` [PATCH v2 19/20] staging: rtl8723bs: include macro in a do - while loop in core/rtw_security.c Fabio Aiuto
@ 2021-03-28 12:10   ` Greg KH
  2021-03-28 14:23     ` Fabio Aiuto
  0 siblings, 1 reply; 27+ messages in thread
From: Greg KH @ 2021-03-28 12:10 UTC (permalink / raw)
  To: Fabio Aiuto; +Cc: dan.carpenter, david.laight, linux-staging, linux-kernel

On Sat, Mar 27, 2021 at 03:24:18PM +0100, Fabio Aiuto wrote:
> fix the following checkpatch warning:
> 
> ERROR: Macros with multiple statements should be enclosed
> in a do - while loop
> 2014: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:2014:
> +#define ROUND(i, d, s) \
> 
> Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
> ---
>  drivers/staging/rtl8723bs/core/rtw_security.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c
> index 0ddd7667a986..8a447e149438 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_security.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_security.c
> @@ -2012,10 +2012,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)

Why is this code not using the in-kernel crypto code instead?  I'll take
this but that should be something that is done to this code
eventually...

thanks,

greg k-h

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

* Re: [PATCH v2 19/20] staging: rtl8723bs: include macro in a do - while loop in core/rtw_security.c
  2021-03-28 12:10   ` Greg KH
@ 2021-03-28 14:23     ` Fabio Aiuto
  0 siblings, 0 replies; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-28 14:23 UTC (permalink / raw)
  To: Greg KH; +Cc: dan.carpenter, david.laight, linux-staging, linux-kernel

On Sun, Mar 28, 2021 at 02:10:03PM +0200, Greg KH wrote:
> On Sat, Mar 27, 2021 at 03:24:18PM +0100, Fabio Aiuto wrote:
> > fix the following checkpatch warning:
> > 
> > ERROR: Macros with multiple statements should be enclosed
> > in a do - while loop
> > 2014: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:2014:
> > +#define ROUND(i, d, s) \
> > 
> > Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
> > ---
> >  drivers/staging/rtl8723bs/core/rtw_security.c | 10 ++++++----
> >  1 file changed, 6 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c
> > index 0ddd7667a986..8a447e149438 100644
> > --- a/drivers/staging/rtl8723bs/core/rtw_security.c
> > +++ b/drivers/staging/rtl8723bs/core/rtw_security.c
> > @@ -2012,10 +2012,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)
> 
> Why is this code not using the in-kernel crypto code instead?  I'll take
> this but that should be something that is done to this code
> eventually...
> 
> thanks,
> 
> greg k-h

ok, I will indagate fo the fix.

thank you,

fabio

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

* Re: [PATCH v2 09/20] staging: rtl8723bs: put parentheses on macros with complex values in include/rtw_debug.h
  2021-03-28 12:08   ` Greg KH
@ 2021-03-28 14:43     ` Fabio Aiuto
  2021-03-28 14:54       ` Greg KH
  0 siblings, 1 reply; 27+ messages in thread
From: Fabio Aiuto @ 2021-03-28 14:43 UTC (permalink / raw)
  To: Greg KH; +Cc: joe, dan.carpenter, david.laight, linux-staging, linux-kernel

On Sun, Mar 28, 2021 at 02:08:41PM +0200, Greg KH wrote:
> On Sat, Mar 27, 2021 at 03:24:08PM +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
> > +	#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");							\
> > -		}
> 
> This whole nightmare needs to just be deleted and any callers of it need
> to use the in-kernel functions for this instead.
> 
> thanks,
> 
> greg k-h

ok, will we get rid of the private debug level and components tracking as well?

Maybe encapsulating the built-in proposed by Joe, keeping the macro alive?

Thank you,

Fabio
 

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

* Re: [PATCH v2 09/20] staging: rtl8723bs: put parentheses on macros with complex values in include/rtw_debug.h
  2021-03-28 14:43     ` Fabio Aiuto
@ 2021-03-28 14:54       ` Greg KH
  0 siblings, 0 replies; 27+ messages in thread
From: Greg KH @ 2021-03-28 14:54 UTC (permalink / raw)
  To: Fabio Aiuto; +Cc: joe, dan.carpenter, david.laight, linux-staging, linux-kernel

On Sun, Mar 28, 2021 at 04:43:24PM +0200, Fabio Aiuto wrote:
> On Sun, Mar 28, 2021 at 02:08:41PM +0200, Greg KH wrote:
> > On Sat, Mar 27, 2021 at 03:24:08PM +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
> > > +	#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");							\
> > > -		}
> > 
> > This whole nightmare needs to just be deleted and any callers of it need
> > to use the in-kernel functions for this instead.
> > 
> > thanks,
> > 
> > greg k-h
> 
> ok, will we get rid of the private debug level and components tracking as well?

Please do.

> Maybe encapsulating the built-in proposed by Joe, keeping the macro alive?

No, do not keep it alive.  Individual debugging/trace/info macros for
drivers do not make sense at all.  We have kernel-wide infrastructure
for this, it is bold for an individual driver to somehow think that they
need a "custom" solution for this instead.

Just use the normal apis, that is what they are there for.

thanks,

greg k-h

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

end of thread, other threads:[~2021-03-28 14:58 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-27 14:23 [PATCH v2 00/20] fix checkpatch error on macros Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 01/20] staging: rtl8723bs: remove unused macros in include/hal_com.h Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 02/20] staging: rtl8723bs: put parentheses on macro with complex values " Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 03/20] staging: rtl8723bs: added spaces around operators in a macro " Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 04/20] staging: rtl8723bs: remove unused macros in include/hal_com_reg.h Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 05/20] staging: rtl8723bs: remove unused macros in include/hal_data.h Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 06/20] staging: rtl8723bs: put parentheses on macros with complex values " Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 07/20] staging: rtl8723bs: add spaces around operators " Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 08/20] staging: rtl8723bs: remove unused macros in include/hal_phy.h Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 09/20] staging: rtl8723bs: put parentheses on macros with complex values in include/rtw_debug.h Fabio Aiuto
2021-03-28  8:39   ` Joe Perches
2021-03-28 12:08   ` Greg KH
2021-03-28 14:43     ` Fabio Aiuto
2021-03-28 14:54       ` Greg KH
2021-03-27 14:24 ` [PATCH v2 10/20] staging: rtl8723bs: remove unused macro in include/rtw_pwrctrl.h Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 11/20] staging: rtl8723bs: remove unused field in rereg_nd_name_data struct Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 12/20] staging: rtl8723bs: remove commented code line in os_dep/ioctl_linux.c Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 13/20] staging: rtl8723bs: put parentheses on macros with complex values in include/rtw_pwrctrl.h Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 14/20] staging: rtl8723bs: add spaces around operator " Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 15/20] staging: rtl8723bs: remove unused macros in include/wifi.h Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 16/20] staging: rtl8723bs: put parentheses on macros with complex values " Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 17/20] staging: rtl8723bs: remove macros updating unused fields in struct security_priv Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 18/20] staging: rtl8723bs: remove " Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 19/20] staging: rtl8723bs: include macro in a do - while loop in core/rtw_security.c Fabio Aiuto
2021-03-28 12:10   ` Greg KH
2021-03-28 14:23     ` Fabio Aiuto
2021-03-27 14:24 ` [PATCH v2 20/20] staging: rtl8723bs: remove unused macros in include/drv_types.c Fabio Aiuto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).