diff options
author | Maxime Ripard <[email protected]> | 2022-08-16 13:25:23 +0200 |
---|---|---|
committer | Stephen Boyd <[email protected]> | 2022-09-15 09:31:53 -0700 |
commit | 666650b25ac43700a1cce96e51a32fc89c973d28 (patch) | |
tree | 922c69ec5462fb229f8bed9f802723ad2b641113 | |
parent | 11c84a38fcff30197f6e8af29e65531a5734ee05 (diff) |
clk: Switch from __clk_determine_rate to clk_core_round_rate_nolock
clk_mux_determine_rate_flags() will call into __clk_determine_rate()
with a clk_hw pointer, while it has access to the clk_core pointer
already.
This leads to back and forth between clk_hw and clk_core, while
__clk_determine_rate will only call clk_core_round_rate_nolock() with
the clk_core pointer it retrieved from the clk_hw.
Let's simplify things a bit by calling into clk_core_round_rate_nolock
directly.
Tested-by: Alexander Stein <[email protected]> # imx8mp
Tested-by: Marek Szyprowski <[email protected]> # exynos4210, meson g12b
Signed-off-by: Maxime Ripard <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Tested-by: Linux Kernel Functional Testing <[email protected]>
Tested-by: Naresh Kamboju <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>
-rw-r--r-- | drivers/clk/clk.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 2794bd3bef4b..f8a8bdd552d6 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -536,6 +536,9 @@ static bool mux_is_better_rate(unsigned long rate, unsigned long now, return now <= rate && now > best; } +static int clk_core_round_rate_nolock(struct clk_core *core, + struct clk_rate_request *req); + int clk_mux_determine_rate_flags(struct clk_hw *hw, struct clk_rate_request *req, unsigned long flags) @@ -549,8 +552,12 @@ int clk_mux_determine_rate_flags(struct clk_hw *hw, if (core->flags & CLK_SET_RATE_NO_REPARENT) { parent = core->parent; if (core->flags & CLK_SET_RATE_PARENT) { - ret = __clk_determine_rate(parent ? parent->hw : NULL, - &parent_req); + if (!parent) { + req->rate = 0; + return 0; + } + + ret = clk_core_round_rate_nolock(parent, &parent_req); if (ret) return ret; @@ -573,7 +580,7 @@ int clk_mux_determine_rate_flags(struct clk_hw *hw, if (core->flags & CLK_SET_RATE_PARENT) { parent_req = *req; - ret = __clk_determine_rate(parent->hw, &parent_req); + ret = clk_core_round_rate_nolock(parent, &parent_req); if (ret) continue; } else { |