diff mbox series

[v2,2/2] clk: core: Fix runtime PM sequence in clk_core_unprepare()

Message ID 20220713082111.2233016-3-wenst@chromium.org (mailing list archive)
State Superseded, archived
Headers show
Series clk: Fix CLK_OPS_PARENT_ENABLE and runtime PM | expand

Commit Message

Chen-Yu Tsai July 13, 2022, 8:21 a.m. UTC
In the original commit 9a34b45397e5 ("clk: Add support for runtime PM"),
the commit message mentioned that pm_runtime_put_sync() would be done
at the end of clk_core_unprepare(). This mirrors the operations in
clk_core_prepare() in the opposite order.

However, the actual code that was added wasn't in the order the commit
message described. Move clk_pm_runtime_put() to the end of
clk_core_unprepare() so that it is in the correct order.

Fixes: 9a34b45397e5 ("clk: Add support for runtime PM")
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
 drivers/clk/clk.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Nícolas F. R. A. Prado July 18, 2022, 10:22 p.m. UTC | #1
On Wed, Jul 13, 2022 at 04:21:11PM +0800, Chen-Yu Tsai wrote:
> In the original commit 9a34b45397e5 ("clk: Add support for runtime PM"),
> the commit message mentioned that pm_runtime_put_sync() would be done
> at the end of clk_core_unprepare(). This mirrors the operations in
> clk_core_prepare() in the opposite order.
> 
> However, the actual code that was added wasn't in the order the commit
> message described. Move clk_pm_runtime_put() to the end of
> clk_core_unprepare() so that it is in the correct order.
> 
> Fixes: 9a34b45397e5 ("clk: Add support for runtime PM")
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>

Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>

Thanks,
Nícolas
diff mbox series

Patch

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 9b365cd6d14b..2e29a72c68e1 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -859,13 +859,12 @@  static void clk_core_unprepare(struct clk_core *core)
 	if (core->ops->unprepare)
 		core->ops->unprepare(core->hw);
 
-	clk_pm_runtime_put(core);
-
 	trace_clk_unprepare_complete(core);
 
 	if (core->flags & CLK_OPS_PARENT_ENABLE)
 		clk_core_disable_lock(core->parent);
 	clk_core_unprepare(core->parent);
+	clk_pm_runtime_put(core);
 }
 
 static void clk_core_unprepare_lock(struct clk_core *core)