aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Fitzgerald <rf@opensource.cirrus.com>2018-02-28 10:53:06 -0500
committerLinus Walleij <linus.walleij@linaro.org>2018-03-02 03:41:21 -0500
commitb89405b6102fcc3746f43697b826028caa94c823 (patch)
treeedf3dbab652aad27a849b6b3f12ad4874f55cde1
parent536836d32cbc96af91f15add43f8960ffdac5569 (diff)
pinctrl: devicetree: Fix dt_to_map_one_config handling of hogs
When dt_to_map_one_config() is called with a pinctrl_dev passed in, it should only be using this if the node being looked up is a hog. The code was always using the passed pinctrl_dev without checking whether the dt node referred to it. A pin controller can have pinctrl-n dependencies on other pin controllers in these cases: - the pin controller hardware is external, for example I2C, so needs other pin controller(s) to be setup to communicate with the hardware device. - it is a child of a composite MFD so its of_node is shared with the parent MFD and other children of that MFD. Any part of that MFD could have dependencies on other pin controllers. Because of this, dt_to_map_one_config() can't assume that if it has a pinctrl_dev passed in then the node it looks up must be a hog. It could be a reference to some other pin controller. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--drivers/pinctrl/devicetree.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/pinctrl/devicetree.c b/drivers/pinctrl/devicetree.c
index 1ff6c3573493..b601039d6c69 100644
--- a/drivers/pinctrl/devicetree.c
+++ b/drivers/pinctrl/devicetree.c
@@ -122,8 +122,10 @@ static int dt_to_map_one_config(struct pinctrl *p,
122 /* OK let's just assume this will appear later then */ 122 /* OK let's just assume this will appear later then */
123 return -EPROBE_DEFER; 123 return -EPROBE_DEFER;
124 } 124 }
125 if (!pctldev) 125 /* If we're creating a hog we can use the passed pctldev */
126 pctldev = get_pinctrl_dev_from_of_node(np_pctldev); 126 if (pctldev && (np_pctldev == p->dev->of_node))
127 break;
128 pctldev = get_pinctrl_dev_from_of_node(np_pctldev);
127 if (pctldev) 129 if (pctldev)
128 break; 130 break;
129 /* Do not defer probing of hogs (circular loop) */ 131 /* Do not defer probing of hogs (circular loop) */