From: Joe Perches <joe@perches.com>
To: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 3/5] staging: rtl8192e: fix coding style errors (macros in parentheses)
Date: Sun, 15 Mar 2015 21:51:00 -0700 [thread overview]
Message-ID: <1426481460.2678.35.camel@perches.com> (raw)
In-Reply-To: <1426451987-24519-4-git-send-email-mateusz.kulikowski@gmail.com>
On Sun, 2015-03-15 at 21:39 +0100, Mateusz Kulikowski wrote:
> Fix checkpatch.pl errors 'Macros with complex values should be enclosed in parentheses'.
[]
> diff --git a/drivers/staging/rtl8192e/rtl819x_HT.h b/drivers/staging/rtl8192e/rtl819x_HT.h
[]
> @@ -78,7 +78,7 @@ enum chnl_op {
> };
>
> #define CHHLOP_IN_PROGRESS(_pHTInfo) \
> - ((_pHTInfo)->ChnlOp > CHNLOP_NONE) ? true : false
> + (((_pHTInfo)->ChnlOp > CHNLOP_NONE) ? true : false)
This would perhaps be better without the ternary as
the compiler might not optimize the ternary away
#define CHHLOP_IN_PROGRESS(_pHTInfo) \
((_pHTInfo)->ChnOp > CHNLOP_NONE)
This would also probably be better as a static inline
not a macro, but as this is never used it's actually
better just to remove it.
> @@ -385,8 +385,8 @@ extern u8 MCS_FILTER_1SS[16];
> #define LEGACY_WIRELESS_MODE IEEE_MODE_MASK
>
> #define CURRENT_RATE(WirelessMode, LegacyRate, HTRate) \
> - ((WirelessMode & (LEGACY_WIRELESS_MODE)) != 0) ? \
> - (LegacyRate) : (PICK_RATE(LegacyRate, HTRate))
> + (((WirelessMode & (LEGACY_WIRELESS_MODE)) != 0) ? \
> + (LegacyRate) : (PICK_RATE(LegacyRate, HTRate)))
This would be better with the various macro arguments
parenthesized (especially WirelessMode)
#define CURRENT_RATE(WirelessMode, LegacyRate, HTRate) \
(((WirelessMode) & LEGACY_WIRELESS_MODE) ? \
(LegacyRate) : PICK_RATE((LegacyRate), HTRate))
As this is used exactly once, it's probably better
expanded in that one place and the macro removed.
That's true for PICK_RATE as well.
next prev parent reply other threads:[~2015-03-16 4:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-15 20:39 [PATCH v4 0/5] staging: rtl8192e: fix coding style issues Mateusz Kulikowski
2015-03-15 20:39 ` [PATCH v4 1/5] staging: rtl8192e: fix coding style issues (merge broken strings) Mateusz Kulikowski
2015-03-16 15:02 ` Greg KH
2015-03-15 20:39 ` [PATCH v4 2/5] staging: rtl8192e: fix coding style issues (spaces before semicolon) Mateusz Kulikowski
2015-03-15 20:39 ` [PATCH v4 3/5] staging: rtl8192e: fix coding style errors (macros in parentheses) Mateusz Kulikowski
2015-03-16 4:51 ` Joe Perches [this message]
2015-03-16 22:58 ` Mateusz Kulikowski
2015-03-15 20:39 ` [PATCH v4 4/5] staging: rtl8192e: rtllib_wx: remove duplicate messages Mateusz Kulikowski
2015-03-15 20:39 ` [PATCH v4 5/5] staging: rtl8192e: fix coding style warnings (printk -> netdev_*) Mateusz Kulikowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1426481460.2678.35.camel@perches.com \
--to=joe@perches.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mateusz.kulikowski@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.