android_kernel_motorola_sm6225/Documentation/driver-model
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
..
binding.txt docs/driver-model: Update device class docs 2011-08-24 16:01:24 -07:00
bus.txt driver core: remove the driver-model structures from the documentation 2011-05-06 18:01:05 -07:00
class.txt driver core: remove the driver-model structures from the documentation 2011-05-06 18:01:05 -07:00
design-patterns.txt Documentation: fix spelling in design-patterns 2013-12-19 10:10:32 -08:00
device.txt docs/driver-model: Document device.groups 2011-08-24 16:01:24 -07:00
devres.txt gpio: Add helpers for optional GPIOs 2014-05-09 13:48:30 +02:00
driver.txt driver core: remove the driver-model structures from the documentation 2011-05-06 18:01:05 -07:00
overview.txt DOCUMENTATION: Update overview.txt in Doc/driver-model. 2011-06-07 10:04:21 -07:00
platform.txt doc: driver-model/platform.txt: fix a typo 2013-12-19 16:36:18 +01:00
porting.txt Fix typos in /Documentation : Misc 2006-11-30 05:21:10 +01:00