From: David Lechner <dlechner@baylibre.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: "Linus Walleij" <linus.walleij@linaro.org>,
"Bartosz Golaszewski" <brgl@bgdev.pl>,
"Andy Shevchenko" <andy@kernel.org>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"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
Subject: Re: [PATCH v2 01/13] gpiolib: add gpiod_multi_set_value_cansleep()
Date: Fri, 7 Feb 2025 10:29:11 -0600 [thread overview]
Message-ID: <74ec33db-6721-4b86-86a6-e18b0a01fc47@baylibre.com> (raw)
In-Reply-To: <CAMuHMdU5tt5_t2SfYO3OUsHenu_0PhpKeLHktNdCx-W6zCEymw@mail.gmail.com>
On 2/7/25 3:10 AM, Geert Uytterhoeven wrote:
> Hi David,
>
> On Thu, 6 Feb 2025 at 23:48, David Lechner <dlechner@baylibre.com> wrote:
>> Add a new gpiod_multi_set_value_cansleep() helper function with fewer
>> parameters than gpiod_set_array_value_cansleep().
>>
>> Calling gpiod_set_array_value_cansleep() can get quite verbose. In many
>> cases, the first arguments all come from the same struct gpio_descs, so
>> having a separate function where we can just pass that cuts down on the
>> boilerplate.
>>
>> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
>> Signed-off-by: David Lechner <dlechner@baylibre.com>
>
> Thanks for your patch!
>
>> --- a/include/linux/gpio/consumer.h
>> +++ b/include/linux/gpio/consumer.h
>> @@ -655,4 +655,11 @@ static inline void gpiod_unexport(struct gpio_desc *desc)
>>
>> #endif /* CONFIG_GPIOLIB && CONFIG_GPIO_SYSFS */
>>
>> +static inline int gpiod_multi_set_value_cansleep(struct gpio_descs *descs,
>> + unsigned long *value_bitmap)
>> +{
>> + return gpiod_set_array_value_cansleep(descs->ndescs, descs->desc,
>> + descs->info, value_bitmap);
>
> I am wondering whether this needs a check for !IS_ERR_OR_NULL(descs),
> to handle the !CONFIG_GPIOLIB and gpiod_get_array_optional() cases?
I don't think it is strictly needed, but could be convenient for future use
cases. If we add it, should it be:
if (IS_ERR_OR_NULL(descs))
return PTR_ERR(descs);
or:
if (!descs)
return -EINVAL;
if (IS_ERR(descs))
return PTR_ERR(descs);
?
For comparison, gpiod_set_array_value_cansleep() will return -EINVAL if the
first argument is NULL.
>
> Slightly related: shouldn't gpiod_put_array() (both the implementation
> and the !CONFIG_GPIOLIB dummy) allow the caller to pass NULL, to
> streamline the gpiod_get_array_optional() case?
>
>> +}
>> +
>> #endif
>
> Gr{oetje,eeting}s,
>
> Geert
>
WARNING: multiple messages have this Message-ID (diff)
From: David Lechner <dlechner@baylibre.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: "Linus Walleij" <linus.walleij@linaro.org>,
"Bartosz Golaszewski" <brgl@bgdev.pl>,
"Andy Shevchenko" <andy@kernel.org>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"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
Subject: Re: [PATCH v2 01/13] gpiolib: add gpiod_multi_set_value_cansleep()
Date: Fri, 7 Feb 2025 10:29:11 -0600 [thread overview]
Message-ID: <74ec33db-6721-4b86-86a6-e18b0a01fc47@baylibre.com> (raw)
In-Reply-To: <CAMuHMdU5tt5_t2SfYO3OUsHenu_0PhpKeLHktNdCx-W6zCEymw@mail.gmail.com>
On 2/7/25 3:10 AM, Geert Uytterhoeven wrote:
> Hi David,
>
> On Thu, 6 Feb 2025 at 23:48, David Lechner <dlechner@baylibre.com> wrote:
>> Add a new gpiod_multi_set_value_cansleep() helper function with fewer
>> parameters than gpiod_set_array_value_cansleep().
>>
>> Calling gpiod_set_array_value_cansleep() can get quite verbose. In many
>> cases, the first arguments all come from the same struct gpio_descs, so
>> having a separate function where we can just pass that cuts down on the
>> boilerplate.
>>
>> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
>> Signed-off-by: David Lechner <dlechner@baylibre.com>
>
> Thanks for your patch!
>
>> --- a/include/linux/gpio/consumer.h
>> +++ b/include/linux/gpio/consumer.h
>> @@ -655,4 +655,11 @@ static inline void gpiod_unexport(struct gpio_desc *desc)
>>
>> #endif /* CONFIG_GPIOLIB && CONFIG_GPIO_SYSFS */
>>
>> +static inline int gpiod_multi_set_value_cansleep(struct gpio_descs *descs,
>> + unsigned long *value_bitmap)
>> +{
>> + return gpiod_set_array_value_cansleep(descs->ndescs, descs->desc,
>> + descs->info, value_bitmap);
>
> I am wondering whether this needs a check for !IS_ERR_OR_NULL(descs),
> to handle the !CONFIG_GPIOLIB and gpiod_get_array_optional() cases?
I don't think it is strictly needed, but could be convenient for future use
cases. If we add it, should it be:
if (IS_ERR_OR_NULL(descs))
return PTR_ERR(descs);
or:
if (!descs)
return -EINVAL;
if (IS_ERR(descs))
return PTR_ERR(descs);
?
For comparison, gpiod_set_array_value_cansleep() will return -EINVAL if the
first argument is NULL.
>
> Slightly related: shouldn't gpiod_put_array() (both the implementation
> and the !CONFIG_GPIOLIB dummy) allow the caller to pass NULL, to
> streamline the gpiod_get_array_optional() case?
>
>> +}
>> +
>> #endif
>
> Gr{oetje,eeting}s,
>
> Geert
>
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
next prev parent reply other threads:[~2025-02-07 16:29 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-06 22:48 [PATCH v2 00/13] gpiolib: add gpiod_multi_set_value_cansleep David Lechner
2025-02-06 22:48 ` David Lechner
2025-02-06 22:48 ` [PATCH v2 01/13] gpiolib: add gpiod_multi_set_value_cansleep() David Lechner
2025-02-06 22:48 ` David Lechner
2025-02-07 9:10 ` Geert Uytterhoeven
2025-02-07 9:10 ` Geert Uytterhoeven
2025-02-07 16:29 ` David Lechner [this message]
2025-02-07 16:29 ` David Lechner
2025-02-07 16:44 ` Geert Uytterhoeven
2025-02-07 16:44 ` Geert Uytterhoeven
2025-02-06 22:48 ` [PATCH v2 02/13] auxdisplay: seg-led-gpio: use gpiod_multi_set_value_cansleep David Lechner
2025-02-06 22:48 ` David Lechner
2025-02-07 9:04 ` Geert Uytterhoeven
2025-02-07 9:04 ` Geert Uytterhoeven
2025-02-06 22:48 ` [PATCH v2 03/13] bus: ts-nbus: validate ts,data-gpios array size David Lechner
2025-02-06 22:48 ` David Lechner
2025-02-06 22:48 ` [PATCH v2 04/13] bus: ts-nbus: use gpiod_multi_set_value_cansleep David Lechner
2025-02-06 22:48 ` David Lechner
2025-02-07 12:15 ` Andy Shevchenko
2025-02-07 12:15 ` Andy Shevchenko
2025-02-07 12:17 ` Andy Shevchenko
2025-02-07 12:17 ` Andy Shevchenko
2025-02-07 15:23 ` David Lechner
2025-02-07 15:23 ` David Lechner
2025-02-07 15:34 ` Andy Shevchenko
2025-02-07 15:34 ` Andy Shevchenko
2025-02-07 15:43 ` Yury Norov
2025-02-07 15:43 ` Yury Norov
2025-02-06 22:48 ` [PATCH v2 05/13] gpio: max3191x: " David Lechner
2025-02-06 22:48 ` David Lechner
2025-02-07 10:34 ` Andy Shevchenko
2025-02-07 10:34 ` Andy Shevchenko
2025-02-07 15:23 ` David Lechner
2025-02-07 15:23 ` David Lechner
2025-02-06 22:48 ` [PATCH v2 06/13] iio: adc: ad7606: " David Lechner
2025-02-06 22:48 ` David Lechner
2025-02-07 12:13 ` Andy Shevchenko
2025-02-07 12:13 ` Andy Shevchenko
2025-02-08 13:23 ` Jonathan Cameron
2025-02-08 13:23 ` Jonathan Cameron
2025-02-06 22:48 ` [PATCH v2 07/13] iio: amplifiers: hmc425a: " David Lechner
2025-02-06 22:48 ` David Lechner
2025-02-08 13:22 ` Jonathan Cameron
2025-02-08 13:22 ` Jonathan Cameron
2025-02-06 22:48 ` [PATCH v2 08/13] iio: resolver: ad2s1210: " David Lechner
2025-02-06 22:48 ` David Lechner
2025-02-08 13:22 ` Jonathan Cameron
2025-02-08 13:22 ` Jonathan Cameron
2025-02-06 22:48 ` [PATCH v2 09/13] mmc: pwrseq_simple: " David Lechner
2025-02-06 22:48 ` David Lechner
2025-02-06 22:48 ` [PATCH v2 10/13] mux: gpio: " David Lechner
2025-02-06 22:48 ` David Lechner
2025-02-06 22:48 ` [PATCH v2 11/13] net: mdio: mux-gpio: " David Lechner
2025-02-06 22:48 ` David Lechner
2025-02-06 22:48 ` [PATCH v2 12/13] phy: mapphone-mdm6600: " David Lechner
2025-02-06 22:48 ` David Lechner
2025-02-06 22:48 ` [PATCH v2 13/13] ASoC: adau1701: " David Lechner
2025-02-06 22:48 ` David Lechner
2025-02-07 7:49 ` [PATCH v2 00/13] gpiolib: add gpiod_multi_set_value_cansleep Bartosz Golaszewski
2025-02-07 7:49 ` Bartosz Golaszewski
2025-02-07 9:47 ` Ulf Hansson
2025-02-07 9:47 ` Ulf Hansson
2025-02-07 12:20 ` Andy Shevchenko
2025-02-07 12:20 ` Andy Shevchenko
2025-02-08 13:20 ` Jonathan Cameron
2025-02-08 13:20 ` 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=74ec33db-6721-4b86-86a6-e18b0a01fc47@baylibre.com \
--to=dlechner@baylibre.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=edumazet@google.com \
--cc=geert@linux-m68k.org \
--cc=hkallweit1@gmail.com \
--cc=jic23@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.