public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: David Lechner <dlechner@baylibre.com>
Cc: "Linus Walleij" <linus.walleij@linaro.org>,
	"Bartosz Golaszewski" <brgl@bgdev.pl>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Geert Uytterhoeven" <geert@linux-m68k.org>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Ulf Hansson" <ulf.hansson@linaro.org>,
	"Peter Rosin" <peda@axentia.se>, "Andrew Lunn" <andrew@lunn.ch>,
	"Heiner Kallweit" <hkallweit1@gmail.com>,
	"Russell King" <linux@armlinux.org.uk>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Vinod Koul" <vkoul@kernel.org>,
	"Kishon Vijay Abraham I" <kishon@kernel.org>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Jaroslav Kysela" <perex@perex.cz>,
	"Takashi Iwai" <tiwai@suse.com>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-iio@vger.kernel.org, linux-mmc@vger.kernel.org,
	netdev@vger.kernel.org, linux-phy@lists.infradead.org,
	linux-sound@vger.kernel.org,
	"Jonathan Cameron" <Jonathan.Cameron@huawei.com>
Subject: Re: [PATCH v3 07/15] iio: adc: ad7606: use gpiod_multi_set_value_cansleep
Date: Mon, 17 Feb 2025 13:18:45 +0000	[thread overview]
Message-ID: <20250217131845.17af66a4@jic23-huawei> (raw)
In-Reply-To: <20250210-gpio-set-array-helper-v3-7-d6a673674da8@baylibre.com>

On Mon, 10 Feb 2025 16:33:33 -0600
David Lechner <dlechner@baylibre.com> wrote:

> Reduce verbosity by using gpiod_multi_set_value_cansleep() instead of
> gpiod_set_array_value().
> 
> These are not called in an atomic context, so changing to the cansleep
> variant is fine.
> 
> Also drop unnecessary braces while we are at it.
> 
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: David Lechner <dlechner@baylibre.com>
I've applied this to the IIO tree now but won't push out as anything other than
testing until Bartosz has dropped it. (thanks for doing that btw!)

Due to code movement it ends up being all in ad7606.c

diff --git a/drivers/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c
index 1e8b03a518b8..87908cc51e48 100644
--- a/drivers/iio/adc/ad7606.c
+++ b/drivers/iio/adc/ad7606.c
@@ -828,8 +828,7 @@ static int ad7606_write_os_hw(struct iio_dev *indio_dev, int val)
 
        values[0] = val & GENMASK(2, 0);
 
-       gpiod_set_array_value(st->gpio_os->ndescs, st->gpio_os->desc,
-                             st->gpio_os->info, values);
+       gpiod_multi_set_value_cansleep(st->gpio_os, values);
 
        /* AD7616 requires a reset to update value */
        if (st->chip_info->os_req_reset)
@@ -1260,10 +1259,9 @@ static int ad7606b_sw_mode_setup(struct iio_dev *indio_dev)
         * in the device tree, then they need to be set to high,
         * otherwise, they must be hardwired to VDD
         */
-       if (st->gpio_os) {
-               gpiod_set_array_value(st->gpio_os->ndescs, st->gpio_os->desc,
-                                     st->gpio_os->info, os);
-       }
+       if (st->gpio_os)
+               gpiod_multi_set_value_cansleep(st->gpio_os, os);
+
        /* OS of 128 and 256 are available only in software mode */
        st->oversampling_avail = ad7606b_oversampling_avail;
        st->num_os_ratios = ARRAY_SIZE(ad7606b_oversampling_avail);


> ---
>  drivers/iio/adc/ad7606.c     | 3 +--
>  drivers/iio/adc/ad7606_spi.c | 7 +++----
>  2 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c
> index d8e3c7a43678c57470a5118715637a68b39125c1..9a124139924e4a4fbbbd234a8514eb77024442b3 100644
> --- a/drivers/iio/adc/ad7606.c
> +++ b/drivers/iio/adc/ad7606.c
> @@ -818,8 +818,7 @@ static int ad7606_write_os_hw(struct iio_dev *indio_dev, int val)
>  
>  	values[0] = val & GENMASK(2, 0);
>  
> -	gpiod_set_array_value(st->gpio_os->ndescs, st->gpio_os->desc,
> -			      st->gpio_os->info, values);
> +	gpiod_multi_set_value_cansleep(st->gpio_os, values);
>  
>  	/* AD7616 requires a reset to update value */
>  	if (st->chip_info->os_req_reset)
> diff --git a/drivers/iio/adc/ad7606_spi.c b/drivers/iio/adc/ad7606_spi.c
> index e2c1475257065c98bf8e2512bda921d6d88a3002..091f31edb6604da3a8ec4d2d5328ac6550faa22c 100644
> --- a/drivers/iio/adc/ad7606_spi.c
> +++ b/drivers/iio/adc/ad7606_spi.c
> @@ -296,10 +296,9 @@ static int ad7606B_sw_mode_config(struct iio_dev *indio_dev)
>  	 * in the device tree, then they need to be set to high,
>  	 * otherwise, they must be hardwired to VDD
>  	 */
> -	if (st->gpio_os) {
> -		gpiod_set_array_value(st->gpio_os->ndescs,
> -				      st->gpio_os->desc, st->gpio_os->info, os);
> -	}
> +	if (st->gpio_os)
> +		gpiod_multi_set_value_cansleep(st->gpio_os, os);
> +
>  	/* OS of 128 and 256 are available only in software mode */
>  	st->oversampling_avail = ad7606B_oversampling_avail;
>  	st->num_os_ratios = ARRAY_SIZE(ad7606B_oversampling_avail);
> 


  reply	other threads:[~2025-02-17 13:19 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-10 22:33 [PATCH v3 00/15] gpiolib: add gpiod_multi_set_value_cansleep David Lechner
2025-02-10 22:33 ` [PATCH v3 01/15] gpiolib: add gpiod_multi_set_value_cansleep() David Lechner
2025-02-11  7:35   ` Geert Uytterhoeven
2025-02-11  9:39   ` Andy Shevchenko
2025-02-14  9:22   ` Linus Walleij
2025-02-10 22:33 ` [PATCH v3 02/15] auxdisplay: seg-led-gpio: use gpiod_multi_set_value_cansleep David Lechner
2025-02-12 10:51   ` Andy Shevchenko
2025-02-10 22:33 ` [PATCH v3 03/15] bus: ts-nbus: validate ts,data-gpios array size David Lechner
2025-02-10 22:33 ` [PATCH v3 04/15] bus: ts-nbus: use gpiod_multi_set_value_cansleep David Lechner
2025-02-10 22:33 ` [PATCH v3 05/15] bus: ts-nbus: use bitmap_get_value8() David Lechner
2025-02-11  9:40   ` Andy Shevchenko
2025-02-20 10:17   ` Simon Horman
2025-02-20 12:06     ` Andy Shevchenko
2025-02-20 17:16       ` David Lechner
2025-02-20 17:32     ` David Lechner
2025-02-21  9:24       ` Simon Horman
2025-02-10 22:33 ` [PATCH v3 06/15] gpio: max3191x: use gpiod_multi_set_value_cansleep David Lechner
2025-02-11  9:42   ` Andy Shevchenko
2025-02-10 22:33 ` [PATCH v3 07/15] iio: adc: ad7606: " David Lechner
2025-02-17 13:18   ` Jonathan Cameron [this message]
2025-02-10 22:33 ` [PATCH v3 08/15] iio: amplifiers: hmc425a: " David Lechner
2025-02-10 22:33 ` [PATCH v3 09/15] iio: resolver: ad2s1210: " David Lechner
2025-02-10 22:33 ` [PATCH v3 10/15] iio: resolver: ad2s1210: use bitmap_write David Lechner
2025-02-11 19:46   ` Jonathan Cameron
2025-02-20 20:54   ` David Lechner
2025-02-22 11:38     ` Jonathan Cameron
2025-02-22 11:51     ` Jonathan Cameron
2025-02-10 22:33 ` [PATCH v3 11/15] mmc: pwrseq_simple: use gpiod_multi_set_value_cansleep David Lechner
2025-02-10 22:33 ` [PATCH v3 12/15] mux: gpio: " David Lechner
2025-02-10 22:33 ` [PATCH v3 13/15] net: mdio: mux-gpio: " David Lechner
2025-02-10 22:33 ` [PATCH v3 14/15] phy: mapphone-mdm6600: " David Lechner
2025-02-13 17:21   ` Vinod Koul
2025-02-10 22:33 ` [PATCH v3 15/15] ASoC: adau1701: " David Lechner
2025-02-12  9:36 ` (subset) [PATCH v3 00/15] gpiolib: add gpiod_multi_set_value_cansleep Bartosz Golaszewski
2025-02-12  9:36 ` Bartosz Golaszewski
2025-02-13 17:25   ` David Lechner
2025-02-13 17:37     ` Andy Shevchenko
2025-02-13 17:42     ` Bartosz Golaszewski
2025-02-13 17:52       ` Mark Brown
2025-02-13 17:58         ` Bartosz Golaszewski
2025-02-13 18:04           ` Mark Brown
2025-02-13 18:26 ` Mark Brown
2025-02-14 10:20 ` Bartosz Golaszewski
2025-02-14 14:35   ` Andy Shevchenko
2025-02-14 14:37     ` Bartosz Golaszewski
2025-02-16 14:23       ` Jonathan Cameron
2025-02-16 15:55         ` Bartosz Golaszewski
2025-02-17 13:11           ` Jonathan Cameron
2025-02-17 13:24             ` Bartosz Golaszewski
2025-02-17 13:21 ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250217131845.17af66a4@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=andrew@lunn.ch \
    --cc=andy@kernel.org \
    --cc=brgl@bgdev.pl \
    --cc=broonie@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dlechner@baylibre.com \
    --cc=edumazet@google.com \
    --cc=geert@linux-m68k.org \
    --cc=hkallweit1@gmail.com \
    --cc=kishon@kernel.org \
    --cc=kuba@kernel.org \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=pabeni@redhat.com \
    --cc=peda@axentia.se \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --cc=ulf.hansson@linaro.org \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox