linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: Further document optional GPIOLIB
@ 2023-10-02  8:12 Linus Walleij
  2023-10-04 11:41 ` Bartosz Golaszewski
  0 siblings, 1 reply; 2+ messages in thread
From: Linus Walleij @ 2023-10-02  8:12 UTC (permalink / raw)
  To: Bartosz Golaszewski, Andy Shevchenko, Jonathan Corbet
  Cc: linux-gpio, linux-doc, linux-kernel, Linus Walleij

Optional GPIOLIB as in not depended on or selected by a driver
should NOT use any *_optional() calls, this becomes paradoxical.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 Documentation/driver-api/gpio/consumer.rst | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/driver-api/gpio/consumer.rst b/Documentation/driver-api/gpio/consumer.rst
index de6fc79ad6f0..3e588b9d678c 100644
--- a/Documentation/driver-api/gpio/consumer.rst
+++ b/Documentation/driver-api/gpio/consumer.rst
@@ -29,6 +29,10 @@ warnings. These stubs are used for two use cases:
   will use it under other compile-time configurations. In this case the
   consumer must make sure not to call into these functions, or the user will
   be met with console warnings that may be perceived as intimidating.
+  Combining truly optional GPIOLIB usage with calls to
+  ``[devm_]gpiod_get_optional()`` is a *bad idea*, and will result in weird
+  error messages. Use the ordinary getter functions with optional GPIOLIB:
+  some open coding of error handling should be expected when you do this.
 
 All the functions that work with the descriptor-based GPIO interface are
 prefixed with ``gpiod_``. The ``gpio_`` prefix is used for the legacy

---
base-commit: 0bb80ecc33a8fb5a682236443c1e740d5c917d1d
change-id: 20231002-gpiodoc-cf9430641b91

Best regards,
-- 
Linus Walleij <linus.walleij@linaro.org>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] gpio: Further document optional GPIOLIB
  2023-10-02  8:12 [PATCH] gpio: Further document optional GPIOLIB Linus Walleij
@ 2023-10-04 11:41 ` Bartosz Golaszewski
  0 siblings, 0 replies; 2+ messages in thread
From: Bartosz Golaszewski @ 2023-10-04 11:41 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Andy Shevchenko, Jonathan Corbet, linux-gpio, linux-doc,
	linux-kernel

On Mon, Oct 2, 2023 at 10:12 AM Linus Walleij <linus.walleij@linaro.org> wrote:
>
> Optional GPIOLIB as in not depended on or selected by a driver
> should NOT use any *_optional() calls, this becomes paradoxical.
>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  Documentation/driver-api/gpio/consumer.rst | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/Documentation/driver-api/gpio/consumer.rst b/Documentation/driver-api/gpio/consumer.rst
> index de6fc79ad6f0..3e588b9d678c 100644
> --- a/Documentation/driver-api/gpio/consumer.rst
> +++ b/Documentation/driver-api/gpio/consumer.rst
> @@ -29,6 +29,10 @@ warnings. These stubs are used for two use cases:
>    will use it under other compile-time configurations. In this case the
>    consumer must make sure not to call into these functions, or the user will
>    be met with console warnings that may be perceived as intimidating.
> +  Combining truly optional GPIOLIB usage with calls to
> +  ``[devm_]gpiod_get_optional()`` is a *bad idea*, and will result in weird
> +  error messages. Use the ordinary getter functions with optional GPIOLIB:
> +  some open coding of error handling should be expected when you do this.
>
>  All the functions that work with the descriptor-based GPIO interface are
>  prefixed with ``gpiod_``. The ``gpio_`` prefix is used for the legacy
>
> ---
> base-commit: 0bb80ecc33a8fb5a682236443c1e740d5c917d1d
> change-id: 20231002-gpiodoc-cf9430641b91
>
> Best regards,
> --
> Linus Walleij <linus.walleij@linaro.org>
>

Applied, thanks!

Bart

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-04 11:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-02  8:12 [PATCH] gpio: Further document optional GPIOLIB Linus Walleij
2023-10-04 11:41 ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).