]> git.karo-electronics.de Git - linux-beck.git/commitdiff
pinctrl: make range registration defer properly
authorLinus Walleij <linus.walleij@linaro.org>
Tue, 20 Nov 2012 13:54:18 +0000 (14:54 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 21 Nov 2012 07:55:10 +0000 (08:55 +0100)
This makes the pinctrl_find_and_add_gpio_range() return
-EPROBE_DEFER if the range hosting pin controller cannot be
located. We may assume that the common case for why adding a
range fails is that the targe pin controller device has not
probed yet.

Reviewed-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/core.c

index 15f5ac864f14fb50b52ef0da22212e877a9e9690..33af811a6a3cd19cf32cd84655b80d2bc8fe3321 100644 (file)
@@ -350,8 +350,13 @@ struct pinctrl_dev *pinctrl_find_and_add_gpio_range(const char *devname,
 {
        struct pinctrl_dev *pctldev = get_pinctrl_dev_from_devname(devname);
 
+       /*
+        * If we can't find this device, let's assume that is because
+        * it has not probed yet, so the driver trying to register this
+        * range need to defer probing.
+        */
        if (!pctldev)
-               return NULL;
+               return ERR_PTR(-EPROBE_DEFER);
 
        pinctrl_add_gpio_range(pctldev, range);
        return pctldev;