From: Greg KH <gregkh@linuxfoundation.org>
To: Quytelda Kahja <quytelda@tamalin.org>
Cc: devel@driverdev.osuosl.org,
driverdev-devel@linuxdriverproject.org,
linux-kernel@vger.kernel.org, wsa@the-dreams.de
Subject: Re: [PATCH 3/4] Staging: ks7010: hostif: Fix multiple use of arguments in rate and event masking macros.
Date: Mon, 19 Feb 2018 18:12:05 +0100 [thread overview]
Message-ID: <20180219171205.GB3632@kroah.com> (raw)
In-Reply-To: <20180217022503.24982-2-quytelda@tamalin.org>
On Fri, Feb 16, 2018 at 06:25:02PM -0800, Quytelda Kahja wrote:
> Use GCC extensions to prevent macro arguments from accidentally being evaluated
> multiple times when the macro is called.
>
> Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
> ---
> drivers/staging/ks7010/ks_hostif.h | 74 +++++++++++++++++++++++++-------------
> 1 file changed, 50 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h
> index 5bae8d468e23..750ac86cee77 100644
> --- a/drivers/staging/ks7010/ks_hostif.h
> +++ b/drivers/staging/ks7010/ks_hostif.h
> @@ -599,19 +599,39 @@ struct hostif_mic_failure_confirm_t {
> #define TX_RATE_48M (uint8_t)(480 / 5)
> #define TX_RATE_54M (uint8_t)(540 / 5)
>
> -#define IS_11B_RATE(A) (((A & RATE_MASK) == TX_RATE_1M) || ((A & RATE_MASK) == TX_RATE_2M) || \
> - ((A & RATE_MASK) == TX_RATE_5M) || ((A & RATE_MASK) == TX_RATE_11M))
> -
> -#define IS_OFDM_RATE(A) (((A & RATE_MASK) == TX_RATE_6M) || ((A & RATE_MASK) == TX_RATE_12M) || \
> - ((A & RATE_MASK) == TX_RATE_24M) || ((A & RATE_MASK) == TX_RATE_9M) || \
> - ((A & RATE_MASK) == TX_RATE_18M) || ((A & RATE_MASK) == TX_RATE_36M) || \
> - ((A & RATE_MASK) == TX_RATE_48M) || ((A & RATE_MASK) == TX_RATE_54M))
> -
> -#define IS_11BG_RATE(A) (IS_11B_RATE(A) || IS_OFDM_RATE(A))
> -
> -#define IS_OFDM_EXT_RATE(A) (((A & RATE_MASK) == TX_RATE_9M) || ((A & RATE_MASK) == TX_RATE_18M) || \
> - ((A & RATE_MASK) == TX_RATE_36M) || ((A & RATE_MASK) == TX_RATE_48M) || \
> - ((A & RATE_MASK) == TX_RATE_54M))
> +#define IS_11B_RATE(A) \
> + ({ \
> + typeof(A) A_ = (A); \
> + ((A_ & RATE_MASK) == TX_RATE_1M) || \
> + ((A_ & RATE_MASK) == TX_RATE_2M) || \
> + ((A_ & RATE_MASK) == TX_RATE_5M) || \
> + ((A_ & RATE_MASK) == TX_RATE_11M); })
> +
Again, please just make these real functions, if they are actually used.
thanks,
greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
next prev parent reply other threads:[~2018-02-19 17:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-17 2:25 [PATCH 2/4] Staging: ks7010: hostif: Fix multiple use of arguments in SME queue macros Quytelda Kahja
2018-02-17 2:25 ` [PATCH 3/4] Staging: ks7010: hostif: Fix multiple use of arguments in rate and event masking macros Quytelda Kahja
2018-02-19 17:12 ` Greg KH [this message]
2018-02-17 2:25 ` [PATCH 4/4] Staging: ks7010: hostif: Fix multiple use of arguments in ps_confirm_wait_inc() macro Quytelda Kahja
2018-02-19 17:08 ` [PATCH 2/4] Staging: ks7010: hostif: Fix multiple use of arguments in SME queue macros Greg KH
2018-02-20 6:35 ` [PATCH v2 1/3] Staging: ks7010: sdio: Convert RX/TX queue macros into real functions Quytelda Kahja
2018-02-20 6:35 ` [PATCH v2 2/3] Staging: ks7010: hostif: Convert SME queue macros to " Quytelda Kahja
2018-02-20 6:35 ` [PATCH v2 3/3] Staging: ks7010: hostif: Convert the ps_confirm_wait_inc() macro to a real function Quytelda Kahja
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=20180219171205.GB3632@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=devel@driverdev.osuosl.org \
--cc=driverdev-devel@linuxdriverproject.org \
--cc=linux-kernel@vger.kernel.org \
--cc=quytelda@tamalin.org \
--cc=wsa@the-dreams.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®