Skip to content

Commit e935457

Browse files
broonielinusw
authored andcommitted
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: Mark Brown <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
1 parent 6d99471 commit e935457

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpio/gpiolib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1186,7 +1186,7 @@ int gpio_request(unsigned gpio, const char *label)
11861186
{
11871187
struct gpio_desc *desc;
11881188
struct gpio_chip *chip;
1189-
int status = -EINVAL;
1189+
int status = -EPROBE_DEFER;
11901190
unsigned long flags;
11911191

11921192
spin_lock_irqsave(&gpio_lock, flags);

0 commit comments

Comments
 (0)