Skip to content

Commit 666650b

Browse files
mripardbebarino
authored andcommitted
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 <alexander.stein@ew.tq-group.com> # imx8mp Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> # exynos4210, meson g12b Signed-off-by: Maxime Ripard <maxime@cerno.tech> Link: https://lore.kernel.org/r/20220816112530.1837489-19-maxime@cerno.tech Tested-by: Linux Kernel Functional Testing <lkft@linaro.org> Tested-by: Naresh Kamboju <naresh.kamboju@linaro.org> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent 11c84a3 commit 666650b

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

drivers/clk/clk.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,9 @@ static bool mux_is_better_rate(unsigned long rate, unsigned long now,
536536
return now <= rate && now > best;
537537
}
538538

539+
static int clk_core_round_rate_nolock(struct clk_core *core,
540+
struct clk_rate_request *req);
541+
539542
int clk_mux_determine_rate_flags(struct clk_hw *hw,
540543
struct clk_rate_request *req,
541544
unsigned long flags)
@@ -549,8 +552,12 @@ int clk_mux_determine_rate_flags(struct clk_hw *hw,
549552
if (core->flags & CLK_SET_RATE_NO_REPARENT) {
550553
parent = core->parent;
551554
if (core->flags & CLK_SET_RATE_PARENT) {
552-
ret = __clk_determine_rate(parent ? parent->hw : NULL,
553-
&parent_req);
555+
if (!parent) {
556+
req->rate = 0;
557+
return 0;
558+
}
559+
560+
ret = clk_core_round_rate_nolock(parent, &parent_req);
554561
if (ret)
555562
return ret;
556563

@@ -573,7 +580,7 @@ int clk_mux_determine_rate_flags(struct clk_hw *hw,
573580

574581
if (core->flags & CLK_SET_RATE_PARENT) {
575582
parent_req = *req;
576-
ret = __clk_determine_rate(parent->hw, &parent_req);
583+
ret = clk_core_round_rate_nolock(parent, &parent_req);
577584
if (ret)
578585
continue;
579586
} else {

0 commit comments

Comments
 (0)