[PATCH v2 1/2] staging: iio: ad7280a: Add parentheses to macros

Jonathan Cameron jic23 at kernel.org
Sun Mar 24 16:04:55 UTC 2019


On Fri, 22 Mar 2019 00:15:27 +0300
Vladimir Petrigo <vladimir.petrigo at gmail.com> wrote:

> - Fix CHECK Macro argument 'c' may be better as '(c)' to avoid precedence issues
> - Fix CHECK Macro argument 'd' may be better as '(d)' to avoid precedence issues
> 
> Signed-off-by: Vladimir Petrigo <vladimir.petrigo at gmail.com>
Sorry, I ended up taking Cristian's patch for the same issue.

No particular reason other than which email I hit first!

Jonathan

> ---
>  drivers/staging/iio/adc/ad7280a.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c
> index d9df126..98cf876 100644
> --- a/drivers/staging/iio/adc/ad7280a.c
> +++ b/drivers/staging/iio/adc/ad7280a.c
> @@ -97,9 +97,9 @@
>  #define AD7280A_NUM_CH			(AD7280A_AUX_ADC_6 - \
>  					AD7280A_CELL_VOLTAGE_1 + 1)
>  
> -#define AD7280A_CALC_VOLTAGE_CHAN_NUM(d, c) ((d * AD7280A_CELLS_PER_DEV) + c)
> -#define AD7280A_CALC_TEMP_CHAN_NUM(d, c)    ((d * AD7280A_CELLS_PER_DEV) + \
> -					     c - AD7280A_CELLS_PER_DEV)
> +#define AD7280A_CALC_VOLTAGE_CHAN_NUM(d, c) (((d) * AD7280A_CELLS_PER_DEV) + (c))
> +#define AD7280A_CALC_TEMP_CHAN_NUM(d, c)    (((d) * AD7280A_CELLS_PER_DEV) + \
> +					     (c) - AD7280A_CELLS_PER_DEV)
>  
>  #define AD7280A_DEVADDR_MASTER		0
>  #define AD7280A_DEVADDR_ALL		0x1F



More information about the devel mailing list