Skip to content

Commit 8bc614c

Browse files
masneybwens
authored andcommitted
clk: sunxi-ng: ccu_nkmp: 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]> Reviewed-by: Maxime Ripard <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Chen-Yu Tsai <[email protected]>
1 parent 2b0d4f1 commit 8bc614c

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

drivers/clk/sunxi-ng/ccu_nkmp.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -127,20 +127,20 @@ static unsigned long ccu_nkmp_recalc_rate(struct clk_hw *hw,
127127
return rate;
128128
}
129129

130-
static long ccu_nkmp_round_rate(struct clk_hw *hw, unsigned long rate,
131-
unsigned long *parent_rate)
130+
static int ccu_nkmp_determine_rate(struct clk_hw *hw,
131+
struct clk_rate_request *req)
132132
{
133133
struct ccu_nkmp *nkmp = hw_to_ccu_nkmp(hw);
134134
struct _ccu_nkmp _nkmp;
135135

136136
if (nkmp->common.features & CCU_FEATURE_FIXED_POSTDIV)
137-
rate *= nkmp->fixed_post_div;
137+
req->rate *= nkmp->fixed_post_div;
138138

139-
if (nkmp->max_rate && rate > nkmp->max_rate) {
140-
rate = nkmp->max_rate;
139+
if (nkmp->max_rate && req->rate > nkmp->max_rate) {
140+
req->rate = nkmp->max_rate;
141141
if (nkmp->common.features & CCU_FEATURE_FIXED_POSTDIV)
142-
rate /= nkmp->fixed_post_div;
143-
return rate;
142+
req->rate /= nkmp->fixed_post_div;
143+
return 0;
144144
}
145145

146146
_nkmp.min_n = nkmp->n.min ?: 1;
@@ -152,12 +152,13 @@ static long ccu_nkmp_round_rate(struct clk_hw *hw, unsigned long rate,
152152
_nkmp.min_p = 1;
153153
_nkmp.max_p = nkmp->p.max ?: 1 << ((1 << nkmp->p.width) - 1);
154154

155-
rate = ccu_nkmp_find_best(*parent_rate, rate, &_nkmp);
155+
req->rate = ccu_nkmp_find_best(req->best_parent_rate, req->rate,
156+
&_nkmp);
156157

157158
if (nkmp->common.features & CCU_FEATURE_FIXED_POSTDIV)
158-
rate = rate / nkmp->fixed_post_div;
159+
req->rate = req->rate / nkmp->fixed_post_div;
159160

160-
return rate;
161+
return 0;
161162
}
162163

163164
static int ccu_nkmp_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -227,7 +228,7 @@ const struct clk_ops ccu_nkmp_ops = {
227228
.is_enabled = ccu_nkmp_is_enabled,
228229

229230
.recalc_rate = ccu_nkmp_recalc_rate,
230-
.round_rate = ccu_nkmp_round_rate,
231+
.determine_rate = ccu_nkmp_determine_rate,
231232
.set_rate = ccu_nkmp_set_rate,
232233
};
233234
EXPORT_SYMBOL_NS_GPL(ccu_nkmp_ops, "SUNXI_CCU");

0 commit comments

Comments
 (0)