Skip to content

Commit c677a5a

Browse files
masneybbebarino
authored andcommitted
clk: imx: pll14xx: 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 341bdb9 commit c677a5a

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

drivers/clk/imx/clk-pll14xx.c

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -216,31 +216,38 @@ static void imx_pll14xx_calc_settings(struct clk_pll14xx *pll, unsigned long rat
216216
t->mdiv, t->kdiv);
217217
}
218218

219-
static long clk_pll1416x_round_rate(struct clk_hw *hw, unsigned long rate,
220-
unsigned long *prate)
219+
static int clk_pll1416x_determine_rate(struct clk_hw *hw,
220+
struct clk_rate_request *req)
221221
{
222222
struct clk_pll14xx *pll = to_clk_pll14xx(hw);
223223
const struct imx_pll14xx_rate_table *rate_table = pll->rate_table;
224224
int i;
225225

226226
/* Assuming rate_table is in descending order */
227227
for (i = 0; i < pll->rate_count; i++)
228-
if (rate >= rate_table[i].rate)
229-
return rate_table[i].rate;
228+
if (req->rate >= rate_table[i].rate) {
229+
req->rate = rate_table[i].rate;
230+
231+
return 0;
232+
}
230233

231234
/* return minimum supported value */
232-
return rate_table[pll->rate_count - 1].rate;
235+
req->rate = rate_table[pll->rate_count - 1].rate;
236+
237+
return 0;
233238
}
234239

235-
static long clk_pll1443x_round_rate(struct clk_hw *hw, unsigned long rate,
236-
unsigned long *prate)
240+
static int clk_pll1443x_determine_rate(struct clk_hw *hw,
241+
struct clk_rate_request *req)
237242
{
238243
struct clk_pll14xx *pll = to_clk_pll14xx(hw);
239244
struct imx_pll14xx_rate_table t;
240245

241-
imx_pll14xx_calc_settings(pll, rate, *prate, &t);
246+
imx_pll14xx_calc_settings(pll, req->rate, req->best_parent_rate, &t);
247+
248+
req->rate = t.rate;
242249

243-
return t.rate;
250+
return 0;
244251
}
245252

246253
static unsigned long clk_pll14xx_recalc_rate(struct clk_hw *hw,
@@ -470,7 +477,7 @@ static const struct clk_ops clk_pll1416x_ops = {
470477
.unprepare = clk_pll14xx_unprepare,
471478
.is_prepared = clk_pll14xx_is_prepared,
472479
.recalc_rate = clk_pll14xx_recalc_rate,
473-
.round_rate = clk_pll1416x_round_rate,
480+
.determine_rate = clk_pll1416x_determine_rate,
474481
.set_rate = clk_pll1416x_set_rate,
475482
};
476483

@@ -483,7 +490,7 @@ static const struct clk_ops clk_pll1443x_ops = {
483490
.unprepare = clk_pll14xx_unprepare,
484491
.is_prepared = clk_pll14xx_is_prepared,
485492
.recalc_rate = clk_pll14xx_recalc_rate,
486-
.round_rate = clk_pll1443x_round_rate,
493+
.determine_rate = clk_pll1443x_determine_rate,
487494
.set_rate = clk_pll1443x_set_rate,
488495
};
489496

0 commit comments

Comments
 (0)