linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: Check ops are available in clk_gate_restore_context
@ 2024-01-20 10:07 Cristian Marussi
  2024-04-09 11:31 ` Stephen Boyd
  0 siblings, 1 reply; 2+ messages in thread
From: Cristian Marussi @ 2024-01-20 10:07 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel
  Cc: sudeep.holla, peng.fan, Cristian Marussi, Michael Turquette,
	Stephen Boyd, linux-clk

Add a check in clk_gate_restore_context() to assure that the clock enable
and disable ops are available before calling them.

CC: Michael Turquette <mturquette@baylibre.com>
CC: Stephen Boyd <sboyd@kernel.org>
CC: linux-clk@vger.kernel.org
Fixes: 9be766274db4 ("clk: Clean up suspend/resume coding style")
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
Spotted this by code inspection.
I may be missing something, though, given my limited familiarity with CLK.
---
 drivers/clk/clk.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index f0940af485a5..79b90a8099d7 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1200,9 +1200,11 @@ void clk_gate_restore_context(struct clk_hw *hw)
 	struct clk_core *core = hw->core;
 
 	if (core->enable_count)
-		core->ops->enable(hw);
+		if (core->ops->enable)
+			core->ops->enable(hw);
 	else
-		core->ops->disable(hw);
+		if (core->ops->disable)
+			core->ops->disable(hw);
 }
 EXPORT_SYMBOL_GPL(clk_gate_restore_context);
 
-- 
2.43.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] clk: Check ops are available in clk_gate_restore_context
  2024-01-20 10:07 [PATCH] clk: Check ops are available in clk_gate_restore_context Cristian Marussi
@ 2024-04-09 11:31 ` Stephen Boyd
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Boyd @ 2024-04-09 11:31 UTC (permalink / raw)
  To: Cristian Marussi, linux-arm-kernel, linux-kernel
  Cc: sudeep.holla, peng.fan, Cristian Marussi, Michael Turquette,
	linux-clk

Quoting Cristian Marussi (2024-01-20 02:07:11)
> Add a check in clk_gate_restore_context() to assure that the clock enable
> and disable ops are available before calling them.
> 
> CC: Michael Turquette <mturquette@baylibre.com>
> CC: Stephen Boyd <sboyd@kernel.org>
> CC: linux-clk@vger.kernel.org
> Fixes: 9be766274db4 ("clk: Clean up suspend/resume coding style")
> Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
> ---
> Spotted this by code inspection.
> I may be missing something, though, given my limited familiarity with CLK.

It assumes this is for a gate clk, which has enable/disable clk ops.
Also, only TI uses this code and I suggest you don't use it.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2024-04-09 11:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-20 10:07 [PATCH] clk: Check ops are available in clk_gate_restore_context Cristian Marussi
2024-04-09 11:31 ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).