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

rtc: m41t80: 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-9-33140bb2278e@redhat.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

authored by

Brian Masney and committed by
Alexandre Belloni
e05d81b7 394a4b92

+11 -10
+11 -10
drivers/rtc/rtc-m41t80.c
··· 484 484 return sqw_to_m41t80_data(hw)->freq; 485 485 } 486 486 487 - static long m41t80_sqw_round_rate(struct clk_hw *hw, unsigned long rate, 488 - unsigned long *prate) 487 + static int m41t80_sqw_determine_rate(struct clk_hw *hw, 488 + struct clk_rate_request *req) 489 489 { 490 - if (rate >= M41T80_SQW_MAX_FREQ) 491 - return M41T80_SQW_MAX_FREQ; 492 - if (rate >= M41T80_SQW_MAX_FREQ / 4) 493 - return M41T80_SQW_MAX_FREQ / 4; 494 - if (!rate) 495 - return 0; 496 - return 1 << ilog2(rate); 490 + if (req->rate >= M41T80_SQW_MAX_FREQ) 491 + req->rate = M41T80_SQW_MAX_FREQ; 492 + else if (req->rate >= M41T80_SQW_MAX_FREQ / 4) 493 + req->rate = M41T80_SQW_MAX_FREQ / 4; 494 + else if (req->rate) 495 + req->rate = 1 << ilog2(req->rate); 496 + 497 + return 0; 497 498 } 498 499 499 500 static int m41t80_sqw_set_rate(struct clk_hw *hw, unsigned long rate, ··· 565 564 .unprepare = m41t80_sqw_unprepare, 566 565 .is_prepared = m41t80_sqw_is_prepared, 567 566 .recalc_rate = m41t80_sqw_recalc_rate, 568 - .round_rate = m41t80_sqw_round_rate, 567 + .determine_rate = m41t80_sqw_determine_rate, 569 568 .set_rate = m41t80_sqw_set_rate, 570 569 }; 571 570