public inbox for linux-clk@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] clk: Mark a fwnode as initialized when using CLK_OF_DECLARE* macros
@ 2023-03-01  1:25 Saravana Kannan
  2023-03-01 12:10 ` Linus Walleij
  2023-03-01 20:40 ` Stephen Boyd
  0 siblings, 2 replies; 8+ messages in thread
From: Saravana Kannan @ 2023-03-01  1:25 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Greg Kroah-Hartman,
	Saravana Kannan
  Cc: Linus Walleij, kernel-team, linux-clk, linux-kernel

The CLK_OF_DECLARE macros sometimes prevent the creation of struct
devices for the device node being handled. It does this by
setting/clearing OF_POPULATED flag. This can block the probing of some
devices because fw_devlink will block the consumers of this node till a
struct device is created and probed.

Set the appropriate fwnode flags when these device nodes are initialized
by the clock framework and when OF_POPULATED flag is set/cleared. This
will allow fw_devlink to handle the dependencies correctly.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reported-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/lkml/CACRpkdamxDX6EBVjKX5=D3rkHp17f5pwGdBVhzFU90-0MHY6dQ@mail.gmail.com/
Fixes: 4a032827daa8 ("of: property: Simplify of_link_to_phandle()")
Signed-off-by: Saravana Kannan <saravanak@google.com>
---

This is fixing a patch that landed through driver core. So, should Greg
be pulling in this fix?

-Saravana

 drivers/clk/clk.c            | 4 ++++
 include/linux/clk-provider.h | 1 +
 2 files changed, 5 insertions(+)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index ae07685c7588..8bd5b9841993 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -5361,6 +5361,10 @@ void __init of_clk_init(const struct of_device_id *matches)
 				clk_provider->clk_init_cb(clk_provider->np);
 				of_clk_set_defaults(clk_provider->np, true);
 
+				fwnode_dev_initialized(
+					of_fwnode_handle(clk_provider->np),
+					true);
+
 				list_del(&clk_provider->node);
 				of_node_put(clk_provider->np);
 				kfree(clk_provider);
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 842e72a5348f..93c0b06a0f2b 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -1373,6 +1373,7 @@ struct clk_hw_onecell_data {
 	static void __init name##_of_clk_init_driver(struct device_node *np) \
 	{								\
 		of_node_clear_flag(np, OF_POPULATED);			\
+		fwnode_dev_initialized(of_fwnode_handle(np), false);	\
 		fn(np);							\
 	}								\
 	OF_DECLARE_1(clk, name, compat, name##_of_clk_init_driver)
-- 
2.39.2.722.g9855ee24e9-goog


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-03-01 23:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-01  1:25 [PATCH v1] clk: Mark a fwnode as initialized when using CLK_OF_DECLARE* macros Saravana Kannan
2023-03-01 12:10 ` Linus Walleij
2023-03-01 20:40 ` Stephen Boyd
2023-03-01 20:45   ` Saravana Kannan
2023-03-01 20:48   ` Stephen Boyd
2023-03-01 21:25     ` Saravana Kannan
2023-03-01 22:45       ` Stephen Boyd
2023-03-01 23:52         ` Saravana Kannan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox