dm: core: Don't set pinctrl for pinctrl devices

There is sort-of race condition when a pinctrl device is probed. The pinctrl
function is called which may end up using the same device as is being
probed. This results in operations being used before the device is actually
probed.

For now, disallow pinctrl operations on pinctrl devices while probing. An
alternative solution would be to move the operation to later in the
device_probe() function (for pinctrl devices only) but this needs more
thought.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2016-01-21 19:43:25 -07:00
parent b6517a0d02
commit 0379597e55
1 changed files with 4 additions and 2 deletions

View File

@ -299,9 +299,11 @@ int device_probe_child(struct udevice *dev, void *parent_priv)
/*
* Process pinctrl for everything except the root device, and
* continue regardless of the result of pinctrl.
* continue regardless of the result of pinctrl. Don't process pinctrl
* settings for pinctrl devices since the device may not yet be
* probed.
*/
if (dev->parent)
if (dev->parent && device_get_uclass_id(dev) != UCLASS_PINCTRL)
pinctrl_select_state(dev, "default");
ret = uclass_pre_probe_device(dev);