Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1579489
| From | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2] gpio: return NULL from gpiod_get_optional when GPIOLIB is disabled |
| Date | 2017-02-13 08:50 +0100 |
| Message-ID | <tajyx-Is-7@gated-at.bofh.it> (permalink) |
| References | <tadt7-5ay-1@gated-at.bofh.it> <tadt7-5ay-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hello, On Sun, Feb 12, 2017 at 05:15:01PM -0800, Dmitry Torokhov wrote: > On Sun, Feb 12, 2017 at 05:13:55PM -0800, Dmitry Torokhov wrote: > > Given the intent behind gpiod_get_optional() and friends it does not make > > sense to return -ENOSYS when GPIOLIB is disabled: the driver is expected to > > work just fine without gpio so let's behave as if gpio was not found. > > Otherwise we have to special-case -ENOSYS in drivers. > > > > Note that there was objection that someone might forget to enable GPIOLIB > > when dealing with a platform that has device that actually specifies > > optional gpio and we'll break it. I find this unconvincing as that would > > have to be the *only GPIO* in the system, which is extremely unlikely. > > > > Suggested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> I don't like this patch and so I wonder what I wrote that could be interpreted as suggesting this patch. For now I'd say only Nacked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> is justified. My concern is still there. This might break some setups. IMHO it's not ok to request that a device in a certain configuration only works when the (optional) Kconfig option GPIOLIB is enabled and silently breaks if it's not. And you cannot rely on the person who configured the kernel. When accepting this you will burn debug time of others who see their device breaking with no or unrelated error messages. The only reliable way out here is to enable enough of GPIOLIB to only return NULL in ..._optional when there is no gpio required. You can have a suggested-by for that. The semantic of gpiod_get_optional is: if there is a gpio: give it to me else: give me a dummy If the kernel is configured to be unable to answer the question "is there a gpio?" that is worth a -ENOSYS. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2] gpio: return NULL from gpiod_get_optional when GPIOLIB is disabled Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-02-13 02:20 +0100
Re: [PATCH v2] gpio: return NULL from gpiod_get_optional when GPIOLIB is disabled Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-02-13 02:20 +0100
Re: [PATCH v2] gpio: return NULL from gpiod_get_optional when GPIOLIB is disabled Uwe Kleine-König <u.kleine-koenig@pengutronix.de> - 2017-02-13 08:50 +0100
Re: [PATCH v2] gpio: return NULL from gpiod_get_optional when GPIOLIB is disabled Uwe Kleine-König <u.kleine-koenig@pengutronix.de> - 2017-02-13 09:30 +0100
Re: [PATCH v2] gpio: return NULL from gpiod_get_optional when GPIOLIB is disabled Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-02-13 09:30 +0100
Re: [PATCH v2] gpio: return NULL from gpiod_get_optional when GPIOLIB is disabled Uwe Kleine-König <u.kleine-koenig@pengutronix.de> - 2017-02-13 10:00 +0100
Re: [PATCH v2] gpio: return NULL from gpiod_get_optional when GPIOLIB is disabled Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-02-13 18:40 +0100
csiph-web