Skip to content

Commit 6d50f95

Browse files
masneybbebarino
authored andcommitted
clk: imx: frac-pll: 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. Signed-off-by: Brian Masney <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Peng Fan <[email protected]> Signed-off-by: Stephen Boyd <[email protected]>
1 parent 6534f1a commit 6d50f95

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

drivers/clk/imx/clk-frac-pll.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,19 +119,19 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *hw,
119119
return rate;
120120
}
121121

122-
static long clk_pll_round_rate(struct clk_hw *hw, unsigned long rate,
123-
unsigned long *prate)
122+
static int clk_pll_determine_rate(struct clk_hw *hw,
123+
struct clk_rate_request *req)
124124
{
125-
u64 parent_rate = *prate;
125+
u64 parent_rate = req->best_parent_rate;
126126
u32 divff, divfi;
127127
u64 temp64;
128128

129129
parent_rate *= 8;
130-
rate *= 2;
131-
temp64 = rate;
130+
req->rate *= 2;
131+
temp64 = req->rate;
132132
do_div(temp64, parent_rate);
133133
divfi = temp64;
134-
temp64 = rate - divfi * parent_rate;
134+
temp64 = req->rate - divfi * parent_rate;
135135
temp64 *= PLL_FRAC_DENOM;
136136
do_div(temp64, parent_rate);
137137
divff = temp64;
@@ -140,9 +140,11 @@ static long clk_pll_round_rate(struct clk_hw *hw, unsigned long rate,
140140
temp64 *= divff;
141141
do_div(temp64, PLL_FRAC_DENOM);
142142

143-
rate = parent_rate * divfi + temp64;
143+
req->rate = parent_rate * divfi + temp64;
144+
145+
req->rate = req->rate / 2;
144146

145-
return rate / 2;
147+
return 0;
146148
}
147149

148150
/*
@@ -198,7 +200,7 @@ static const struct clk_ops clk_frac_pll_ops = {
198200
.unprepare = clk_pll_unprepare,
199201
.is_prepared = clk_pll_is_prepared,
200202
.recalc_rate = clk_pll_recalc_rate,
201-
.round_rate = clk_pll_round_rate,
203+
.determine_rate = clk_pll_determine_rate,
202204
.set_rate = clk_pll_set_rate,
203205
};
204206

0 commit comments

Comments
 (0)