Re: [RFC] gpio: consumer: Remove WARN_ON(1) when GPIOLIB is disabled

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

 



On Thu, Jul 20, 2017 at 1:08 AM, Dmitry Torokhov
<dmitry.torokhov@xxxxxxxxx> wrote:

> Hmm, I did not realize that GPIO API allowed calls with NULL desc and
> they would be silently accepted and return 0... Not sure if that is the
> best way for the subsystem to behave, but Linus is the boss ;)

NULL gpiods are supported for
gpiod_get_[index_]optional() usecasese only.

See commit:
commit 54d77198fdfbc4f0fe11b4252c1d9c97d51a3264
"gpio: bail out silently on NULL descriptors"

> Maybe check for NULL explicitly and keep warning if !NULL is passed?

A better solution is maybe if gpiod_get_[index_]optional() could
return something akin to a dummy regulator if the GPIO is not
there?

Then we can stop allowing NULL gpiods.

Optional regulators also have some tricksy corner cases like this...

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