lists.openwall.net   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  linux-cve-announce  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]
Message-ID: <CAMuHMdXbuZqEpYivyS6hkaRN+CwTOGaHq_OROwVAWvDD6OXODQ@mail.gmail.com>
Date:   Tue, 18 Jan 2022 09:25:01 +0100
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Uwe Kleine-König 
        <u.kleine-koenig@...gutronix.de>
Cc:     Andrew Lunn <andrew@...n.ch>, Ulf Hansson <ulf.hansson@...aro.org>,
        Vignesh Raghavendra <vigneshr@...com>,
        KVM list <kvm@...r.kernel.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>, linux-iio@...r.kernel.org,
        Linus Walleij <linus.walleij@...aro.org>,
        Amit Kucheria <amitk@...nel.org>,
        ALSA Development Mailing List <alsa-devel@...a-project.org>,
        Jaroslav Kysela <perex@...ex.cz>,
        Guenter Roeck <groeck@...omium.org>,
        Thierry Reding <thierry.reding@...il.com>,
        MTD Maling List <linux-mtd@...ts.infradead.org>,
        Linux I2C <linux-i2c@...r.kernel.org>,
        Miquel Raynal <miquel.raynal@...tlin.com>,
        linux-phy@...ts.infradead.org,
        linux-spi <linux-spi@...r.kernel.org>,
        Jiri Slaby <jirislaby@...nel.org>,
        "David S. Miller" <davem@...emloft.net>,
        Khuong Dinh <khuong@...amperecomputing.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        Matthias Schiffer <matthias.schiffer@...tq-group.com>,
        Kamal Dasu <kdasu.kdev@...il.com>,
        Lee Jones <lee.jones@...aro.org>,
        Bartosz Golaszewski <brgl@...ev.pl>,
        Daniel Lezcano <daniel.lezcano@...aro.org>,
        Kishon Vijay Abraham I <kishon@...com>,
        bcm-kernel-feedback-list <bcm-kernel-feedback-list@...adcom.com>,
        "open list:SERIAL DRIVERS" <linux-serial@...r.kernel.org>,
        Jakub Kicinski <kuba@...nel.org>,
        Zhang Rui <rui.zhang@...el.com>,
        platform-driver-x86@...r.kernel.org,
        Linux PWM List <linux-pwm@...r.kernel.org>,
        Hans de Goede <hdegoede@...hat.com>,
        Robert Richter <rric@...nel.org>,
        Saravanan Sekar <sravanhome@...il.com>,
        Corey Minyard <minyard@....org>,
        Linux PM list <linux-pm@...r.kernel.org>,
        Liam Girdwood <lgirdwood@...il.com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        John Garry <john.garry@...wei.com>,
        Peter Korsgaard <peter@...sgaard.com>,
        William Breathitt Gray <vilhelm.gray@...il.com>,
        Mark Gross <markgross@...nel.org>,
        "open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
        Alex Williamson <alex.williamson@...hat.com>,
        Mark Brown <broonie@...nel.org>,
        Borislav Petkov <bp@...en8.de>, Takashi Iwai <tiwai@...e.com>,
        Matthias Brugger <matthias.bgg@...il.com>,
        openipmi-developer@...ts.sourceforge.net,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Benson Leung <bleung@...omium.org>,
        Pengutronix Kernel Team <kernel@...gutronix.de>,
        Linux ARM <linux-arm-kernel@...ts.infradead.org>,
        linux-edac@...r.kernel.org, Tony Luck <tony.luck@...el.com>,
        Richard Weinberger <richard@....at>,
        Mun Yew Tham <mun.yew.tham@...el.com>,
        Eric Auger <eric.auger@...hat.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>,
        Cornelia Huck <cohuck@...hat.com>,
        Linux MMC List <linux-mmc@...r.kernel.org>,
        Joakim Zhang <qiangqing.zhang@....com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Linux-Renesas <linux-renesas-soc@...r.kernel.org>,
        Sergey Shtylyov <s.shtylyov@....ru>,
        Vinod Koul <vkoul@...nel.org>,
        James Morse <james.morse@....com>,
        Zha Qipeng <qipeng.zha@...el.com>,
        Sebastian Reichel <sre@...nel.org>,
        Niklas Söderlund <niklas.soderlund@...natech.se>,
        linux-mediatek@...ts.infradead.org,
        Brian Norris <computersforpeace@...il.com>,
        netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH 1/2] platform: make platform_get_irq_optional() optional

Hi Uwe,

On Mon, Jan 17, 2022 at 6:06 PM Uwe Kleine-König
<u.kleine-koenig@...gutronix.de> wrote:
> On Mon, Jan 17, 2022 at 02:08:19PM +0100, Geert Uytterhoeven wrote:
> > On Mon, Jan 17, 2022 at 12:49 PM Uwe Kleine-König
> > <u.kleine-koenig@...gutronix.de> wrote:
> > > > The logic in e.g. drivers/tty/serial/sh-sci.c and
> > > > drivers/spi/spi-rspi.c could be simplified and improved (currently
> > > > it doesn't handle deferred probe) if platform_get_irq_optional()
> > > > would return 0 instead of -ENXIO.

> > > Also for spi-rspi.c I don't see how platform_get_irq_byname_optional()
> > > returning 0 instead of -ENXIO would help. Please talk in patches.

[...]

> This is not a simplification, just looking at the line count and the
> added gotos. That's because it also improves error handling and so the
> effect isn't easily spotted.

Yes, it's larger because it adds currently missing error handling.

> What about the following idea (in pythonic pseudo code for simplicity):

No idea what you gain by throwing in a language that is irrelevant
to kernel programming (why no Rust? ;-)

> > > > So there are three reasons: because the absence of an optional IRQ
> > > > is not an error, and thus that should not cause (a) an error code
> > > > to be returned, and (b) an error message to be printed, and (c)
> > > > because it can simplify the logic in device drivers.
> > >
> > > I don't agree to (a). If the value signaling not-found is -ENXIO or 0
> > > (or -ENODEV) doesn't matter much. I wouldn't deviate from the return
> > > code semantics of platform_get_irq() just for having to check against 0
> > > instead of -ENXIO. Zero is then just another magic value.
> >
> > Zero is a natural magic value (also for pointers).
> > Errors are always negative.
> > Positive values are cookies (or pointers) associated with success.
>
> Yeah, the issue where we don't agree is if "not-found" is special enough
> to deserve the natural magic value. For me -ENXIO is magic enough to
> handle the absence of an irq line. I consider it even the better magic
> value.

It differs from other subsystems (clk, gpio, reset), which do return
zero on not found.
What's the point in having *_optional() APIs if they just return the
same values as the non-optional ones?


Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ