Skip to content

Commit

Permalink
gpiolib: Defer failed gpio requests by default
Browse files Browse the repository at this point in the history
Since users must be explicitly provided with a GPIO number in order to
request one the overwhelmingly common case for failing to request will
be that the required GPIO driver has not yet registered and we should
therefore defer until it has registered.

In order to avoid having to code this logic in individual drivers have
gpio_request() return -EPROBE_DEFER when failing to look up the GPIO.
Drivers which don't want this behaviour can override it if they desire.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Mark Brown authored and Linus Walleij committed Jul 17, 2012
1 parent 6d99471 commit e935457
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/gpio/gpiolib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,7 @@ int gpio_request(unsigned gpio, const char *label)
{
struct gpio_desc *desc;
struct gpio_chip *chip;
int status = -EINVAL;
int status = -EPROBE_DEFER;
unsigned long flags;

spin_lock_irqsave(&gpio_lock, flags);
Expand Down

0 comments on commit e935457

Please sign in to comment.