gpio: Return -EPROBE_DEFER on gpio_get_num()
GPIO drivers can be registered quite late in registration process causing dependant devices to fail probing. If we know gpio_get_num will be called with a non-NULL device, return -EPROBE_DEFER instead of -ENODEV to allow re-probing later. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
ab3da15bc1
commit
9744da2e2b
|
@ -292,12 +292,15 @@ int gpio_get_num(struct device_d *dev, int gpio)
|
|||
{
|
||||
struct gpio_chip *chip;
|
||||
|
||||
if (!dev)
|
||||
return -ENODEV;
|
||||
|
||||
list_for_each_entry(chip, &chip_list, list) {
|
||||
if (chip->dev == dev)
|
||||
return chip->base + gpio;
|
||||
}
|
||||
|
||||
return -ENODEV;
|
||||
return -EPROBE_DEFER;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_CMD_GPIO
|
||||
|
|
Loading…
Reference in New Issue