1 From dc4310d9d45e72360b8fdf46d514b6d29c92e808 Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Sat, 2 Apr 2022 13:52:55 +0200
4 Subject: [PATCH] clk: Switch from __clk_determine_rate to
5 clk_core_round_rate_nolock
7 clk_mux_determine_rate_flags() will call into __clk_determine_rate()
8 with a clk_hw pointer, while it has access to the clk_core pointer
11 This leads to back and forth between clk_hw and clk_core, while
12 __clk_determine_rate will only call clk_core_round_rate_nolock() with
13 the clk_core pointer it retrieved from the clk_hw.
15 Let's simplify things a bit by calling into clk_core_round_rate_nolock
18 Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> # imx8mp
19 Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> # exynos4210, meson g12b
20 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
22 drivers/clk/clk.c | 13 ++++++++++---
23 1 file changed, 10 insertions(+), 3 deletions(-)
25 --- a/drivers/clk/clk.c
26 +++ b/drivers/clk/clk.c
27 @@ -553,6 +553,9 @@ static bool mux_is_better_rate(unsigned
28 return now <= rate && now > best;
31 +static int clk_core_round_rate_nolock(struct clk_core *core,
32 + struct clk_rate_request *req);
34 int clk_mux_determine_rate_flags(struct clk_hw *hw,
35 struct clk_rate_request *req,
37 @@ -566,8 +569,12 @@ int clk_mux_determine_rate_flags(struct
38 if (core->flags & CLK_SET_RATE_NO_REPARENT) {
39 parent = core->parent;
40 if (core->flags & CLK_SET_RATE_PARENT) {
41 - ret = __clk_determine_rate(parent ? parent->hw : NULL,
48 + ret = clk_core_round_rate_nolock(parent, &parent_req);
52 @@ -590,7 +597,7 @@ int clk_mux_determine_rate_flags(struct
54 if (core->flags & CLK_SET_RATE_PARENT) {
56 - ret = __clk_determine_rate(parent->hw, &parent_req);
57 + ret = clk_core_round_rate_nolock(parent, &parent_req);