Skip to content

Commit 35d6aae

Browse files
masneybalexandrebelloni
authored andcommitted
rtc: rv3032: 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 c4253b0 commit 35d6aae

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

drivers/rtc/rtc-rv3032.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -646,19 +646,24 @@ static unsigned long rv3032_clkout_recalc_rate(struct clk_hw *hw,
646646
return clkout_xtal_rates[FIELD_GET(RV3032_CLKOUT2_FD_MSK, clkout)];
647647
}
648648

649-
static long rv3032_clkout_round_rate(struct clk_hw *hw, unsigned long rate,
650-
unsigned long *prate)
649+
static int rv3032_clkout_determine_rate(struct clk_hw *hw,
650+
struct clk_rate_request *req)
651651
{
652652
int i, hfd;
653653

654-
if (rate < RV3032_HFD_STEP)
654+
if (req->rate < RV3032_HFD_STEP)
655655
for (i = 0; i < ARRAY_SIZE(clkout_xtal_rates); i++)
656-
if (clkout_xtal_rates[i] <= rate)
657-
return clkout_xtal_rates[i];
656+
if (clkout_xtal_rates[i] <= req->rate) {
657+
req->rate = clkout_xtal_rates[i];
658658

659-
hfd = DIV_ROUND_CLOSEST(rate, RV3032_HFD_STEP);
659+
return 0;
660+
}
661+
662+
hfd = DIV_ROUND_CLOSEST(req->rate, RV3032_HFD_STEP);
660663

661-
return RV3032_HFD_STEP * clamp(hfd, 0, 8192);
664+
req->rate = RV3032_HFD_STEP * clamp(hfd, 0, 8192);
665+
666+
return 0;
662667
}
663668

664669
static int rv3032_clkout_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -738,7 +743,7 @@ static const struct clk_ops rv3032_clkout_ops = {
738743
.unprepare = rv3032_clkout_unprepare,
739744
.is_prepared = rv3032_clkout_is_prepared,
740745
.recalc_rate = rv3032_clkout_recalc_rate,
741-
.round_rate = rv3032_clkout_round_rate,
746+
.determine_rate = rv3032_clkout_determine_rate,
742747
.set_rate = rv3032_clkout_set_rate,
743748
};
744749

0 commit comments

Comments
 (0)