Re: [PATCH 15/22] clk: Add missing clk_core_init_rate_req calls

Stephen Boyd
2022-04-23T03:51:39Z

Quoting Maxime Ripard (2022-04-08 02:10:30)
> Some callers of clk_core_round_rate_nolock() will initialize the
> clk_rate_request structure by hand, missing a few parameters that leads

Which parameters?

> to inconsistencies in what drivers can expect from that structure.
>
> Let's use clk_core_init_rate_req() everywhere to make sure it's built in
> a consistent manner.
>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
> drivers/clk/clk.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 83dd5f1df0b9..3a59152b06b8 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -1480,7 +1480,7 @@ unsigned long clk_hw_round_rate(struct clk_hw *hw, unsigned long rate)
> int ret;
> struct clk_rate_request req;
>
> - req.rate = rate;
> + clk_core_init_rate_req(hw->core, &req, rate);
>
> ret = clk_core_round_rate_nolock(hw->core, &req);

clk_core_round_rate_nolock() has a clk_core_init_rate_req() inside it.
This is duplicating that.

> if (ret)
> @@ -1512,7 +1512,7 @@ long clk_round_rate(struct clk *clk, unsigned long rate)
> if (clk->exclusive_count)
> clk_core_rate_unprotect(clk->core);
>
> - req.rate = rate;
> + clk_core_init_rate_req(clk->core, &req, rate);
>
> ret = clk_core_round_rate_nolock(clk->core, &req);

Duplicating again?

>
> @@ -2216,8 +2216,7 @@ static unsigned long clk_core_req_round_rate_nolock(struct clk_core *core,
> if (cnt < 0)
> return cnt;
>
> - clk_core_get_boundaries(core, &req.min_rate, &req.max_rate);
> - req.rate = req_rate;
> + clk_core_init_rate_req(core, &req, req_rate);

So we put the boundaries inside clk_core_init_rate_req()? That sounds
like it's required now after we clamp all the time.

>
> ret = clk_core_round_rate_nolock(core, &req);

Same.