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@xxxxxxxxx> --- Cc: barebox@xxxxxxxxxxxxxxxxxxx --- drivers/gpio/gpiolib.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 611e41ea5606..1f57c76ec16d 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -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 -- 2.1.0 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox