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

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

authored by

Brian Masney and committed by
Alexandre Belloni
31b5fea3 b574acb3

+11 -6
+11 -6
drivers/rtc/rtc-ds1307.c
··· 1467 1467 return ds3231_clk_sqw_rates[rate_sel]; 1468 1468 } 1469 1469 1470 - static long ds3231_clk_sqw_round_rate(struct clk_hw *hw, unsigned long rate, 1471 - unsigned long *prate) 1470 + static int ds3231_clk_sqw_determine_rate(struct clk_hw *hw, 1471 + struct clk_rate_request *req) 1472 1472 { 1473 1473 int i; 1474 1474 1475 1475 for (i = ARRAY_SIZE(ds3231_clk_sqw_rates) - 1; i >= 0; i--) { 1476 - if (ds3231_clk_sqw_rates[i] <= rate) 1477 - return ds3231_clk_sqw_rates[i]; 1476 + if (ds3231_clk_sqw_rates[i] <= req->rate) { 1477 + req->rate = ds3231_clk_sqw_rates[i]; 1478 + 1479 + return 0; 1480 + } 1478 1481 } 1479 1482 1480 - return ds3231_clk_sqw_rates[ARRAY_SIZE(ds3231_clk_sqw_rates) - 1]; 1483 + req->rate = ds3231_clk_sqw_rates[ARRAY_SIZE(ds3231_clk_sqw_rates) - 1]; 1484 + 1485 + return 0; 1481 1486 } 1482 1487 1483 1488 static int ds3231_clk_sqw_set_rate(struct clk_hw *hw, unsigned long rate, ··· 1541 1536 .unprepare = ds3231_clk_sqw_unprepare, 1542 1537 .is_prepared = ds3231_clk_sqw_is_prepared, 1543 1538 .recalc_rate = ds3231_clk_sqw_recalc_rate, 1544 - .round_rate = ds3231_clk_sqw_round_rate, 1539 + .determine_rate = ds3231_clk_sqw_determine_rate, 1545 1540 .set_rate = ds3231_clk_sqw_set_rate, 1546 1541 }; 1547 1542