From: "Andrew F. Davis" <afd@ti.com>
To: Axel Lin <axel.lin@ingics.com>, Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>, linux-gpio@vger.kernel.org
Subject: Re: [PATCH] gpio: pisosr: Use devm_gpiod_get_optional for gpio->load_gpio
Date: Mon, 22 Feb 2016 09:43:45 -0600 [thread overview]
Message-ID: <56CB2CB1.3080201@ti.com> (raw)
In-Reply-To: <1456143411.23008.1.camel@ingics.com>
On 02/22/2016 06:16 AM, Axel Lin wrote:
> gpio->load_gpio is optional, so use devm_gpiod_get_optional instead.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
> drivers/gpio/gpio-pisosr.c | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpio/gpio-pisosr.c b/drivers/gpio/gpio-pisosr.c
> index f9f1074..8b8bf8f 100644
> --- a/drivers/gpio/gpio-pisosr.c
> +++ b/drivers/gpio/gpio-pisosr.c
> @@ -125,15 +125,12 @@ static int pisosr_gpio_probe(struct spi_device *spi)
> if (!gpio->buffer)
> return -ENOMEM;
>
> - gpio->load_gpio = devm_gpiod_get(dev, "load", GPIOD_OUT_LOW);
> + gpio->load_gpio = devm_gpiod_get_optional(dev, "load", GPIOD_OUT_LOW);
> if (IS_ERR(gpio->load_gpio)) {
> ret = PTR_ERR(gpio->load_gpio);
> - if (ret != -ENOENT && ret != -ENOSYS) {
> - if (ret != -EPROBE_DEFER)
> - dev_err(dev, "Unable to allocate load GPIO\n");
> - return ret;
> - }
> - gpio->load_gpio = NULL;
> + if (ret != -EPROBE_DEFER)
> + dev_err(dev, "Unable to allocate load GPIO\n");
> + return ret;
> }
>
> mutex_init(&gpio->lock);
>
How does this work when the GPIO subsystem is disabled? It looks like
we get will get -ENOSYS and fail probe. The issue is then that
devm_gpiod_get_optional returns an error when it cant get the optional
GPIO in that case, when it should probably just return NULL, I would
think all the optional functions should.
next prev parent reply other threads:[~2016-02-22 15:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-22 12:16 [PATCH] gpio: pisosr: Use devm_gpiod_get_optional for gpio->load_gpio Axel Lin
2016-02-22 15:43 ` Andrew F. Davis [this message]
2016-02-23 1:09 ` Axel Lin
2016-02-23 13:48 ` Andrew F. Davis
2016-02-25 13:17 ` Linus Walleij
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=56CB2CB1.3080201@ti.com \
--to=afd@ti.com \
--cc=axel.lin@ingics.com \
--cc=gnurou@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.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.