Skip to content

Commit 1251d04

Browse files
masneybalexandrebelloni
authored andcommitted
rtc: nct3018y: 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] Signed-off-by: Alexandre Belloni <[email protected]>
1 parent 9e0dfc7 commit 1251d04

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

drivers/rtc/rtc-nct3018y.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -367,16 +367,21 @@ static unsigned long nct3018y_clkout_recalc_rate(struct clk_hw *hw,
367367
return clkout_rates[flags];
368368
}
369369

370-
static long nct3018y_clkout_round_rate(struct clk_hw *hw, unsigned long rate,
371-
unsigned long *prate)
370+
static int nct3018y_clkout_determine_rate(struct clk_hw *hw,
371+
struct clk_rate_request *req)
372372
{
373373
int i;
374374

375375
for (i = 0; i < ARRAY_SIZE(clkout_rates); i++)
376-
if (clkout_rates[i] <= rate)
377-
return clkout_rates[i];
376+
if (clkout_rates[i] <= req->rate) {
377+
req->rate = clkout_rates[i];
378378

379-
return clkout_rates[0];
379+
return 0;
380+
}
381+
382+
req->rate = clkout_rates[0];
383+
384+
return 0;
380385
}
381386

382387
static int nct3018y_clkout_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -446,7 +451,7 @@ static const struct clk_ops nct3018y_clkout_ops = {
446451
.unprepare = nct3018y_clkout_unprepare,
447452
.is_prepared = nct3018y_clkout_is_prepared,
448453
.recalc_rate = nct3018y_clkout_recalc_rate,
449-
.round_rate = nct3018y_clkout_round_rate,
454+
.determine_rate = nct3018y_clkout_determine_rate,
450455
.set_rate = nct3018y_clkout_set_rate,
451456
};
452457

0 commit comments

Comments
 (0)