summaryrefslogtreecommitdiff
path: root/Documentation/driver-model/devres.txt
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2014-04-25 19:10:06 +0400
committerLinus Walleij <linus.walleij@linaro.org>2014-05-09 15:48:30 +0400
commit29a1f2333e07bbbecb920cc78fd035fe8f53207a (patch)
treeb2cb50d4c41ff4d1337cca888da3840f6f0d4d84 /Documentation/driver-model/devres.txt
parent91329132c909bbeb27699556b98b7f745ddb2ed9 (diff)
downloadlinux-29a1f2333e07bbbecb920cc78fd035fe8f53207a.tar.xz
gpio: Add helpers for optional GPIOs
Introduce gpiod_get_optional() and gpiod_get_index_optional() helpers that make it easier for drivers to handle optional GPIOs. Currently in order to handle optional GPIOs, a driver needs to special case error handling for -ENOENT, such as this: gpio = gpiod_get(dev, "foo"); if (IS_ERR(gpio)) { if (PTR_ERR(gpio) != -ENOENT) return PTR_ERR(gpio); gpio = NULL; } if (gpio) { /* set up GPIO */ } With these new helpers the above is reduced to: gpio = gpiod_get_optional(dev, "foo"); if (IS_ERR(gpio)) return PTR_ERR(gpio); if (gpio) { /* set up GPIO */ } While at it, device-managed variants of these functions are also provided. Signed-off-by: Thierry Reding <treding@nvidia.com> Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'Documentation/driver-model/devres.txt')
-rw-r--r--Documentation/driver-model/devres.txt2
1 files changed, 2 insertions, 0 deletions
diff --git a/Documentation/driver-model/devres.txt b/Documentation/driver-model/devres.txt
index 8ff1167cfedf..10b8c5d2c797 100644
--- a/Documentation/driver-model/devres.txt
+++ b/Documentation/driver-model/devres.txt
@@ -312,4 +312,6 @@ SPI
GPIO
devm_gpiod_get()
devm_gpiod_get_index()
+ devm_gpiod_get_optional()
+ devm_gpiod_get_index_optional()
devm_gpiod_put()