Re: [PATCH 1/2] platform: make platform_get_irq_optional() optional (summary)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- Subject: Re: [PATCH 1/2] platform: make platform_get_irq_optional() optional (summary)
- From: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
- Date: Sat, 15 Jan 2022 19:36:43 +0100
- Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, "Rafael J. Wysocki" <rafael@xxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, Andrew Lunn <andrew@xxxxxxx>, Ulf Hansson <ulf.hansson@xxxxxxxxxx>, Vignesh Raghavendra <vigneshr@xxxxxx>, Jiri Slaby <jirislaby@xxxxxxxxxx>, Liam Girdwood <lgirdwood@xxxxxxxxx>, linux-iio@xxxxxxxxxxxxxxx, Linus Walleij <linus.walleij@xxxxxxxxxx>, Amit Kucheria <amitk@xxxxxxxxxx>, alsa-devel@xxxxxxxxxxxxxxxx, Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>, Sebastian Reichel <sre@xxxxxxxxxx>, linux-phy@xxxxxxxxxxxxxxxxxxx, Thierry Reding <thierry.reding@xxxxxxxxx>, linux-mtd@xxxxxxxxxxxxxxxxxxx, linux-i2c@xxxxxxxxxxxxxxx, linux-gpio@xxxxxxxxxxxxxxx, Miquel Raynal <miquel.raynal@xxxxxxxxxxx>, Guenter Roeck <groeck@xxxxxxxxxxxx>, Lee Jones <lee.jones@xxxxxxxxxx>, openipmi-developer@xxxxxxxxxxxxxxxxxxxxx, Saravanan Sekar <sravanhome@xxxxxxxxx>, Khuong Dinh <khuong@xxxxxxxxxxxxxxxxxxxxxx>, Florian Fainelli <f.fainelli@xxxxxxxxx>, Matthias Schiffer <matthias.schiffer@xxxxxxxxxxxxxxx>, kvm@xxxxxxxxxxxxxxx, Kamal Dasu <kdasu.kdev@xxxxxxxxx>, Richard Weinberger <richard@xxxxxx>, Bartosz Golaszewski <brgl@xxxxxxxx>, Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>, Kishon Vijay Abraham I <kishon@xxxxxx>, bcm-kernel-feedback-list@xxxxxxxxxxxx, linux-serial@xxxxxxxxxxxxxxx, Jakub Kicinski <kuba@xxxxxxxxxx>, Zhang Rui <rui.zhang@xxxxxxxxx>, Jaroslav Kysela <perex@xxxxxxxx>, platform-driver-x86@xxxxxxxxxxxxxxx, linux-pwm@xxxxxxxxxxxxxxx, John Garry <john.garry@xxxxxxxxxx>, Robert Richter <rric@xxxxxxxxxx>, Zha Qipeng <qipeng.zha@xxxxxxxxx>, Corey Minyard <minyard@xxxxxxx>, linux-pm@xxxxxxxxxxxxxxx, Peter Korsgaard <peter@xxxxxxxxxxxxx>, William Breathitt Gray <vilhelm.gray@xxxxxxxxx>, Mark Gross <markgross@xxxxxxxxxx>, Hans de Goede <hdegoede@xxxxxxxxxx>, Alex Williamson <alex.williamson@xxxxxxxxxx>, Mark Brown <broonie@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, Matthias Brugger <matthias.bgg@xxxxxxxxx>, Takashi Iwai <tiwai@xxxxxxxx>, Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>, Benson Leung <bleung@xxxxxxxxxxxx>, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-edac@xxxxxxxxxxxxxxx, Tony Luck <tony.luck@xxxxxxxxx>, Mun Yew Tham <mun.yew.tham@xxxxxxxxx>, Eric Auger <eric.auger@xxxxxxxxxx>, netdev@xxxxxxxxxxxxxxx, Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx>, Cornelia Huck <cohuck@xxxxxxxxxx>, linux-mmc@xxxxxxxxxxxxxxx, Joakim Zhang <qiangqing.zhang@xxxxxxx>, linux-spi@xxxxxxxxxxxxxxx, linux-renesas-soc@xxxxxxxxxxxxxxx, Vinod Koul <vkoul@xxxxxxxxxx>, James Morse <james.morse@xxxxxxx>, Pengutronix Kernel Team <kernel@xxxxxxxxxxxxxx>, Niklas Söderlund <niklas.soderlund@xxxxxxxxxxxx>, linux-mediatek@xxxxxxxxxxxxxxxxxxx, Brian Norris <computersforpeace@xxxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>
- In-reply-to: <20220110195449.12448-2-s.shtylyov@omp.ru>
- References: <20220110195449.12448-1-s.shtylyov@omp.ru> <20220110195449.12448-2-s.shtylyov@omp.ru>
Hello,
I'm trying to objectively summarize the discussions in this thread in
the hope this helps finding a way that most people can live with.
First a description of the status quo:
There are several function pairs *get() and *get_optional() that however
are different in various aspects. Their relevant properties are listes
in the following table. Ideally each line had only identical entries.
| clk_get | gpiod_get | platform_get_irq | regulator_get |
return value | | | | |
on not-found | ERR_PTR(-ENOENT) | ERR_PTR(-ENOENT) | -ENXIO | dummy[1] |
(plain get) | | | | |
| | | | |
return value | | | | |
on not-found | dummy[1] | dummy[1] | -ENXIO | ERR_PTR(-ENOENT) |
(get_optional) | | | | |
| | | | |
emits an error message | | | | |
on error (including | no | no | yes[2] | no |
not-found) | | | | |
| | | | |
get_optional emits an error | | | | |
message on error (including | no | no | no | no |
not-found) | | | | |
| | | | |
summary: | returning a dummy | returning a dummy | doesn't emit an | returning error code |
*_get_optional() differs from | on not-found | on not-found | error message | on not-found |
*_get by: | | | | |
[1] the dummy value is a valid resource descriptor, the API functions
are a noop for this dummy value. This dummy value is NULL for
all three subsystems.
[2] no error is printed for -EPROBE_DEFER.
The inversion between clk+gpio vs. regulator is unforunate, swaping one
or the other would be good for consistency, but this isn't the topic of
this thread. Only so much: It's not agreed upon which variant is the
better one and the difference is of historical origin.
There are now different suggestions to improve the situation regarding
platform_get_irq() compared to the other functions:
a) by Sergey
platform_get_irq_optional() is changed to return 0 on not-found.
b) by Uwe
rename platform_get_irq_optional() to platform_get_irq_silent()
The argument pro a) is:
platform_get_irq_optional() is aligned to clk_get() and
gpiod_get() by returning 0 on not-found.
The argument contra a)
The return value 0 for platform_get_irq() is only syntactically
nearer to the dummy value of clk_get() and gpiod_get(). A dummy
value isn't available and probably not sensible to introduce for
irq because most drivers have to check for the not-found
situation anyhow to setup polling.
The argument pro b) is:
The relevant difference between platform_get_irq() and its
optional variant is that the latter is silent. This is a
different concept for the meaning of optional compared to the
other *_get_optional().
The argument contra b) is:
The chosen name is bad, because driver authors might wonder what
a silent irq is.
---- end of summary
A possible compromise: We can have both. We rename
platform_get_irq_optional() to platform_get_irq_silent() (or
platform_get_irq_silently() if this is preferred) and once all users are
are changed (which can be done mechanically), we reintroduce a
platform_get_irq_optional() with Sergey's suggested semantic (i.e.
return 0 on not-found, no error message printking).
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
Attachment:
signature.asc
Description: PGP signature
[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]
|