Skip to content

Commit 7691ba0

Browse files
linuswBartosz Golaszewski
authored andcommitted
gpio: Further document optional GPIOLIB
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 <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent e404b0c commit 7691ba0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Documentation/driver-api/gpio/consumer.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ warnings. These stubs are used for two use cases:
2929
will use it under other compile-time configurations. In this case the
3030
consumer must make sure not to call into these functions, or the user will
3131
be met with console warnings that may be perceived as intimidating.
32+
Combining truly optional GPIOLIB usage with calls to
33+
``[devm_]gpiod_get_optional()`` is a *bad idea*, and will result in weird
34+
error messages. Use the ordinary getter functions with optional GPIOLIB:
35+
some open coding of error handling should be expected when you do this.
3236

3337
All the functions that work with the descriptor-based GPIO interface are
3438
prefixed with ``gpiod_``. The ``gpio_`` prefix is used for the legacy

0 commit comments

Comments
 (0)