lkml.org 
[lkml]   [2020]   [Oct]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[PATCH v1] of: platform: Batch fwnode parsing in the init_machine() path
From
When commit 93d2e4322aa7 ("of: platform: Batch fwnode parsing when
adding all top level devices") optimized the fwnode parsing when all top
level devices are added, it missed out optimizing this for platform
where the top level devices are added through the init_machine() path.

This commit does the optimization for all paths by simply moving the
fw_devlink_pause/resume() inside of_platform_default_populate().

Reported-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Saravana Kannan <saravanak@google.com>
---
drivers/of/platform.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 071f04da32c8..79972e49b539 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -501,8 +501,21 @@ int of_platform_default_populate(struct device_node *root,
const struct of_dev_auxdata *lookup,
struct device *parent)
{
- return of_platform_populate(root, of_default_bus_match_table, lookup,
- parent);
+ int ret;
+
+ /*
+ * fw_devlink_pause/resume() are only safe to be called around top
+ * level device addition due to locking constraints.
+ */
+ if (!root)
+ fw_devlink_pause();
+
+ ret = of_platform_populate(root, of_default_bus_match_table, lookup,
+ parent);
+
+ if (!root)
+ fw_devlink_resume();
+ return ret;
}
EXPORT_SYMBOL_GPL(of_platform_default_populate);

@@ -538,9 +551,7 @@ static int __init of_platform_default_populate_init(void)
}

/* Populate everything else. */
- fw_devlink_pause();
of_platform_default_populate(NULL, NULL, NULL);
- fw_devlink_resume();

return 0;
}
--
2.28.0.709.gb0816b6eb0-goog
\
 
 \ /
  Last update: 2020-10-02 01:01    [W:0.074 / U:33.812 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site