lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 12 Jan 2022 21:45:25 +0000
From:   Mark Brown <>
To:     Uwe Kleine-König 
Cc:     Geert Uytterhoeven <>,
        Andrew Lunn <>,
        Ulf Hansson <>,
        Vignesh Raghavendra <>,
        KVM list <>,
        "Rafael J. Wysocki" <>,,
        Linus Walleij <>,
        Amit Kucheria <>,
        ALSA Development Mailing List <>,
        Andy Shevchenko <>,
        Joakim Zhang <>,
        Guenter Roeck <>,
        Thierry Reding <>,
        MTD Maling List <>,
        Linux I2C <>,
        Miquel Raynal <>,,,
        linux-spi <>,
        Jiri Slaby <>,,
        Khuong Dinh <>,
        Florian Fainelli <>,
        Matthias Schiffer <>,
        Kamal Dasu <>,
        Lee Jones <>,
        Bartosz Golaszewski <>,
        Daniel Lezcano <>,
        Kishon Vijay Abraham I <>,
        bcm-kernel-feedback-list <>,
        "open list:SERIAL DRIVERS" <>,
        Jakub Kicinski <>,
        Zhang Rui <>,
        Jaroslav Kysela <>,
        Linux PWM List <>,
        Hans de Goede <>,
        Robert Richter <>,
        Saravanan Sekar <>,
        Corey Minyard <>,
        Linux PM list <>,
        Mauro Carvalho Chehab <>,
        John Garry <>,
        Peter Korsgaard <>,
        William Breathitt Gray <>,
        Mark Gross <>,
        "open list:GPIO SUBSYSTEM" <>,
        Alex Williamson <>,
        Borislav Petkov <>,
        Sebastian Reichel <>,
        Matthias Brugger <>,
        Takashi Iwai <>,,
        Benson Leung <>,
        Linux ARM <>,, Tony Luck <>,
        Mun Yew Tham <>,
        Eric Auger <>,
        Greg Kroah-Hartman <>,
        Yoshihiro Shimoda <>,
        Cornelia Huck <>,
        Linux MMC List <>,
        Liam Girdwood <>,
        Linux Kernel Mailing List <>,
        Linux-Renesas <>,
        Sergey Shtylyov <>,
        Vinod Koul <>,
        James Morse <>,
        Zha Qipeng <>,
        Pengutronix Kernel Team <>,
        Richard Weinberger <>,
        Niklas Söderlund 
        Brian Norris <>,
        "David S. Miller" <>
Subject: Re: [PATCH 1/2] platform: make platform_get_irq_optional() optional

On Wed, Jan 12, 2022 at 10:31:21PM +0100, Uwe Kleine-König wrote:
> On Wed, Jan 12, 2022 at 11:27:02AM +0100, Geert Uytterhoeven wrote:

(Do we really need *all* the CCs here?)

> That convinces me, that platform_get_irq_optional() is a bad name. The
> only difference to platform_get_irq is that it's silent. And returning
> a dummy irq value (which would make it aligned with the other _optional
> functions) isn't possible.

There is regulator_get_optional() which is I believe the earliest of
these APIs, it doesn't return a dummy either (and is silent too) - this
is because regulator_get() does return a dummy since it's the vastly
common case that regulators must be physically present and them not
being found is due to there being an error in the system description.
It's unfortunate that we've ended up with these two different senses for
_optional(), people frequently get tripped up by it.

> > To me it sounds much more logical for the driver to check if an
> > optional irq is non-zero (available) or zero (not available), than to
> > sprinkle around checks for -ENXIO. In addition, you have to remember
> > that this one returns -ENXIO, while other APIs use -ENOENT or -ENOSYS
> > (or some other error code) to indicate absence. I thought not having
> > to care about the actual error code was the main reason behind the
> > introduction of the *_optional() APIs.

> No, the main benefit of gpiod_get_optional() (and clk_get_optional()) is
> that you can handle an absent GPIO (or clk) as if it were available.

Similarly for the regulator API, kind of.

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists