* [PATCH] staging: rtl8712: efuse: code style - avoid macro argument precedence issues
@ 2022-04-11 6:41 aliya-rahmani
2022-04-11 6:47 ` Julia Lawall
0 siblings, 1 reply; 3+ messages in thread
From: aliya-rahmani @ 2022-04-11 6:41 UTC (permalink / raw)
To: outreachy; +Cc: florian.c.schilhabel, gregkh, linux-staging, 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
Signed-off-by: aliya-rahmani <aliyarahmani786@gmail.com>
---
drivers/staging/rtl8712/rtl8712_efuse.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/rtl8712/rtl8712_efuse.h b/drivers/staging/rtl8712/rtl8712_efuse.h
index 4969d307e978..2e1ea9d7a295 100644
--- a/drivers/staging/rtl8712/rtl8712_efuse.h
+++ b/drivers/staging/rtl8712/rtl8712_efuse.h
@@ -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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: rtl8712: efuse: code style - avoid macro argument precedence issues
2022-04-11 6:41 [PATCH] staging: rtl8712: efuse: code style - avoid macro argument precedence issues aliya-rahmani
@ 2022-04-11 6:47 ` Julia Lawall
2022-04-11 11:02 ` [PATCH v2] " aliya-rahmani
0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2022-04-11 6:47 UTC (permalink / raw)
To: aliya-rahmani; +Cc: outreachy, florian.c.schilhabel, gregkh, linux-staging
On Mon, 11 Apr 2022, aliya-rahmani wrote:
> 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.
>
> Signed-off-by: aliya-rahmani <aliyarahmani786@gmail.com>
This could be better as:
Aliya Rahmani <aliyarahmani786@gmail.com>
julia
> ---
> drivers/staging/rtl8712/rtl8712_efuse.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/rtl8712/rtl8712_efuse.h b/drivers/staging/rtl8712/rtl8712_efuse.h
> index 4969d307e978..2e1ea9d7a295 100644
> --- a/drivers/staging/rtl8712/rtl8712_efuse.h
> +++ b/drivers/staging/rtl8712/rtl8712_efuse.h
> @@ -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
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2] staging: rtl8712: efuse: code style - avoid macro argument precedence issues
2022-04-11 6:47 ` Julia Lawall
@ 2022-04-11 11:02 ` aliya-rahmani
0 siblings, 0 replies; 3+ messages in thread
From: aliya-rahmani @ 2022-04-11 11:02 UTC (permalink / raw)
To: outreachy; +Cc: gegkh, linux-staging, Aliya Rahmani
From: Aliya Rahmani <aliyarahmani786@gmail.com>
Added parentheses in 'offset' and 'word_en' to avoid macro argument
precedence issues.
Signed-off-by: Aliya Rahmani <aliyarahmani786@gmail.com>
---
drivers/staging/rtl8712/rtl8712_efuse.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/rtl8712/rtl8712_efuse.h b/drivers/staging/rtl8712/rtl8712_efuse.h
index 4969d307e978..2e1ea9d7a295 100644
--- a/drivers/staging/rtl8712/rtl8712_efuse.h
+++ b/drivers/staging/rtl8712/rtl8712_efuse.h
@@ -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
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-04-11 11:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-11 6:41 [PATCH] staging: rtl8712: efuse: code style - avoid macro argument precedence issues aliya-rahmani
2022-04-11 6:47 ` Julia Lawall
2022-04-11 11:02 ` [PATCH v2] " aliya-rahmani
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox