Commit 72678f7a authored by Richard Fitzgerald's avatar Richard Fitzgerald Committed by Greg Kroah-Hartman

pinctrl: devicetree: Fix dt_to_map_one_config handling of hogs

[ Upstream commit b89405b6 ]

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: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 39c655c5
...@@ -122,8 +122,10 @@ static int dt_to_map_one_config(struct pinctrl *p, ...@@ -122,8 +122,10 @@ static int dt_to_map_one_config(struct pinctrl *p,
/* OK let's just assume this will appear later then */ /* OK let's just assume this will appear later then */
return -EPROBE_DEFER; return -EPROBE_DEFER;
} }
if (!pctldev) /* If we're creating a hog we can use the passed pctldev */
pctldev = get_pinctrl_dev_from_of_node(np_pctldev); if (pctldev && (np_pctldev == p->dev->of_node))
break;
pctldev = get_pinctrl_dev_from_of_node(np_pctldev);
if (pctldev) if (pctldev)
break; break;
/* Do not defer probing of hogs (circular loop) */ /* Do not defer probing of hogs (circular loop) */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment