diff mbox series

[08/11] dm: core: Add a comment about pinctrl_select_state()

Message ID 20210121205716.964652-9-sjg@chromium.org
State Accepted
Commit 017d421828971f6adbfa6a1305b80da7d620c596
Delegated to: Simon Glass
Headers show
Series More minor clean-ups and improvements | expand

Commit Message

Simon Glass Jan. 21, 2021, 8:57 p.m. UTC
The use of pinctrl in the core of driver model is useful but can provoke
some strange behaviour. Add a comment to aid debugging.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/core/device.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Simon Glass Jan. 30, 2021, 9:27 p.m. UTC | #1
The use of pinctrl in the core of driver model is useful but can provoke
some strange behaviour. Add a comment to aid debugging.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/core/device.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/drivers/core/device.c b/drivers/core/device.c
index aeab3836ed7..8629df8defb 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -462,6 +462,15 @@  int device_probe(struct udevice *dev)
 	 * continue regardless of the result of pinctrl. Don't process pinctrl
 	 * settings for pinctrl devices since the device may not yet be
 	 * probed.
+	 *
+	 * This call can produce some non-intuitive results. For example, on an
+	 * x86 device where dev is the main PCI bus, the pinctrl device may be
+	 * child or grandchild of that bus, meaning that the child will be
+	 * probed here. If the child happens to be the P2SB and the pinctrl
+	 * device is a child of that, then both the pinctrl and P2SB will be
+	 * probed by this call. This works because the DM_FLAG_ACTIVATED flag
+	 * is set just above. However, the PCI bus' probe() method and
+	 * associated uclass methods have not yet been called.
 	 */
 	if (dev->parent && device_get_uclass_id(dev) != UCLASS_PINCTRL)
 		pinctrl_select_state(dev, "default");