staging: rtl8712: efuse: code style - avoid macro argument precedence issues
PATCH 1/1 staging: rtl8712: efuse: code style - avoid macro argument precedence issues
This patch fixes the following checkpatch.pl check:
CHECK: Macro argument 'offset' and 'word_en' may be better as '(offset)' and 'word_en' to avoid precedence issues
--- drivers/staging/rtl8712/rtl8712_efuse.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8712/rtl8712_efuse.h +2 -2
@@ -15,8 +15,8 @@#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 MAKE_EFUSE_HEADER (offset, word_en) ((((offset) & 0x0F) << 4) | \ + ((word_en) & 0x0F))/*--------------------------------------------------------------------------*/ struct PGPKT_STRUCT {u8 offset;
Signature · 1 line
2.25.1
Quoted 2 lines · aliya-rahmani
This patch fixes the following checkpatch.pl check:
CHECK: Macro argument 'offset' and 'word_en' may be better as '(offset)' and 'word_en' to avoid precedence issues
Your messages say "avoid" and "fix", but they don't explicitly say what you do.
Quoted 2 lines
Signed-off-by aliya-rahmani <[email protected]>
This could be better as:
Aliya Rahmani <[email protected]>
julia
Quoted 24 lines
--- drivers/staging/rtl8712/rtl8712_efuse.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/rtl8712/rtl8712_efuse.h +2
-3@@ -15,8 +15,8 @@#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 MAKE_EFUSE_HEADER (offset, word_en) ((((offset) & 0x0F) << 4) | \ + ((word_en) & 0x0F))/*--------------------------------------------------------------------------*/ struct PGPKT_STRUCT {u8 offset; --2.25.1
PATCH v2 1/1 staging: rtl8712: efuse: code style - avoid macro argument precedence issues
From: Aliya Rahmani <[email protected]>
Added parentheses in 'offset' and 'word_en' to avoid macro argument precedence issues.
--- drivers/staging/rtl8712/rtl8712_efuse.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8712/rtl8712_efuse.h +2 -2
@@ -15,8 +15,8 @@#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 MAKE_EFUSE_HEADER (offset, word_en) ((((offset) & 0x0F) << 4) | \ + ((word_en) & 0x0F))/*--------------------------------------------------------------------------*/ struct PGPKT_STRUCT {u8 offset;
Signature · 1 line
2.25.1
Quoted 27 lines · aliya-rahmani
From: Aliya Rahmani <[email protected]>
Added parentheses in 'offset' and '
word_en' to avoid macro argument precedence issues.Signed-off-by Aliya Rahmani <[email protected]>--- drivers/staging/rtl8712/rtl8712_efuse.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/rtl8712/rtl8712_efuse.h +2
-3@@ -15,8 +15,8 @@#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 MAKE_EFUSE_HEADER (offset, word_en) ((((offset) & 0x0F) << 4) | \ + ((word_en) & 0x0F))/*--------------------------------------------------------------------------*/ struct PGPKT_STRUCT {u8 offset; --
Quoted 2 lines
2.25.1
Should I make some more changes to the subject line? Also, should I create a v2 patch for the changes?
Thanks,
Aliya
Quoted 18 lines · Aliya
Quoted 17 lines · aliya-rahmani
From: Aliya Rahmani <[email protected]>
Added parentheses in 'offset' and '
word_en' to avoid macro argument precedence issues.Signed-off-by Aliya Rahmani <[email protected]>--- drivers/staging/rtl8712/rtl8712_efuse.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/rtl8712/rtl8712_efuse.h +0
-0@@ -15,8 +15,8 @@
Quoted 14 lines
Quoted 10 lines
drivers/staging/rtl8712/rtl8712_efuse.h +2
-3#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 MAKE_EFUSE_HEADER (offset, word_en) ((((offset) & 0x0F) << 4) | \ + ((word_en) & 0x0F))/*--------------------------------------------------------------------------*/ struct PGPKT_STRUCT {u8 offset; --Quoted 2 lines
2.25.1
Should I make some more changes to the subject line? Also, should I create a v2 patch for the changes?
Each time you change a patch, you should increase the version number and put an explanation of the change since the previous version under the ---
If you need to snd a new version to respect this, then I would say "parentheses around" rather than "parentheses in", also I would say "macro arguments 'offset' and 'word_en'" to explain why the change is needed.
Finally, you should still mention that the problem was found using checkpatch, but it is not necessary to include the checkpatch warning message.
julia