[v4,6/8] of/platform: Pause/resume sync state in of_platform_populate()
diff mbox series

Message ID 20190708225624.119973-7-saravanak@google.com
State Superseded
Headers show
  • Solve postboot supplier cleanup and optimize probe ordering
Related show

Commit Message

Saravana Kannan July 8, 2019, 10:56 p.m. UTC
When multiple child devices are populated using of_platform_populate()
after kernel init, there could be supplier-consumer dependencies between
the child devices.

Wait for all the devices to be added and linked before calling sync_state()
on all the suppliers.

Signed-off-by: Saravana Kannan <saravanak@google.com>
 drivers/of/platform.c | 3 +++
 1 file changed, 3 insertions(+)

diff mbox series

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 56b718f09929..dba962a0ee50 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -486,6 +486,7 @@  int of_platform_populate(struct device_node *root,
 	pr_debug("%s()\n", __func__);
 	pr_debug(" starting at: %pOF\n", root);
+	device_links_supplier_sync_state_pause();
 	for_each_child_of_node(root, child) {
 		rc = of_platform_bus_create(child, matches, lookup, parent, true);
 		if (rc) {
@@ -493,6 +494,8 @@  int of_platform_populate(struct device_node *root,
+	device_links_supplier_sync_state_resume();
 	of_node_set_flag(root, OF_POPULATED_BUS);