diff mbox series

[07/12] clk: Fail duty cycle APIs after clk_hw is unregistered

Message ID 20240815005520.1192374-8-sboyd@kernel.org (mailing list archive)
State New
Headers show
Series clk: Unit test clk unregistration paths | expand

Commit Message

Stephen Boyd Aug. 15, 2024, 12:55 a.m. UTC
The clk duty cycle APIs don't fail when a clk_hw is unregistered. Add a
nodrv clk_op that returns failure so that clk_set_duty_cycle() starts
failing after a clk_hw is unregistered.

Cc: Nuno Sá <nuno.sa@analog.com>
Fixes: 9fba738a53dd ("clk: add duty cycle support")
Signed-off-by: Stephen Boyd <sboyd@kernel.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 8909294cc52e..a0c275e156ad 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -4518,6 +4518,11 @@  static int clk_nodrv_set_phase(struct clk_hw *hw, int degrees)
 	return -ENXIO;
 }
 
+static int clk_nodrv_set_duty_cycle(struct clk_hw *hw, struct clk_duty *duty)
+{
+	return -ENXIO;
+}
+
 static const struct clk_ops clk_nodrv_ops = {
 	.enable		= clk_nodrv_prepare_enable_get_phase,
 	.disable	= clk_nodrv_disable_unprepare,
@@ -4528,6 +4533,7 @@  static const struct clk_ops clk_nodrv_ops = {
 	.set_parent	= clk_nodrv_set_parent,
 	.get_phase	= clk_nodrv_prepare_enable_get_phase,
 	.set_phase	= clk_nodrv_set_phase,
+	.set_duty_cycle	= clk_nodrv_set_duty_cycle,
 };
 
 static void clk_core_evict_parent_cache_subtree(struct clk_core *root,