The gpio library should return -EPROBE_DEFER in gpio_request
if gpio driver is not ready. If drivers pass this error code through to
their caller (which they really should) then this will ensure that the
probe is retried later when further devices become available.

Signed-off-by: G, Manjunath Kondaiah <manj...@ti.com>
---
Cc: linux-omap@vger.kernel.org
Cc: linux-...@vger.kernel.org
Cc: linux-ker...@vger.kernel.org
Cc: Grant Likely <grant.lik...@secretlab.ca>
Cc: Greg Kroah-Hartman <g...@kroah.com>
Cc: Dilan Lee <di...@nvidia.com>
Cc: Mark Brown <broo...@opensource.wolfsonmicro.com>
Cc: Manjunath GKondaiah <manjunath.gkonda...@linaro.org>
Cc: Arnd Bergmann <a...@arndb.de>

 drivers/gpio/gpiolib.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index a971e3d..9081ef8 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1177,13 +1177,15 @@ 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);
 
-       if (!gpio_is_valid(gpio))
+       if (!gpio_is_valid(gpio)) {
+               status = -EINVAL;
                goto done;
+       }
        desc = &gpio_desc[gpio];
        chip = desc->chip;
        if (chip == NULL)
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to