Skip to content

Commit 341bdb9

Browse files
masneybbebarino
authored andcommitted
clk: imx: pfd: 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 6d50f95 commit 341bdb9

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

drivers/clk/imx/clk-pfd.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,24 +62,26 @@ static unsigned long clk_pfd_recalc_rate(struct clk_hw *hw,
6262
return tmp;
6363
}
6464

65-
static long clk_pfd_round_rate(struct clk_hw *hw, unsigned long rate,
66-
unsigned long *prate)
65+
static int clk_pfd_determine_rate(struct clk_hw *hw,
66+
struct clk_rate_request *req)
6767
{
68-
u64 tmp = *prate;
68+
u64 tmp = req->best_parent_rate;
6969
u8 frac;
7070

71-
tmp = tmp * 18 + rate / 2;
72-
do_div(tmp, rate);
71+
tmp = tmp * 18 + req->rate / 2;
72+
do_div(tmp, req->rate);
7373
frac = tmp;
7474
if (frac < 12)
7575
frac = 12;
7676
else if (frac > 35)
7777
frac = 35;
78-
tmp = *prate;
78+
tmp = req->best_parent_rate;
7979
tmp *= 18;
8080
do_div(tmp, frac);
8181

82-
return tmp;
82+
req->rate = tmp;
83+
84+
return 0;
8385
}
8486

8587
static int clk_pfd_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -117,7 +119,7 @@ static const struct clk_ops clk_pfd_ops = {
117119
.enable = clk_pfd_enable,
118120
.disable = clk_pfd_disable,
119121
.recalc_rate = clk_pfd_recalc_rate,
120-
.round_rate = clk_pfd_round_rate,
122+
.determine_rate = clk_pfd_determine_rate,
121123
.set_rate = clk_pfd_set_rate,
122124
.is_enabled = clk_pfd_is_enabled,
123125
};

0 commit comments

Comments
 (0)