Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <bmasney@redhat.com>
Link: https://lore.kernel.org/r/20250710-rtc-clk-round-rate-v1-15-33140bb2278e@redhat.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

authored by

Brian Masney and committed by
Alexandre Belloni
35d6aae8 c4253b09

+13 -8
+13 -8
drivers/rtc/rtc-rv3032.c
··· 646 646 return clkout_xtal_rates[FIELD_GET(RV3032_CLKOUT2_FD_MSK, clkout)]; 647 647 } 648 648 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) 651 651 { 652 652 int i, hfd; 653 653 654 - if (rate < RV3032_HFD_STEP) 654 + if (req->rate < RV3032_HFD_STEP) 655 655 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]; 658 658 659 - hfd = DIV_ROUND_CLOSEST(rate, RV3032_HFD_STEP); 659 + return 0; 660 + } 660 661 661 - return RV3032_HFD_STEP * clamp(hfd, 0, 8192); 662 + hfd = DIV_ROUND_CLOSEST(req->rate, RV3032_HFD_STEP); 663 + 664 + req->rate = RV3032_HFD_STEP * clamp(hfd, 0, 8192); 665 + 666 + return 0; 662 667 } 663 668 664 669 static int rv3032_clkout_set_rate(struct clk_hw *hw, unsigned long rate, ··· 743 738 .unprepare = rv3032_clkout_unprepare, 744 739 .is_prepared = rv3032_clkout_is_prepared, 745 740 .recalc_rate = rv3032_clkout_recalc_rate, 746 - .round_rate = rv3032_clkout_round_rate, 741 + .determine_rate = rv3032_clkout_determine_rate, 747 742 .set_rate = rv3032_clkout_set_rate, 748 743 }; 749 744