Re: [PATCH] driver core: platform: Rename platform_get_irq_optional() to platform_get_irq_silent()
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- Subject: Re: [PATCH] driver core: platform: Rename platform_get_irq_optional() to platform_get_irq_silent()
- From: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
- Date: Fri, 14 Jan 2022 10:58:51 +0100
- Cc: Sergey Shtylyov <s.shtylyov@xxxxxx>, Mark Brown <broonie@xxxxxxxxxx>, Andrew Lunn <andrew@xxxxxxx>, Ulf Hansson <ulf.hansson@xxxxxxxxxx>, Vignesh Raghavendra <vigneshr@xxxxxx>, KVM list <kvm@xxxxxxxxxxxxxxx>, "Rafael J. Wysocki" <rafael@xxxxxxxxxx>, linux-iio@xxxxxxxxxxxxxxx, Linus Walleij <linus.walleij@xxxxxxxxxx>, Amit Kucheria <amitk@xxxxxxxxxx>, ALSA Development Mailing List <alsa-devel@xxxxxxxxxxxxxxxx>, Jaroslav Kysela <perex@xxxxxxxx>, Guenter Roeck <groeck@xxxxxxxxxxxx>, Thierry Reding <thierry.reding@xxxxxxxxx>, MTD Maling List <linux-mtd@xxxxxxxxxxxxxxxxxxx>, Linux I2C <linux-i2c@xxxxxxxxxxxxxxx>, "open list:GPIO SUBSYSTEM" <linux-gpio@xxxxxxxxxxxxxxx>, Miquel Raynal <miquel.raynal@xxxxxxxxxxx>, linux-phy@xxxxxxxxxxxxxxxxxxx, netdev <netdev@xxxxxxxxxxxxxxx>, linux-spi <linux-spi@xxxxxxxxxxxxxxx>, Jiri Slaby <jirislaby@xxxxxxxxxx>, Khuong Dinh <khuong@xxxxxxxxxxxxxxxxxxxxxx>, Florian Fainelli <f.fainelli@xxxxxxxxx>, Matthias Schiffer <matthias.schiffer@xxxxxxxxxxxxxxx>, Kamal Dasu <kdasu.kdev@xxxxxxxxx>, Lee Jones <lee.jones@xxxxxxxxxx>, Bartosz Golaszewski <brgl@xxxxxxxx>, Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>, Kishon Vijay Abraham I <kishon@xxxxxx>, "open list:SERIAL DRIVERS" <linux-serial@xxxxxxxxxxxxxxx>, bcm-kernel-feedback-list <bcm-kernel-feedback-list@xxxxxxxxxxxx>, Zhang Rui <rui.zhang@xxxxxxxxx>, platform-driver-x86@xxxxxxxxxxxxxxx, Linux PWM List <linux-pwm@xxxxxxxxxxxxxxx>, Robert Richter <rric@xxxxxxxxxx>, Saravanan Sekar <sravanhome@xxxxxxxxx>, Corey Minyard <minyard@xxxxxxx>, Linux PM list <linux-pm@xxxxxxxxxxxxxxx>, Liam Girdwood <lgirdwood@xxxxxxxxx>, Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>, John Garry <john.garry@xxxxxxxxxx>, Takashi Iwai <tiwai@xxxxxxxx>, Peter Korsgaard <peter@xxxxxxxxxxxxx>, William Breathitt Gray <vilhelm.gray@xxxxxxxxx>, Mark Gross <markgross@xxxxxxxxxx>, Hans de Goede <hdegoede@xxxxxxxxxx>, Alex Williamson <alex.williamson@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, Jakub Kicinski <kuba@xxxxxxxxxx>, Matthias Brugger <matthias.bgg@xxxxxxxxx>, openipmi-developer@xxxxxxxxxxxxxxxxxxxxx, Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>, Benson Leung <bleung@xxxxxxxxxxxx>, Pengutronix Kernel Team <kernel@xxxxxxxxxxxxxx>, Linux ARM <linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>, linux-edac@xxxxxxxxxxxxxxx, Tony Luck <tony.luck@xxxxxxxxx>, Richard Weinberger <richard@xxxxxx>, Mun Yew Tham <mun.yew.tham@xxxxxxxxx>, Eric Auger <eric.auger@xxxxxxxxxx>, Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx>, Cornelia Huck <cohuck@xxxxxxxxxx>, Linux MMC List <linux-mmc@xxxxxxxxxxxxxxx>, Joakim Zhang <qiangqing.zhang@xxxxxxx>, Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>, Linux-Renesas <linux-renesas-soc@xxxxxxxxxxxxxxx>, Vinod Koul <vkoul@xxxxxxxxxx>, James Morse <james.morse@xxxxxxx>, Zha Qipeng <qipeng.zha@xxxxxxxxx>, Sebastian Reichel <sre@xxxxxxxxxx>, Niklas Söderlund <niklas.soderlund@xxxxxxxxxxxx>, linux-mediatek@xxxxxxxxxxxxxxxxxxx, Brian Norris <computersforpeace@xxxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>
- In-reply-to: <20220113224319.akljsjtu7ps75vun@pengutronix.de>
- References: <CAMuHMdWK3RKVXRzMASN4HaYfLckdS7rBvSopafq+iPADtGEUzA@mail.gmail.com> <20220112085009.dbasceh3obfok5dc@pengutronix.de> <CAMuHMdWsMGPiQaPS0-PJ_+Mc5VQ37YdLfbHr_aS40kB+SfW-aw@mail.gmail.com> <20220112213121.5ruae5mxwj6t3qiy@pengutronix.de> <Yd9L9SZ+g13iyKab@sirena.org.uk> <20220113110831.wvwbm75hbfysbn2d@pengutronix.de> <YeA7CjOyJFkpuhz/@sirena.org.uk> <20220113194358.xnnbhsoyetihterb@pengutronix.de> <YeCI47ltlWzjzjYy@sirena.org.uk> <1df04d74-8aa2-11f1-54e9-34d0e8f4e58b@omp.ru> <20220113224319.akljsjtu7ps75vun@pengutronix.de>
Hi Uwe,
On Thu, Jan 13, 2022 at 11:43 PM Uwe Kleine-König
<u.kleine-koenig@xxxxxxxxxxxxxx> wrote:
> On Thu, Jan 13, 2022 at 11:57:43PM +0300, Sergey Shtylyov wrote:
> > On 1/13/22 11:17 PM, Mark Brown wrote:
> > >> The subsystems regulator, clk and gpio have the concept of a dummy
> > >> resource. For regulator, clk and gpio there is a semantic difference
> > >> between the regular _get() function and the _get_optional() variant.
> > >> (One might return the dummy resource, the other won't. Unfortunately
> > >> which one implements which isn't the same for these three.) The
> > >> difference between platform_get_irq() and platform_get_irq_optional() is
> > >> only that the former might emit an error message and the later won't.
> >
> > This is only a current difference but I'm still going to return 0 ISO
> > -ENXIO from latform_get_irq_optional(), no way I'd leave that -ENXIO there
> > alone... :-)
>
> This would address a bit of the critic in my commit log. But as 0 isn't
> a dummy value like the dummy values that exist for clk, gpiod and
> regulator I still think that the naming is a bad idea because it's not
> in the spirit of the other *_get_optional functions.
>
> Seeing you say that -ENXIO is a bad return value for
> platform_get_irq_optional() and 0 should be used instead, I wonder why
> not changing platform_get_irq() to return 0 instead of -ENXIO, too.
> This question is for now only about a sensible semantic. That actually
> changing platform_get_irq() is probably harder than changing
> platform_get_irq_optional() is a different story.
>
> If only platform_get_irq_optional() is changed and given that the
> callers have to do something like:
>
> if (this_irq_exists()):
> ... (e.g. request_irq)
> else:
> ... (e.g. setup polling)
>
> I really think it's a bad idea that this_irq_exists() has to be
> different for platform_get_irq() vs. platform_get_irq_optional().
For platform_get_irq(), the IRQ being absent is an error condition,
hence it should return an error code.
For platform_get_irq_optional(), the IRQ being absent is not an error
condition, hence it should not return an error code, and 0 is OK.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx
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
[Index of Archives]
[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]
|