Merge tag 'mac80211-next-for-davem-2015-01-15' of git://git.kernel.org/pub/scm/linux...
[firefly-linux-kernel-4.4.55.git] / drivers / gpio / gpiolib-legacy.c
index 078ae6c2df795a06daf3354fcdb92c8db657d291..8b830996fe0212d3ae0153ae5b708a84fa53976e 100644 (file)
@@ -24,6 +24,10 @@ int gpio_request_one(unsigned gpio, unsigned long flags, const char *label)
 
        desc = gpio_to_desc(gpio);
 
+       /* Compatibility: assume unavailable "valid" GPIOs will appear later */
+       if (!desc && gpio_is_valid(gpio))
+               return -EPROBE_DEFER;
+
        err = gpiod_request(desc, label);
        if (err)
                return err;
@@ -62,7 +66,13 @@ EXPORT_SYMBOL_GPL(gpio_request_one);
 
 int gpio_request(unsigned gpio, const char *label)
 {
-       return gpiod_request(gpio_to_desc(gpio), label);
+       struct gpio_desc *desc = gpio_to_desc(gpio);
+
+       /* Compatibility: assume unavailable "valid" GPIOs will appear later */
+       if (!desc && gpio_is_valid(gpio))
+               return -EPROBE_DEFER;
+
+       return gpiod_request(desc, label);
 }
 EXPORT_SYMBOL_GPL(gpio_request);