clk: mstar: msc313-cpupll: convert from round_rate() to determine_rate()

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.

Reviewed-by: Daniel Palmer <daniel@thingy.jp>
Signed-off-by: Brian Masney <bmasney@redhat.com>
This commit is contained in:
Brian Masney 2025-08-11 11:19:16 -04:00
parent e9f039c08c
commit 5ea721896c
1 changed files with 10 additions and 8 deletions

View File

@ -140,20 +140,22 @@ static unsigned long msc313_cpupll_recalc_rate(struct clk_hw *hw, unsigned long
parent_rate);
}
static long msc313_cpupll_round_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *parent_rate)
static int msc313_cpupll_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{
u32 reg = msc313_cpupll_regforfrequecy(rate, *parent_rate);
long rounded = msc313_cpupll_frequencyforreg(reg, *parent_rate);
u32 reg = msc313_cpupll_regforfrequecy(req->rate, req->best_parent_rate);
long rounded = msc313_cpupll_frequencyforreg(reg, req->best_parent_rate);
/*
* This is my poor attempt at making sure the resulting
* rate doesn't overshoot the requested rate.
*/
for (; rounded >= rate && reg > 0; reg--)
rounded = msc313_cpupll_frequencyforreg(reg, *parent_rate);
for (; rounded >= req->rate && reg > 0; reg--)
rounded = msc313_cpupll_frequencyforreg(reg, req->best_parent_rate);
return rounded;
req->rate = rounded;
return 0;
}
static int msc313_cpupll_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate)
@ -168,7 +170,7 @@ static int msc313_cpupll_set_rate(struct clk_hw *hw, unsigned long rate, unsigne
static const struct clk_ops msc313_cpupll_ops = {
.recalc_rate = msc313_cpupll_recalc_rate,
.round_rate = msc313_cpupll_round_rate,
.determine_rate = msc313_cpupll_determine_rate,
.set_rate = msc313_cpupll_set_rate,
};