[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VdsJn0zn8bvS+3h4zaTKKQnyHV7P2BAkyP2EHX=kbmERA@mail.gmail.com>
Date: Sun, 9 Jan 2022 14:07:27 +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 1/3] iio: addac: ad74413r: use ngpio size when iterating
over mask
On Fri, Jan 7, 2022 at 7:34 AM Cosmin Tanislav <demonsingur@...il.com> wrote:
>
> ngpio is the actual number of GPIOs handled by the GPIO chip,
> as opposed to the max number of GPIOs.
Fixes?
> Signed-off-by: Cosmin Tanislav <cosmin.tanislav@...log.com>
> ---
> drivers/iio/addac/ad74413r.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/addac/ad74413r.c b/drivers/iio/addac/ad74413r.c
> index 5271073bb74e..6ea3cd933d05 100644
> --- a/drivers/iio/addac/ad74413r.c
> +++ b/drivers/iio/addac/ad74413r.c
> @@ -288,7 +288,7 @@ static void ad74413r_gpio_set_multiple(struct gpio_chip *chip,
> unsigned int offset = 0;
> int ret;
>
> - for_each_set_bit_from(offset, mask, AD74413R_CHANNEL_MAX) {
> + for_each_set_bit_from(offset, mask, chip->ngpio) {
> unsigned int real_offset = st->gpo_gpio_offsets[offset];
>
> ret = ad74413r_set_gpo_config(st, real_offset,
> @@ -334,7 +334,7 @@ static int ad74413r_gpio_get_multiple(struct gpio_chip *chip,
> if (ret)
> return ret;
>
> - for_each_set_bit_from(offset, mask, AD74413R_CHANNEL_MAX) {
> + for_each_set_bit_from(offset, mask, chip->ngpio) {
> unsigned int real_offset = st->comp_gpio_offsets[offset];
>
> if (val & BIT(real_offset))
> --
> 2.34.1
>
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists