Re: [PATCH 059/114] clk: stm32: stm32mp1: convert from round_rate() to determine_rate()

Gabriel FERNANDEZ <[email protected]>
Newsgroups dev.linux.lists.sophgo,dev.linux.lists.asahi,dev.linux.lists.imx,dev.linux.lists.soc,dev.linux.lists.spacemit,org.infradead.lists.linux-mediatek,org.infradead.lists.linux-riscv,org.infradead.lists.linux-rockchip,org.kernel.vger.arm-scmi,org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-clk,org.kernel.vger.linux-kernel,org.kernel.vger.linux-mips,org.kernel.vger.linux-renesas-soc,org.kernel.vger.linux-samsung-soc
Message-ID <[email protected]>
On 8/11/25 17:18, Brian Masney via B4 Relay wrote:
> From: Brian Masney <[email protected]>
>
> The round_rate() clk ops is deprecated, so migrate this driver from
> round_rate() to determine_rate() using the Coccinelle semantic patch
> on the cover letter of this series.
>
> Signed-off-by: Brian Masney <[email protected]>
Reviewed-by: Gabriel Fernandez <[email protected]>

> ---
>   drivers/clk/stm32/clk-stm32mp1.c | 13 ++++++++-----
>   1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/clk/stm32/clk-stm32mp1.c b/drivers/clk/stm32/clk-stm32mp1.c
> index b8b45ed22f981df580506f3d4ca801ba11d2bab2..2d9ccd96ec98c05eb836d632bfd9903de60ba1bb 100644
> --- a/drivers/clk/stm32/clk-stm32mp1.c
> +++ b/drivers/clk/stm32/clk-stm32mp1.c
> @@ -970,12 +970,15 @@ static unsigned long __bestmult(struct clk_hw *hw, unsigned long rate,
>   	return mult;
>   }
>   
> -static long timer_ker_round_rate(struct clk_hw *hw, unsigned long rate,
> -				 unsigned long *parent_rate)
> +static int timer_ker_determine_rate(struct clk_hw *hw,
> +				    struct clk_rate_request *req)
>   {
> -	unsigned long factor = __bestmult(hw, rate, *parent_rate);
> +	unsigned long factor = __bestmult(hw, req->rate,
> +					  req->best_parent_rate);
>   
> -	return *parent_rate * factor;
> +	req->rate = req->best_parent_rate * factor;
> +
> +	return 0;
>   }
>   
>   static int timer_ker_set_rate(struct clk_hw *hw, unsigned long rate,
> @@ -1026,7 +1029,7 @@ static unsigned long timer_ker_recalc_rate(struct clk_hw *hw,
>   
>   static const struct clk_ops timer_ker_ops = {
>   	.recalc_rate	= timer_ker_recalc_rate,
> -	.round_rate	= timer_ker_round_rate,
> +	.determine_rate = timer_ker_determine_rate,
>   	.set_rate	= timer_ker_set_rate,
>   
>   };
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.