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>
This commit is contained in:
Brian Masney 2025-07-10 11:20:27 -04:00 committed by Alexandre Belloni
parent b574acb3cf
commit 31b5fea399
1 changed files with 11 additions and 6 deletions

View File

@ -1467,17 +1467,22 @@ static unsigned long ds3231_clk_sqw_recalc_rate(struct clk_hw *hw,
return ds3231_clk_sqw_rates[rate_sel]; return ds3231_clk_sqw_rates[rate_sel];
} }
static long ds3231_clk_sqw_round_rate(struct clk_hw *hw, unsigned long rate, static int ds3231_clk_sqw_determine_rate(struct clk_hw *hw,
unsigned long *prate) struct clk_rate_request *req)
{ {
int i; int i;
for (i = ARRAY_SIZE(ds3231_clk_sqw_rates) - 1; i >= 0; i--) { for (i = ARRAY_SIZE(ds3231_clk_sqw_rates) - 1; i >= 0; i--) {
if (ds3231_clk_sqw_rates[i] <= rate) if (ds3231_clk_sqw_rates[i] <= req->rate) {
return ds3231_clk_sqw_rates[i]; req->rate = ds3231_clk_sqw_rates[i];
return 0;
}
} }
return ds3231_clk_sqw_rates[ARRAY_SIZE(ds3231_clk_sqw_rates) - 1]; req->rate = ds3231_clk_sqw_rates[ARRAY_SIZE(ds3231_clk_sqw_rates) - 1];
return 0;
} }
static int ds3231_clk_sqw_set_rate(struct clk_hw *hw, unsigned long rate, static int ds3231_clk_sqw_set_rate(struct clk_hw *hw, unsigned long rate,
@ -1536,7 +1541,7 @@ static const struct clk_ops ds3231_clk_sqw_ops = {
.unprepare = ds3231_clk_sqw_unprepare, .unprepare = ds3231_clk_sqw_unprepare,
.is_prepared = ds3231_clk_sqw_is_prepared, .is_prepared = ds3231_clk_sqw_is_prepared,
.recalc_rate = ds3231_clk_sqw_recalc_rate, .recalc_rate = ds3231_clk_sqw_recalc_rate,
.round_rate = ds3231_clk_sqw_round_rate, .determine_rate = ds3231_clk_sqw_determine_rate,
.set_rate = ds3231_clk_sqw_set_rate, .set_rate = ds3231_clk_sqw_set_rate,
}; };