Re: [PATCH 07/15] iio: addac: ad74413r: fix the values of set_multiple

From: Nuno Sá

Date: Wed Oct 28 2026 - 05:39:27 EST


On Tue, Oct 27, 2026 at 05:19:11PM +0100, Greg Kroah-Hartman wrote:
> From: Josef Bacik <josef@xxxxxxxxxxxxxx>
>
> ad74413r_gpio_set_multiple() walks over the lines in the mask and looks up
> the new value of each with
>
> if (*bits & offset)
>
> offset is the number of the line, not a bit mask. Line 0 is always driven
> low, line 1 gets the value meant for line 0, line 2 the one meant for line
> 1, and line 3 is driven high if either of these two is.
>
> Test the bit which belongs to the line.
>
> Fixes: fea251b6a5db ("iio: addac: add AD74413R driver")
> Cc: stable <stable@xxxxxxxxxx>
> Cc: Marcelo Schmitt <marcelo.schmitt@xxxxxxxxxx>
> Cc: Antoniu Miclaus <antoniu.miclaus@xxxxxxxxxx>
> Cc: "Nuno Sá" <nuno.sa@xxxxxxxxxx>
> Cc: Michael Hennerich <Michael.Hennerich@xxxxxxxxxx>
> Cc: David Lechner <dlechner@xxxxxxxxxxxx>
> Cc: Andy Shevchenko <andy@xxxxxxxxxx>
> Cc: Linus Walleij <linusw@xxxxxxxxxx>
> Cc: Bartosz Golaszewski <brgl@xxxxxxxxxx>
> Cc: Cosmin Tanislav <demonsingur@xxxxxxxxx>
> Signed-off-by: Josef Bacik <josef@xxxxxxxxxxxxxx>
> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> ---

Reviewed-by: Nuno Sá <nuno.sa@xxxxxxxxxx>

> drivers/iio/addac/ad74413r.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/addac/ad74413r.c b/drivers/iio/addac/ad74413r.c
> index 2e5a58e48a89..20db890d958b 100644
> --- a/drivers/iio/addac/ad74413r.c
> +++ b/drivers/iio/addac/ad74413r.c
> @@ -312,7 +312,7 @@ static int ad74413r_gpio_set_multiple(struct gpio_chip *chip,
> return ret;
>
> real_mask |= BIT(real_offset);
> - if (*bits & offset)
> + if (test_bit(offset, bits))
> real_bits |= BIT(real_offset);
> }
>
>
> --
> 2.56.0
>