提交 e9354576 编写于 作者: M Mark Brown 提交者: Linus Walleij

gpiolib: Defer failed gpio requests by default

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: NMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
上级 6d994710
...@@ -1186,7 +1186,7 @@ int gpio_request(unsigned gpio, const char *label) ...@@ -1186,7 +1186,7 @@ int gpio_request(unsigned gpio, const char *label)
{ {
struct gpio_desc *desc; struct gpio_desc *desc;
struct gpio_chip *chip; struct gpio_chip *chip;
int status = -EINVAL; int status = -EPROBE_DEFER;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&gpio_lock, flags); spin_lock_irqsave(&gpio_lock, flags);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册