An error occurred fetching the project authors.
  1. 09 May, 2014 1 commit
    • Thierry Reding's avatar
      gpio: Add helpers for optional GPIOs · 29a1f233
      Thierry Reding authored
      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: default avatarThierry Reding <treding@nvidia.com>
      Reviewed-by: default avatarAlexandre Courbot <acourbot@nvidia.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      29a1f233
  2. 30 Oct, 2013 1 commit
  3. 23 Oct, 2013 1 commit
  4. 19 Oct, 2013 1 commit
  5. 17 Jun, 2013 1 commit
  6. 05 Jul, 2012 1 commit
  7. 18 May, 2012 1 commit
  8. 04 May, 2012 1 commit
  9. 04 Jan, 2012 1 commit