[PATCH] Revert "gpio: bail out silently on NULL descriptors"

Linus Walleij linus.walleij at linaro.org
Wed Jun 15 14:04:11 PDT 2016


On Wed, Jun 15, 2016 at 8:22 PM, Hans de Goede <hdegoede at redhat.com> wrote:

> This reverts commit 54d77198fdfb("gpio: bail out silently on NULL
> descriptors").
>
> This commit causes the following code to fail:
>
> gpio_desc = devm_gpiod_get_optional(dev, ...);
> gpio_irq  = gpiod_to_irq(gpio_desc);
> if (gpio_irq >= 0) {
>         ret = devm_request_irq(dev, gpio_irq, ...);
>
> And now ret is an error causing the probe function in question to bail.
>
> The problem here is that gpiod_to_irq now returns 0 for a NULL
> gpio_desc while 0 is a valid irq-nr. Also see:
> commit 4c37ce8608a8("gpio: make gpiod_to_irq() return negative for NO_IRQ")
> which specifically avoids returning 0.
>
> Signed-off-by: Hans de Goede <hdegoede at redhat.com>

The first commit was done to fix another regression so if I revert it I get
back the first regression.

I guess what we need to do is simply make gpiod_to_irq() a
special case and have it behave the way expected for now?

Hans: I sent a patch like that if it works for you could you give
me your Tested-by?

Yours,
Linus Walleij



More information about the linux-arm-kernel mailing list