]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
pinctrl: implement pinctrl deferred probing
authorLinus Walleij <linus.walleij@linaro.org>
Tue, 10 Apr 2012 08:00:38 +0000 (10:00 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 10 Apr 2012 08:00:38 +0000 (10:00 +0200)
If drivers try to obtain pinctrl handles for a pin controller that
has not yet registered to the subsystem, we need to be able to
back out and retry with deferred probing. So let's return
-EPROBE_DEFER whenever this location fails.

Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Documentation/pinctrl.txt
drivers/pinctrl/core.c
drivers/pinctrl/devicetree.c

index eb46b1c0b07a0710b6eb8465320ea9063d8a7e50..4431c3e727ba49d632116fb078dcbd80704bca51 100644 (file)
@@ -1043,6 +1043,11 @@ quickly poking some registers.
 The pins are allocated for your device when you issue the pinctrl_get() call,
 after this you should be able to see this in the debugfs listing of all pins.
 
+NOTE: the pinctrl system will return -EPROBE_DEFER if it cannot find the
+requested pinctrl handles, for example if the pinctrl driver has not yet
+registered. Thus make sure that the error path in your driver gracefully
+cleans up and is ready to retry the probing later in the startup process.
+
 
 System pin control hogging
 ==========================
index 7ff869007ba48b8c43442bd4ad1d9a0273e4865e..3ae00ab4f535cefc47874efde11be59f18bcced2 100644 (file)
@@ -521,8 +521,11 @@ static int add_setting(struct pinctrl *p, struct pinctrl_map const *map)
                dev_err(p->dev, "unknown pinctrl device %s in map entry",
                        map->ctrl_dev_name);
                kfree(setting);
-               /* Eventually, this should trigger deferred probe */
-               return -ENODEV;
+               /*
+                * OK let us guess that the driver is not there yet, and
+                * let's defer obtaining this pinctrl handle to later...
+                */
+               return -EPROBE_DEFER;
        }
 
        switch (map->type) {
index 5ef2feb443954162ec06515ae7e4f4cda2411530..8833538b9a7f720214c25da7cae9b8951df6c0ef 100644 (file)
@@ -124,8 +124,8 @@ static int dt_to_map_one_config(struct pinctrl *p, const char *statename,
                        dev_err(p->dev, "could not find pctldev for node %s\n",
                                np_config->full_name);
                        of_node_put(np_pctldev);
-                       /* FIXME: This should trigger deferrered probe */
-                       return -ENODEV;
+                       /* OK let's just assume this will appear later then */
+                       return -EPROBE_DEFER;
                }
                pctldev = find_pinctrl_by_of_node(np_pctldev);
                if (pctldev)