[PATCH] clk: correct clk_set_rate for clocks with CLK_GET_RATE_NOCACHE

From: Ciprian Costea
Date: Mon Apr 14 2025 - 08:35:58 EST


From: Ciprian Marian Costea <ciprianmarian.costea@xxxxxxxxxxx>

According to CLK_GET_RATE_NOCACHE documentation, when this flag is
present, the framework shouldn't use the cached rate of a clock. However,
this doesn't happen during clk_core_set_rate_nolock, part of the
clk_set_rate flow. clk_core_get_rate_nolock was called instead of
clk_core_get_rate_recalc, which should be used to consider the presence of
the CLK_GET_RATE_NOCACHE flag when setting the clock rate.

Co-developed-by: Ghennadi Procopciuc <ghennadi.procopciuc@xxxxxxx>
Signed-off-by: Ghennadi Procopciuc <ghennadi.procopciuc@xxxxxxx>
Signed-off-by: Ciprian Marian Costea <ciprianmarian.costea@xxxxxxxxxxx>
---
drivers/clk/clk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 0565c87656cf..d85a6aac0f3c 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -2530,7 +2530,7 @@ static int clk_core_set_rate_nolock(struct clk_core *core,
rate = clk_core_req_round_rate_nolock(core, req_rate);

/* bail early if nothing to do */
- if (rate == clk_core_get_rate_nolock(core))
+ if (rate == clk_core_get_rate_recalc(core))
return 0;

/* fail on a direct rate set of a protected provider */
--
2.45.2