of/platform: Unconditionally pause/resume sync state during kernel init
PATCH 1/1 of/platform: Unconditionally pause/resume sync state during kernel init
Commit 5e6669387e22 ("of/platform: Pause/resume sync state during init and of_platform_populate()") paused/resumed sync state during init only if Linux had parsed and populated a devicetree.
However, the check for that (of_have_populated_dt()) can change between initcall levels when device tree unittests are enabled. This causes an unmatched pause/resume of sync state. To avoid this, just unconditionally pause/resume sync state during init.
--- drivers/of/platform.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/of/platform.c +3 -3
@@ -518,10 +518,11 @@ static int __init of_platform_default_populate_init(void) {struct device_node *node; +device_links_supplier_sync_state_pause (); +if (!of_have_populated_dt ())return -ENODEV ; -device_links_supplier_sync_state_pause ();/* * Handle certain compatibles explicitly, since we don't want to create * platform_devices for every node in /reserved-memory with a
@@ -545,8 +546,7 @@ arch_initcall_sync(of_platform_default_populate_init);static int __init of_platform_sync_state_init (void ) { -if (of_have_populated_dt ()) -device_links_supplier_sync_state_resume (); +device_links_supplier_sync_state_resume ();return 0 ; }late_initcall_sync (of_platform_sync_state_init);
Signature · 1 line
2.24.0.393.g34dc348eaf-goog
Quoted 4 lines · Saravana Kannan
Commit
5e6669387e22("of/platform: Pause/resume sync state during init andof_platform_populate()") paused/resumed sync state during init only if Linux had parsed and populated a devicetree.
I _think_ (but I have not actually checked the code) that enabling unittests is not the only way that of_root can be changed from NULL (thus changing the value returned by of_have_populated_dt()). I _think_ that applying an overlay on top of an empty devicetree will have the same result. So I would change the following paragraph:
Quoted 4 lines
However, the check for that (
of_have_populated_dt()) can change between initcall levels when device tree unittests are enabled. This causes an unmatched pause/resume of sync state. To avoid this, just unconditionally pause/resume sync state during init.
to something like:
However, the check for that (of_have_populated_dt()) can change after of_platform_default_populate_init() executes. One example of this is when devicetree unittests are enabled. This causes an nmatched pause/resume of sync state. To avoid this, just unconditionally pause/resume sync state during init.
Quoted 27 lines
Fixes 5e6669387e22 ("of/platform: Pause/resume sync state during init and of_platform_populate()")Reported-by kernel test robot <[email protected]>Signed-off-by Saravana Kannan <[email protected]>--- drivers/of/platform.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/of/platform.c +2
-1@@ -518,10 +518,11 @@ static int __init of_platform_default_populate_init(void) {struct device_node *node; +device_links_supplier_sync_state_pause (); +if (!of_have_populated_dt ())return -ENODEV ; -device_links_supplier_sync_state_pause ();/* * Handle certain compatibles explicitly, since we don't want to create * platform_devices for every node in /reserved-memory with a
drivers/of/platform.c arch_initcall_sync(of_platform_default_populate_init); · line 552
Quoted 9 lines
drivers/of/platform.c +1
-2@@ -545,8 +546,7 @@ arch_initcall_sync(of_platform_default_populate_init);static int __init of_platform_sync_state_init (void ) { -if (of_have_populated_dt ()) -device_links_supplier_sync_state_resume (); +device_links_supplier_sync_state_resume ();return 0 ; }late_initcall_sync (of_platform_sync_state_init);