Thierry Reding
29a1f2333e
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 >
2014-05-09 13:48:30 +02:00
..
2014-04-04 21:08:20 -07:00
2014-04-05 15:46:37 -07:00
2014-04-04 21:07:28 -07:00
2014-04-03 16:21:12 -07:00
2014-05-09 13:48:30 +02:00
2014-04-09 08:45:40 -07:00
2014-04-28 12:35:07 -07:00
2014-04-10 18:43:32 -07:00
2014-04-09 08:39:39 -07:00
2014-04-18 16:40:08 -07:00
2014-04-08 10:56:12 +02:00
2014-04-24 12:53:38 -07:00
2014-04-10 09:06:10 -07:00
2014-04-18 15:11:54 +01:00
2014-04-12 17:31:22 -07:00
2014-04-02 20:53:45 -07:00
2014-04-10 17:51:29 -04:00
2014-04-03 16:20:49 -07:00
2014-04-03 16:21:09 -07:00
2014-04-07 16:36:05 -07:00
2014-04-12 14:49:50 -07:00
2014-04-09 21:54:06 -06:00
2014-04-12 14:49:50 -07:00
2014-04-09 13:44:35 -07:00
2014-04-09 13:44:35 -07:00
2014-04-07 14:55:46 -07:00
2014-04-07 14:43:50 +02:00
2014-04-03 16:20:58 -07:00
2014-04-07 16:36:06 -07:00
2014-04-03 16:21:05 -07:00
2014-04-16 11:56:33 -07:00
2014-04-03 16:21:06 -07:00
2014-04-14 16:26:47 -04:00
2014-04-23 16:17:03 -04:00
2014-04-03 16:20:51 -07:00
2014-04-08 20:43:28 -04:00
2014-04-04 09:12:49 +02:00
2014-04-03 16:20:59 -07:00
2014-04-16 14:14:07 -07:00
2014-04-07 16:36:07 -07:00
2014-04-17 23:36:27 +02:00
2014-04-07 16:36:11 -07:00
2014-04-17 12:30:40 -07:00
2014-04-17 12:23:07 -07:00
2014-04-17 23:36:27 +02:00
2014-04-06 09:38:07 -07:00
2014-04-03 16:20:50 -07:00
2014-04-03 16:21:04 -07:00
2014-04-07 16:36:14 -07:00
2014-04-18 15:56:03 -04:00
2014-04-03 16:21:01 -07:00
2014-04-16 15:09:51 -04:00
2014-04-07 16:36:13 -07:00
2014-04-07 16:35:54 -07:00
2014-04-02 20:53:45 -07:00
2014-04-13 13:28:13 -07:00
2014-04-12 12:38:53 -07:00
2014-04-07 16:35:55 -07:00
2014-04-03 16:21:01 -07:00
2014-04-09 13:44:35 -07:00
2014-04-06 09:38:07 -07:00
2014-04-03 14:31:34 -04:00
2014-04-03 14:29:12 -04:00
2014-04-03 16:21:26 -07:00
2014-04-07 10:59:19 -07:00
2014-04-11 16:45:59 -07:00
2014-04-18 08:36:10 -05:00
2014-04-04 00:31:49 +01:00
2014-04-03 16:21:04 -07:00
2014-04-03 16:21:00 -07:00
2014-04-07 16:36:14 -07:00
2014-04-16 14:36:12 -04:00
2014-04-12 14:49:50 -07:00
2014-04-03 16:21:08 -07:00
2014-04-03 16:20:54 -07:00
2014-04-03 16:21:01 -07:00
2014-04-16 08:56:09 +02:00
2014-04-07 16:35:54 -07:00
2014-04-07 16:36:07 -07:00
2014-04-12 12:38:53 -07:00
2014-04-19 22:42:19 -07:00
2014-04-03 16:21:00 -07:00
2014-04-02 20:53:45 -07:00
2014-04-13 13:28:13 -07:00
2014-04-07 16:36:13 -07:00
2014-04-03 16:21:01 -07:00
2014-04-12 13:06:10 -07:00
2014-04-16 11:56:33 -07:00
2014-04-07 16:36:13 -07:00
2014-04-09 10:12:11 -04:00
2014-04-24 15:18:02 -07:00
2014-04-03 16:21:04 -07:00
2014-04-07 16:35:53 -07:00
2014-04-07 16:36:14 -07:00
2014-04-18 16:40:08 -07:00
2014-04-07 16:35:57 -07:00