[PATCH v2 07/13] iio: amplifiers: hmc425a: use gpiod_multi_set_value_cansleep

David Lechner posted 13 patches 1 year ago
There is a newer version of this series
[PATCH v2 07/13] iio: amplifiers: hmc425a: use gpiod_multi_set_value_cansleep
Posted by David Lechner 1 year ago
Reduce verbosity by using gpiod_multi_set_value_cansleep() instead of
gpiod_set_array_value_cansleep().

Passing NULL as the 3rd argument to gpiod_set_array_value_cansleep()
only needs to be done if the array was constructed manually, which is
not the case here. This change effectively replaces that argument with
st->gpios->array_info. The possible side effect of this change is that
it could make setting the GPIOs more efficient.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: David Lechner <dlechner@baylibre.com>
---
 drivers/iio/amplifiers/hmc425a.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/iio/amplifiers/hmc425a.c b/drivers/iio/amplifiers/hmc425a.c
index 2ee4c0d70281e24c1c818249b86d89ebe06d4876..d9a359e1388a0f3eb5909bf668ff82102286542b 100644
--- a/drivers/iio/amplifiers/hmc425a.c
+++ b/drivers/iio/amplifiers/hmc425a.c
@@ -161,8 +161,7 @@ static int hmc425a_write(struct iio_dev *indio_dev, u32 value)
 
 	values[0] = value;
 
-	gpiod_set_array_value_cansleep(st->gpios->ndescs, st->gpios->desc,
-				       NULL, values);
+	gpiod_multi_set_value_cansleep(st->gpios, values);
 	return 0;
 }
 

-- 
2.43.0
Re: [PATCH v2 07/13] iio: amplifiers: hmc425a: use gpiod_multi_set_value_cansleep
Posted by Jonathan Cameron 12 months ago
On Thu, 06 Feb 2025 16:48:21 -0600
David Lechner <dlechner@baylibre.com> wrote:

> Reduce verbosity by using gpiod_multi_set_value_cansleep() instead of
> gpiod_set_array_value_cansleep().
> 
> Passing NULL as the 3rd argument to gpiod_set_array_value_cansleep()
> only needs to be done if the array was constructed manually, which is
> not the case here. This change effectively replaces that argument with
> st->gpios->array_info. The possible side effect of this change is that
> it could make setting the GPIOs more efficient.
> 
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: David Lechner <dlechner@baylibre.com>
If it goes through the gpio tree
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> ---
>  drivers/iio/amplifiers/hmc425a.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/amplifiers/hmc425a.c b/drivers/iio/amplifiers/hmc425a.c
> index 2ee4c0d70281e24c1c818249b86d89ebe06d4876..d9a359e1388a0f3eb5909bf668ff82102286542b 100644
> --- a/drivers/iio/amplifiers/hmc425a.c
> +++ b/drivers/iio/amplifiers/hmc425a.c
> @@ -161,8 +161,7 @@ static int hmc425a_write(struct iio_dev *indio_dev, u32 value)
>  
>  	values[0] = value;
>  
> -	gpiod_set_array_value_cansleep(st->gpios->ndescs, st->gpios->desc,
> -				       NULL, values);
> +	gpiod_multi_set_value_cansleep(st->gpios, values);
>  	return 0;
>  }
>  
>