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