1d3f213f54a0b35279490f2bb405f3a129201280
[openwrt/staging/noltari.git] /
1 From 30e22b06c4ea57dba7ac18bf4ee229eda0705b73 Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Sat, 2 Apr 2022 13:45:05 +0200
4 Subject: [PATCH] clk: Add our request boundaries in
5 clk_core_init_rate_req
6
7 The expectation is that a new clk_rate_request is initialized through a
8 call to clk_core_init_rate_req().
9
10 However, at the moment it only fills the parent rate and clk_hw pointer,
11 but omits the other fields such as the clock rate boundaries.
12
13 Some users of that function will update them after calling it, but most
14 don't.
15
16 As we are passed the clk_core pointer, we have access to those
17 boundaries in clk_core_init_rate_req() however, so let's just fill it
18 there and remove it from the few callers that do it right.
19
20 Tested-by: Alexander Stein <alexander.stein@ew.tq-group.com> # imx8mp
21 Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> # exynos4210, meson g12b
22 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
23 ---
24 drivers/clk/clk.c | 6 ++----
25 1 file changed, 2 insertions(+), 4 deletions(-)
26
27 --- a/drivers/clk/clk.c
28 +++ b/drivers/clk/clk.c
29 @@ -1381,6 +1381,8 @@ static void clk_core_init_rate_req(struc
30 if (WARN_ON(!core || !req))
31 return;
32
33 + clk_core_get_boundaries(core, &req->min_rate, &req->max_rate);
34 +
35 parent = core->parent;
36 if (parent) {
37 req->best_parent_hw = parent->hw;
38 @@ -1455,7 +1457,6 @@ unsigned long clk_hw_round_rate(struct c
39 int ret;
40 struct clk_rate_request req;
41
42 - clk_core_get_boundaries(hw->core, &req.min_rate, &req.max_rate);
43 req.rate = rate;
44
45 ret = clk_core_round_rate_nolock(hw->core, &req);
46 @@ -1488,7 +1489,6 @@ long clk_round_rate(struct clk *clk, uns
47 if (clk->exclusive_count)
48 clk_core_rate_unprotect(clk->core);
49
50 - clk_core_get_boundaries(clk->core, &req.min_rate, &req.max_rate);
51 req.rate = rate;
52
53 ret = clk_core_round_rate_nolock(clk->core, &req);
54 @@ -1995,8 +1995,6 @@ static struct clk_core *clk_calc_new_rat
55 struct clk_rate_request req;
56
57 req.rate = rate;
58 - req.min_rate = min_rate;
59 - req.max_rate = max_rate;
60
61 clk_core_init_rate_req(core, &req);
62