Re: [PATCH] gpiolib: Keep returning EPROBE_DEFER when we should

From: Linus Walleij
Date: Wed Feb 21 2018 - 03:35:52 EST


On Wed, Feb 21, 2018 at 9:19 AM, Chen-Yu Tsai <wens@xxxxxxxx> wrote:
> On Wed, Feb 21, 2018 at 4:17 PM, Linus Walleij <linus.walleij@xxxxxxxxxx> wrote:
>> On Wed, Feb 21, 2018 at 9:11 AM, Maxime Ripard
>> <maxime.ripard@xxxxxxxxxxx> wrote:
>>
>>> Commits c85823390215 ("gpio: of: Support SPI nonstandard GPIO properties")
>>> and 6a537d48461d ("gpio: of: Support regulator nonstandard GPIO
>>> properties") have introduced a regression in the way error codes from
>>> of_get_named_gpiod_flags are handled.
>>>
>>> Previously, those errors codes were returned immediately, but the two
>>> commits mentioned above are now overwriting the error pointer, meaning that
>>> whatever value has been returned will be dropped in favor of whatever the
>>> two new functions will return.
>>>
>>> This might not be a big deal except for EPROBE_DEFER, on which GPIOlib
>>> customers will depend on, and that will now be returned as an hard error
>>> which means that they will not probe anymore, instead of gently deferring
>>> their probe.
>>>
>>> Since EPROBE_DEFER basically means that we have found a valid property but
>>> there was no GPIO controller registered to handle it, fix this issues by
>>> returning it as soon as we encounter it.
>>>
>>> Fixes: c85823390215 ("gpio: of: Support SPI nonstandard GPIO properties")
>>> Fixes: 6a537d48461d ("gpio: of: Support regulator nonstandard GPIO properties")
>>> Signed-off-by: Maxime Ripard <maxime.ripard@xxxxxxxxxxx>
>>
>> Whoops sorry for that, patch applied for fixes.
>
> Would this patch be any better?
>
> https://www.spinics.net/lists/linux-gpio/msg28160.html
>
> Not sure if of_find_spi_gpio() and of_find_regulator_gpio() return
> EPROBE_DEFER as well.

Ah sorry I missed the patch, too much patches in my Inbox
again, I wish I was better at this :/

I think Maxime's patch is nice since it clearly bails out of the
loop as soon as we get deferral.

But we want the second part of your patch as well. If
of_find_spi_gpio() returns -EPROBE_DEFER it should
return.

I will look into it.

Yours,
Linus Walleij