aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2012-04-10 04:00:38 -0400
committerLinus Walleij <linus.walleij@linaro.org>2012-04-18 07:53:11 -0400
commitc05127c4e2c6e7d9949347a76fd05c337bcd5e84 (patch)
tree5b23f8a116919028317f026e3f9998dce2ffb828
parentad8bb720c23a80233e45ed31d67458f5e5b7ab31 (diff)
pinctrl: implement pinctrl deferred probing
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. Also downgrade the errors to info, maybe we will even set them to debug once the deferred probing is commonplace. Cc: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Stephen Warren <swarren@wwwdotorg.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--Documentation/pinctrl.txt5
-rw-r--r--drivers/pinctrl/core.c9
-rw-r--r--drivers/pinctrl/devicetree.c6
3 files changed, 14 insertions, 6 deletions
diff --git a/Documentation/pinctrl.txt b/Documentation/pinctrl.txt
index eb46b1c0b07..4431c3e727b 100644
--- a/Documentation/pinctrl.txt
+++ b/Documentation/pinctrl.txt
@@ -1043,6 +1043,11 @@ quickly poking some registers.
1043The pins are allocated for your device when you issue the pinctrl_get() call, 1043The pins are allocated for your device when you issue the pinctrl_get() call,
1044after this you should be able to see this in the debugfs listing of all pins. 1044after this you should be able to see this in the debugfs listing of all pins.
1045 1045
1046NOTE: the pinctrl system will return -EPROBE_DEFER if it cannot find the
1047requested pinctrl handles, for example if the pinctrl driver has not yet
1048registered. Thus make sure that the error path in your driver gracefully
1049cleans up and is ready to retry the probing later in the startup process.
1050
1046 1051
1047System pin control hogging 1052System pin control hogging
1048========================== 1053==========================
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 7ff869007ba..59027ab8347 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -518,11 +518,14 @@ static int add_setting(struct pinctrl *p, struct pinctrl_map const *map)
518 518
519 setting->pctldev = get_pinctrl_dev_from_devname(map->ctrl_dev_name); 519 setting->pctldev = get_pinctrl_dev_from_devname(map->ctrl_dev_name);
520 if (setting->pctldev == NULL) { 520 if (setting->pctldev == NULL) {
521 dev_err(p->dev, "unknown pinctrl device %s in map entry", 521 dev_info(p->dev, "unknown pinctrl device %s in map entry, deferring probe",
522 map->ctrl_dev_name); 522 map->ctrl_dev_name);
523 kfree(setting); 523 kfree(setting);
524 /* Eventually, this should trigger deferred probe */ 524 /*
525 return -ENODEV; 525 * OK let us guess that the driver is not there yet, and
526 * let's defer obtaining this pinctrl handle to later...
527 */
528 return -EPROBE_DEFER;
526 } 529 }
527 530
528 switch (map->type) { 531 switch (map->type) {
diff --git a/drivers/pinctrl/devicetree.c b/drivers/pinctrl/devicetree.c
index 5ef2feb4439..fcb1de45473 100644
--- a/drivers/pinctrl/devicetree.c
+++ b/drivers/pinctrl/devicetree.c
@@ -121,11 +121,11 @@ static int dt_to_map_one_config(struct pinctrl *p, const char *statename,
121 for (;;) { 121 for (;;) {
122 np_pctldev = of_get_next_parent(np_pctldev); 122 np_pctldev = of_get_next_parent(np_pctldev);
123 if (!np_pctldev || of_node_is_root(np_pctldev)) { 123 if (!np_pctldev || of_node_is_root(np_pctldev)) {
124 dev_err(p->dev, "could not find pctldev for node %s\n", 124 dev_info(p->dev, "could not find pctldev for node %s, deferring probe\n",
125 np_config->full_name); 125 np_config->full_name);
126 of_node_put(np_pctldev); 126 of_node_put(np_pctldev);
127 /* FIXME: This should trigger deferrered probe */ 127 /* OK let's just assume this will appear later then */
128 return -ENODEV; 128 return -EPROBE_DEFER;
129 } 129 }
130 pctldev = find_pinctrl_by_of_node(np_pctldev); 130 pctldev = find_pinctrl_by_of_node(np_pctldev);
131 if (pctldev) 131 if (pctldev)