public inbox for linux-gpio@vger.kernel.org
 help / color / mirror / Atom feed
From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Michael Tretter <m.tretter@pengutronix.de>,
	Linus Walleij <linusw@kernel.org>,
	Bartosz Golaszewski <brgl@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>
Cc: linux-gpio@vger.kernel.org, kernel@pengutronix.de,
	Stefan Kerkmann <s.kerkmann@pengutronix.de>
Subject: Re: [PATCH 1/2] gpiolib: introduce devm_fwnode_gpiod_get_optional() wrapper
Date: Mon, 26 Jan 2026 09:17:15 +0200	[thread overview]
Message-ID: <c694399e-4151-431f-9eec-cc006abdb968@gmail.com> (raw)
In-Reply-To: <20260123-gpio-devm_fwnode_gpiod_get_optional-v1-1-fb49905452a6@pengutronix.de>

On 23/01/2026 11:51, Michael Tretter wrote:
> From: Stefan Kerkmann <s.kerkmann@pengutronix.de>
> 
> The helper makes it easier to handle optional GPIOs and simplifies the
> error handling code.
> 
> Signed-off-by: Stefan Kerkmann <s.kerkmann@pengutronix.de>
> Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
> ---
>   include/linux/gpio/consumer.h | 17 +++++++++++++++++
>   1 file changed, 17 insertions(+)
> 
> diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
> index cafeb7a40ad1..9328b67e26c0 100644
> --- a/include/linux/gpio/consumer.h
> +++ b/include/linux/gpio/consumer.h
> @@ -607,6 +607,23 @@ struct gpio_desc *devm_fwnode_gpiod_get(struct device *dev,
>   					   flags, label);
>   }
>   
> +static inline
> +struct gpio_desc *devm_fwnode_gpiod_get_optional(struct device *dev,
> +						 struct fwnode_handle *fwnode,
> +						 const char *con_id,
> +						 enum gpiod_flags flags,
> +						 const char *label)

I would like to see the kerneldoc for this. Other than that, it looks 
great to me.

> +{
> +	struct gpio_desc *desc;
> +
> +	desc = devm_fwnode_gpiod_get_index(dev, fwnode, con_id, 0,
> +					   flags, label);
> +	if (IS_ERR(desc) && PTR_ERR(desc) == -ENOENT)
> +		return NULL;
> +
> +	return desc;
> +}
> +
>   struct acpi_gpio_params {
>   	unsigned int crs_entry_index;
>   	unsigned short line_index;
> 

Yours,
	-- Matti


-- 
---
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~

  reply	other threads:[~2026-01-26  7:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-23  9:51 [PATCH 0/2] gpiolib: introduce devm_fwnode_gpiod_get_optional Michael Tretter
2026-01-23  9:51 ` [PATCH 1/2] gpiolib: introduce devm_fwnode_gpiod_get_optional() wrapper Michael Tretter
2026-01-26  7:17   ` Matti Vaittinen [this message]
2026-01-23  9:51 ` [PATCH 2/2] regulator: bd71815: switch to devm_fwnode_gpiod_get_optional Michael Tretter
2026-01-26  7:18   ` Matti Vaittinen
2026-01-26 12:08   ` Mark Brown
2026-01-26 13:50 ` [PATCH 0/2] gpiolib: introduce devm_fwnode_gpiod_get_optional Bartosz Golaszewski
2026-01-26 14:01   ` Mark Brown
2026-01-26 15:14     ` Bartosz Golaszewski
2026-01-26 15:20       ` Mark Brown
2026-01-27  9:13         ` Bartosz Golaszewski
2026-01-26 14:30   ` Michael Tretter

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=c694399e-4151-431f-9eec-cc006abdb968@gmail.com \
    --to=mazziesaccount@gmail.com \
    --cc=brgl@kernel.org \
    --cc=broonie@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=lgirdwood@gmail.com \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=m.tretter@pengutronix.de \
    --cc=s.kerkmann@pengutronix.de \
    /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