Re: [PATCH 2/4] Staging: ks7010: hostif: Fix multiple use of arguments in SME queue macros.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 16, 2018 at 06:25:01PM -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@xxxxxxxxxxx>
> ---
>  drivers/staging/ks7010/ks_hostif.c | 19 +++++++++++++------
>  1 file changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
> index 975dbbb3abd0..30c9592b3a00 100644
> --- a/drivers/staging/ks7010/ks_hostif.c
> +++ b/drivers/staging/ks7010/ks_hostif.c
> @@ -22,12 +22,19 @@
>  #include <net/iw_handler.h>	/* New driver API */
>  
>  /* macro */
> -#define inc_smeqhead(priv) \
> -	(priv->sme_i.qhead = (priv->sme_i.qhead + 1) % SME_EVENT_BUFF_SIZE)
> -#define inc_smeqtail(priv) \
> -	(priv->sme_i.qtail = (priv->sme_i.qtail + 1) % SME_EVENT_BUFF_SIZE)
> -#define cnt_smeqbody(priv) \
> -	(((priv->sme_i.qtail + SME_EVENT_BUFF_SIZE) - (priv->sme_i.qhead)) % SME_EVENT_BUFF_SIZE)
> +#define inc_smeqhead(priv)						\
> +	({ typeof(priv) priv_ = (priv);					\
> +		unsigned int next_qhead = priv_->sme_i.qhead + 1;	\
> +		priv_->sme_i.qhead = next_qhead % SME_EVENT_BUFF_SIZE; })

No need, just make these real functions please.

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux