Re: [PATCH] gpiolib: of_find_gpio(): Don't discard errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jul 1, 2016 at 5:40 PM, Lars-Peter Clausen <lars@xxxxxxxxxx> wrote:

> Since commit dd34c37aa3e8 ("gpio: of: Allow -gpio suffix for property
> names") when requesting a GPIO from the devicetree gpiolib looks for
> properties with both the '-gpio' and the '-gpios' suffix. This was
> implemented by first searching for the property with the '-gpios' suffix
> and if that yields an error try the '-gpio' suffix. This approach has the
> issue that any error returned when looking for the '-gpios' suffix is
> silently discarded.
>
> Commit 06fc3b70f1dc ("gpio: of: Fix handling for deferred probe for -gpio
> suffix") partially addressed the issue by treating the EPROBE_DEFER error
> as a special condition. This fixed the case when the property is specified,
> but the GPIO provider is not ready yet. But there are other cases in which
> of_get_named_gpiod_flags() returns an error even though the property is
> specified, e.g. if the specification is incorrect.
>
> of_find_gpio() should only try to look for the property with the '-gpio'
> suffix if no property with the '-gpios' suffix was found. If the property
> was not found of_get_named_gpiod_flags() will return -ENOENT, so update the
> condition to abort and propagate the error to the caller in all other
> cases.
>
> This is important for gpiod_get_optinal() and friends to behave correctly
> in case the specifier contains errors. Without this patch they'll return
> NULL if the property uses the '-gpios' suffix and the specifier contains
> errors, which falsely indicates to the caller that no GPIO was specified.
>
> Signed-off-by: Lars-Peter Clausen <lars@xxxxxxxxxx>

This makes all kind of sense. Patch applied.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux