lkml.org 
[lkml]   [2019]   [Mar]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 3/5] staging: iio: adc: Avoid precedence issues in macro
On Sat, 23 Mar 2019 20:21:42 +0100
Cristian Sicilia <sicilia.cristian@gmail.com> wrote:

> Enclosing parameter with parenthesis due to avoid
> possible precedence issue.
>
> Signed-off-by: Cristian Sicilia <sicilia.cristian@gmail.com>
Applied to the togreg branch of iio.git which will get first
pushed out as testing for the autobuilders to play with it.

Thanks,

Jonathan

> ---
> drivers/staging/iio/adc/ad7280a.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c
> index 55b5879..d81a5bd 100644
> --- a/drivers/staging/iio/adc/ad7280a.c
> +++ b/drivers/staging/iio/adc/ad7280a.c
> @@ -97,9 +97,10 @@
> #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

\
 
 \ /
  Last update: 2019-03-24 13:38    [W:0.092 / U:4.216 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site