linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] Staging: rtl8712: Addressed checkpatch.pl issues related to macro parameter wrapping in parentheses.
@ 2020-06-14 17:31 Ricardo Ferreira
  2020-06-15  1:42 ` kernel test robot
  2020-06-15 12:36 ` Greg Kroah-Hartman
  0 siblings, 2 replies; 3+ messages in thread
From: Ricardo Ferreira @ 2020-06-14 17:31 UTC (permalink / raw)
  To: Larry Finger
  Cc: Florian Schilhabel, Greg Kroah-Hartman, Nishka Dasgupta,
	Dan Carpenter, devel, linux-kernel, Ricardo Ferreira

Attempting to wet my feet in kernel patch submission by submitting a checkstyle
fix for the rtl8712 driver.

Signed-off-by: Ricardo Ferreira <rikajff@gmail.com>
---
 drivers/staging/rtl8712/basic_types.h   | 2 +-
 drivers/staging/rtl8712/osdep_intf.h    | 2 +-
 drivers/staging/rtl8712/rtl8712_efuse.h | 8 ++++----
 drivers/staging/rtl8712/rtl8712_recv.h  | 4 ++--
 drivers/staging/rtl8712/rtl871x_xmit.h  | 6 +++---
 drivers/staging/rtl8712/wifi.h          | 6 +++---
 6 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/rtl8712/basic_types.h b/drivers/staging/rtl8712/basic_types.h
index 4ad7f35b1644..3e6d4ff45a75 100644
--- a/drivers/staging/rtl8712/basic_types.h
+++ b/drivers/staging/rtl8712/basic_types.h
@@ -21,7 +21,7 @@
 
 #define SIZE_T __kernel_size_t
 #define sint signed int
-#define FIELD_OFFSET(s, field)	((addr_t)&((s *)(0))->field)
+#define FIELD_OFFSET(s, field)	((addr_t)&(((s) *)(0))->(field))
 
 /* Should we extend this to be host_addr_t and target_addr_t for case:
  *	host : x86_64
diff --git a/drivers/staging/rtl8712/osdep_intf.h b/drivers/staging/rtl8712/osdep_intf.h
index 2cc25db1a91d..058287fd0f85 100644
--- a/drivers/staging/rtl8712/osdep_intf.h
+++ b/drivers/staging/rtl8712/osdep_intf.h
@@ -17,7 +17,7 @@
 #include "osdep_service.h"
 #include "drv_types.h"
 
-#define RND4(x)	(((x >> 2) + (((x & 3) == 0) ?  0 : 1)) << 2)
+#define RND4(x)	((((x) >> 2) + ((((x) & 3) == 0) ?  0 : 1)) << 2)
 
 struct intf_priv {
 	u8 *intf_dev;
diff --git a/drivers/staging/rtl8712/rtl8712_efuse.h b/drivers/staging/rtl8712/rtl8712_efuse.h
index 4969d307e978..f22993d94508 100644
--- a/drivers/staging/rtl8712/rtl8712_efuse.h
+++ b/drivers/staging/rtl8712/rtl8712_efuse.h
@@ -13,10 +13,10 @@
 #define PGPKT_DATA_SIZE	8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
 #define MAX_PGPKT_SIZE	9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
 
-#define GET_EFUSE_OFFSET(header)	((header & 0xF0) >> 4)
-#define GET_EFUSE_WORD_EN(header)	(header & 0x0F)
-#define MAKE_EFUSE_HEADER(offset, word_en)	(((offset & 0x0F) << 4) | \
-						(word_en & 0x0F))
+#define GET_EFUSE_OFFSET(header)	(((header) & 0xF0) >> 4)
+#define GET_EFUSE_WORD_EN(header)	((header) & 0x0F)
+#define MAKE_EFUSE_HEADER(offset, word_en)	((((offset) & 0x0F) << 4) | \
+						((word_en) & 0x0F))
 /*--------------------------------------------------------------------------*/
 struct PGPKT_STRUCT {
 	u8 offset;
diff --git a/drivers/staging/rtl8712/rtl8712_recv.h b/drivers/staging/rtl8712/rtl8712_recv.h
index 3e385b2242d8..cdce24efaeda 100644
--- a/drivers/staging/rtl8712/rtl8712_recv.h
+++ b/drivers/staging/rtl8712/rtl8712_recv.h
@@ -33,8 +33,8 @@
 #define RECVBUFF_ALIGN_SZ 512
 #define RSVD_ROOM_SZ (0)
 /*These definition is used for Rx packet reordering.*/
-#define SN_LESS(a, b)		(((a-b) & 0x800) != 0)
-#define SN_EQUAL(a, b)	(a == b)
+#define SN_LESS(a, b)		((((a)-(b)) & 0x800) != 0)
+#define SN_EQUAL(a, b)	((a) == (b))
 #define REORDER_WAIT_TIME	30 /* (ms)*/
 
 struct recv_stat {
diff --git a/drivers/staging/rtl8712/rtl871x_xmit.h b/drivers/staging/rtl8712/rtl871x_xmit.h
index c0c0c781fe17..23553360c6e4 100644
--- a/drivers/staging/rtl8712/rtl871x_xmit.h
+++ b/drivers/staging/rtl8712/rtl871x_xmit.h
@@ -41,7 +41,7 @@ do { \
 	pattrib_iv[0] = txpn._byte_.TSC0;\
 	pattrib_iv[1] = txpn._byte_.TSC1;\
 	pattrib_iv[2] = txpn._byte_.TSC2;\
-	pattrib_iv[3] = ((keyidx & 0x3) << 6);\
+	pattrib_iv[3] = (((keyidx) & 0x3) << 6);\
 	txpn.val = (txpn.val == 0xffffff) ? 0 : (txpn.val+1);\
 } while (0)
 
@@ -53,7 +53,7 @@ do { \
 	pattrib_iv[0] = txpn._byte_.TSC1;\
 	pattrib_iv[1] = (txpn._byte_.TSC1 | 0x20) & 0x7f;\
 	pattrib_iv[2] = txpn._byte_.TSC0;\
-	pattrib_iv[3] = BIT(5) | ((keyidx & 0x3)<<6);\
+	pattrib_iv[3] = BIT(5) | (((keyidx) & 0x3)<<6);\
 	pattrib_iv[4] = txpn._byte_.TSC2;\
 	pattrib_iv[5] = txpn._byte_.TSC3;\
 	pattrib_iv[6] = txpn._byte_.TSC4;\
@@ -67,7 +67,7 @@ do { \
 	pattrib_iv[0] = txpn._byte_.TSC0;\
 	pattrib_iv[1] = txpn._byte_.TSC1;\
 	pattrib_iv[2] = 0;\
-	pattrib_iv[3] = BIT(5) | ((keyidx & 0x3)<<6);\
+	pattrib_iv[3] = BIT(5) | (((keyidx) & 0x3)<<6);\
 	pattrib_iv[4] = txpn._byte_.TSC2;\
 	pattrib_iv[5] = txpn._byte_.TSC3;\
 	pattrib_iv[6] = txpn._byte_.TSC4;\
diff --git a/drivers/staging/rtl8712/wifi.h b/drivers/staging/rtl8712/wifi.h
index 91b65731fcaa..aca63104e479 100644
--- a/drivers/staging/rtl8712/wifi.h
+++ b/drivers/staging/rtl8712/wifi.h
@@ -245,7 +245,7 @@ static inline unsigned char get_tofr_ds(unsigned char *pframe)
 #define SetSeqNum(pbuf, num) ({ \
 	*(__le16 *)((addr_t)(pbuf) + 22) = \
 	cpu_to_le16((le16_to_cpu(*(__le16 *)((addr_t)(pbuf) + 22)) & \
-	0x000f) | (0xfff0 & (num << 4))); \
+	0x000f) | (0xfff0 & ((num) << 4))); \
 })
 
 #define SetDuration(pbuf, dur) ({ \
@@ -254,13 +254,13 @@ static inline unsigned char get_tofr_ds(unsigned char *pframe)
 })
 
 #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 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] 3+ messages in thread

* Re: [PATCH v2] Staging: rtl8712: Addressed checkpatch.pl issues related to macro parameter wrapping in parentheses.
  2020-06-14 17:31 [PATCH v2] Staging: rtl8712: Addressed checkpatch.pl issues related to macro parameter wrapping in parentheses Ricardo Ferreira
@ 2020-06-15  1:42 ` kernel test robot
  2020-06-15 12:36 ` Greg Kroah-Hartman
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2020-06-15  1:42 UTC (permalink / raw)
  To: Ricardo Ferreira, Larry Finger
  Cc: kbuild-all, Florian Schilhabel, Greg Kroah-Hartman,
	Nishka Dasgupta, Dan Carpenter, devel, linux-kernel,
	Ricardo Ferreira

[-- Attachment #1: Type: text/plain, Size: 6736 bytes --]

Hi Ricardo,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on staging/staging-testing]

url:    https://github.com/0day-ci/linux/commits/Ricardo-Ferreira/Staging-rtl8712-Addressed-checkpatch-pl-issues-related-to-macro-parameter-wrapping-in-parentheses/20200615-013306
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git af7b4801030c07637840191c69eb666917e4135d
config: arm-randconfig-r025-20200614 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>, old ones prefixed by <<):

In file included from drivers/staging/rtl8712/rtl871x_cmd.h:22,
from drivers/staging/rtl8712/drv_types.h:47,
from drivers/staging/rtl8712/hal_init.c:26:
drivers/staging/rtl8712/ieee80211.h:566:1: warning: alignment 1 of 'struct ieee80211_authentication' is less than 2 [-Wpacked-not-aligned]
566 | } __packed;
| ^
drivers/staging/rtl8712/ieee80211.h:574:1: warning: alignment 1 of 'struct ieee80211_probe_response' is less than 2 [-Wpacked-not-aligned]
574 | } __packed;
| ^
drivers/staging/rtl8712/ieee80211.h:578:1: warning: alignment 1 of 'struct ieee80211_probe_request' is less than 2 [-Wpacked-not-aligned]
578 | } __packed;
| ^
drivers/staging/rtl8712/ieee80211.h:585:1: warning: alignment 1 of 'struct ieee80211_assoc_request_frame' is less than 2 [-Wpacked-not-aligned]
585 | } __packed;
| ^
drivers/staging/rtl8712/ieee80211.h:592:1: warning: alignment 1 of 'struct ieee80211_assoc_response_frame' is less than 2 [-Wpacked-not-aligned]
592 | } __packed;
| ^
In file included from drivers/staging/rtl8712/osdep_service.h:31,
from drivers/staging/rtl8712/hal_init.c:25:
drivers/staging/rtl8712/hal_init.c: In function 'chk_fwhdr':
>> drivers/staging/rtl8712/basic_types.h:24:49: error: expected expression before ')' token
24 | #define FIELD_OFFSET(s, field) ((addr_t)&(((s) *)(0))->(field))
|                                                 ^
>> drivers/staging/rtl8712/hal_init.c:136:12: note: in expansion of macro 'FIELD_OFFSET'
136 |  fwhdrsz = FIELD_OFFSET(struct fw_hdr, fwpriv) + pfwhdr->fw_priv_sz;
|            ^~~~~~~~~~~~
drivers/staging/rtl8712/hal_init.c: In function 'rtl8712_dl_fw':
>> drivers/staging/rtl8712/basic_types.h:24:49: error: expected expression before ')' token
24 | #define FIELD_OFFSET(s, field) ((addr_t)&(((s) *)(0))->(field))
|                                                 ^
drivers/staging/rtl8712/hal_init.c:176:26: note: in expansion of macro 'FIELD_OFFSET'
176 |   ptr = (u8 *)mappedfw + FIELD_OFFSET(struct fw_hdr, fwpriv) +
|                          ^~~~~~~~~~~~
--
In file included from drivers/staging/rtl8712/rtl871x_cmd.h:22,
from drivers/staging/rtl8712/drv_types.h:47,
from drivers/staging/rtl8712/rtl871x_ioctl_linux.c:21:
drivers/staging/rtl8712/ieee80211.h:566:1: warning: alignment 1 of 'struct ieee80211_authentication' is less than 2 [-Wpacked-not-aligned]
566 | } __packed;
| ^
drivers/staging/rtl8712/ieee80211.h:574:1: warning: alignment 1 of 'struct ieee80211_probe_response' is less than 2 [-Wpacked-not-aligned]
574 | } __packed;
| ^
drivers/staging/rtl8712/ieee80211.h:578:1: warning: alignment 1 of 'struct ieee80211_probe_request' is less than 2 [-Wpacked-not-aligned]
578 | } __packed;
| ^
drivers/staging/rtl8712/ieee80211.h:585:1: warning: alignment 1 of 'struct ieee80211_assoc_request_frame' is less than 2 [-Wpacked-not-aligned]
585 | } __packed;
| ^
drivers/staging/rtl8712/ieee80211.h:592:1: warning: alignment 1 of 'struct ieee80211_assoc_response_frame' is less than 2 [-Wpacked-not-aligned]
592 | } __packed;
| ^
In file included from drivers/staging/rtl8712/osdep_service.h:31,
from drivers/staging/rtl8712/rtl871x_ioctl_linux.c:20:
drivers/staging/rtl8712/rtl871x_ioctl_linux.c: In function 'wpa_set_encryption':
>> drivers/staging/rtl8712/basic_types.h:24:49: error: expected expression before ')' token
24 | #define FIELD_OFFSET(s, field) ((addr_t)&(((s) *)(0))->(field))
|                                                 ^
>> drivers/staging/rtl8712/rtl871x_ioctl_linux.c:413:4: note: in expansion of macro 'FIELD_OFFSET'
413 |    FIELD_OFFSET(struct NDIS_802_11_WEP, KeyMaterial);
|    ^~~~~~~~~~~~
drivers/staging/rtl8712/rtl871x_ioctl_linux.c: In function 'r8711_wx_set_enc':
>> drivers/staging/rtl8712/basic_types.h:24:49: error: expected expression before ')' token
24 | #define FIELD_OFFSET(s, field) ((addr_t)&(((s) *)(0))->(field))
|                                                 ^
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1561:9: note: in expansion of macro 'FIELD_OFFSET'
1561 |         FIELD_OFFSET(struct NDIS_802_11_WEP, KeyMaterial);
|         ^~~~~~~~~~~~
In file included from drivers/staging/rtl8712/rtl871x_ioctl_linux.c:28:
At top level:
drivers/staging/rtl8712/rtl871x_mp_ioctl.h:256:34: warning: 'oid_rtl_seg_81_85' defined but not used [-Wunused-const-variable=]
256 | static const struct oid_obj_priv oid_rtl_seg_81_85[] = {
|                                  ^~~~~~~~~~~~~~~~~
drivers/staging/rtl8712/rtl871x_mp_ioctl.h:249:34: warning: 'oid_rtl_seg_81_80_80' defined but not used [-Wunused-const-variable=]
249 | static const struct oid_obj_priv oid_rtl_seg_81_80_80[] = {
|                                  ^~~~~~~~~~~~~~~~~~~~
drivers/staging/rtl8712/rtl871x_mp_ioctl.h:240:34: warning: 'oid_rtl_seg_81_80_40' defined but not used [-Wunused-const-variable=]
240 | static const struct oid_obj_priv oid_rtl_seg_81_80_40[] = {
|                                  ^~~~~~~~~~~~~~~~~~~~
drivers/staging/rtl8712/rtl871x_mp_ioctl.h:205:34: warning: 'oid_rtl_seg_81_80_20' defined but not used [-Wunused-const-variable=]
205 | static const struct oid_obj_priv oid_rtl_seg_81_80_20[] = {
|                                  ^~~~~~~~~~~~~~~~~~~~
drivers/staging/rtl8712/rtl871x_mp_ioctl.h:138:34: warning: 'oid_rtl_seg_81_80_00' defined but not used [-Wunused-const-variable=]
138 | static const struct oid_obj_priv oid_rtl_seg_81_80_00[] = {
|                                  ^~~~~~~~~~~~~~~~~~~~

vim +24 drivers/staging/rtl8712/basic_types.h

    21	
    22	#define SIZE_T __kernel_size_t
    23	#define sint signed int
  > 24	#define FIELD_OFFSET(s, field)	((addr_t)&(((s) *)(0))->(field))
    25	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 25850 bytes --]

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

* Re: [PATCH v2] Staging: rtl8712: Addressed checkpatch.pl issues related to macro parameter wrapping in parentheses.
  2020-06-14 17:31 [PATCH v2] Staging: rtl8712: Addressed checkpatch.pl issues related to macro parameter wrapping in parentheses Ricardo Ferreira
  2020-06-15  1:42 ` kernel test robot
@ 2020-06-15 12:36 ` Greg Kroah-Hartman
  1 sibling, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2020-06-15 12:36 UTC (permalink / raw)
  To: Ricardo Ferreira
  Cc: Larry Finger, devel, Florian Schilhabel, linux-kernel,
	Nishka Dasgupta, Dan Carpenter

On Sun, Jun 14, 2020 at 06:31:46PM +0100, Ricardo Ferreira wrote:
> Attempting to wet my feet in kernel patch submission by submitting a checkstyle
> fix for the rtl8712 driver.
> 
> Signed-off-by: Ricardo Ferreira <rikajff@gmail.com>
> ---

What changed from v1?

Always put that below the --- line, so please fix this up and do a v3.

Also, your changelog text is very odd, do you see other commits in the
kernel for these files that say things that way?  Please try to follow
how others do things.  Also read the documentation for how to make a
good changelog text, that will help out a lot.

thanks,

greg k-h

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

end of thread, other threads:[~2020-06-15 12:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-14 17:31 [PATCH v2] Staging: rtl8712: Addressed checkpatch.pl issues related to macro parameter wrapping in parentheses Ricardo Ferreira
2020-06-15  1:42 ` kernel test robot
2020-06-15 12:36 ` Greg Kroah-Hartman

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