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