[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VeyJY3K+UgwXqkkRkPRHgbQhbFVRmjrzKb0-xwc=yC2NA@mail.gmail.com>
Date: Tue, 11 Jan 2022 11:21:25 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Cosmin Tanislav <demonsingur@...il.com>
Cc: cosmin.tanislav@...log.com, Lars-Peter Clausen <lars@...afoo.de>,
Michael Hennerich <Michael.Hennerich@...log.com>,
Rob Herring <robh+dt@...nel.org>,
linux-iio <linux-iio@...r.kernel.org>,
devicetree <devicetree@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <brgl@...ev.pl>,
"open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>
Subject: Re: [PATCH v3 2/3] iio: addac: ad74413r: correct comparator gpio
getters mask usage
On Tue, Jan 11, 2022 at 9:47 AM Cosmin Tanislav <demonsingur@...il.com> wrote:
>
> The value of the GPIOs is currently altered using offsets rather
> than masks. Make use of __assign_bit and the BIT macro to turn
> the offsets into masks.
Reviewed-by: Andy Shevchenko <andy.shevchenko@...il.com>
> Fixes: fea251b6a5db ("iio: addac: add AD74413R driver")
> Signed-off-by: Cosmin Tanislav <cosmin.tanislav@...log.com>
> ---
> V1 -> V2
> * add Fixes tag
> * use __assign_bit
> * remove bitmap_zero
>
> V2 -> V3
> * add back line between real_offset declaration and __assign_bit call
> * move before patch 2
> ---
> drivers/iio/addac/ad74413r.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iio/addac/ad74413r.c b/drivers/iio/addac/ad74413r.c
> index 6ea3cd933d05..b13cd5407df3 100644
> --- a/drivers/iio/addac/ad74413r.c
> +++ b/drivers/iio/addac/ad74413r.c
> @@ -134,7 +134,6 @@ struct ad74413r_state {
> #define AD74413R_CH_EN_MASK(x) BIT(x)
>
> #define AD74413R_REG_DIN_COMP_OUT 0x25
> -#define AD74413R_DIN_COMP_OUT_SHIFT_X(x) x
>
> #define AD74413R_REG_ADC_RESULT_X(x) (0x26 + (x))
> #define AD74413R_ADC_RESULT_MAX GENMASK(15, 0)
> @@ -316,7 +315,7 @@ static int ad74413r_gpio_get(struct gpio_chip *chip, unsigned int offset)
> if (ret)
> return ret;
>
> - status &= AD74413R_DIN_COMP_OUT_SHIFT_X(real_offset);
> + status &= BIT(real_offset);
>
> return status ? 1 : 0;
> }
> @@ -337,8 +336,7 @@ static int ad74413r_gpio_get_multiple(struct gpio_chip *chip,
> for_each_set_bit_from(offset, mask, chip->ngpio) {
> unsigned int real_offset = st->comp_gpio_offsets[offset];
>
> - if (val & BIT(real_offset))
> - *bits |= offset;
> + __assign_bit(offset, bits, val & BIT(real_offset));
> }
>
> return ret;
> --
> 2.34.1
>
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists