diff mbox series

[RFC,4/4] clk: Skip disabling clocks if they have consumers

Message ID 20220707100309.1357663-4-abel.vesa@linaro.org
State New
Headers show
Series [RFC,1/4] clk: Use clk_core_unlink_consumer on __clk_put | expand

Commit Message

Abel Vesa July 7, 2022, 10:03 a.m. UTC
If a clock has already consumers, it should be considered as used.
So clk_disable_unused should leave it as is.

Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
---
 drivers/clk/clk.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index e412e83a6e28..6cce31ea4f72 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1228,6 +1228,9 @@  static void __init clk_unprepare_unused_subtree(struct clk_core *core)
 	hlist_for_each_entry(child, &core->children, child_node)
 		clk_unprepare_unused_subtree(child);
 
+	if (core->consumers_count)
+		return;
+
 	if (core->prepare_count)
 		return;
 
@@ -1259,6 +1262,9 @@  static void __init clk_disable_unused_subtree(struct clk_core *core)
 	hlist_for_each_entry(child, &core->children, child_node)
 		clk_disable_unused_subtree(child);
 
+	if (core->consumers_count)
+		return;
+
 	if (core->flags & CLK_OPS_PARENT_ENABLE)
 		clk_core_prepare_enable(core->parent);