Skip to content

Commit 31b5fea

Browse files
masneybalexandrebelloni
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
1 parent b574acb commit 31b5fea

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

drivers/rtc/rtc-ds1307.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,17 +1467,22 @@ static unsigned long ds3231_clk_sqw_recalc_rate(struct clk_hw *hw,
14671467
return ds3231_clk_sqw_rates[rate_sel];
14681468
}
14691469

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)
14721472
{
14731473
int i;
14741474

14751475
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+
}
14781481
}
14791482

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;
14811486
}
14821487

14831488
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 = {
15361541
.unprepare = ds3231_clk_sqw_unprepare,
15371542
.is_prepared = ds3231_clk_sqw_is_prepared,
15381543
.recalc_rate = ds3231_clk_sqw_recalc_rate,
1539-
.round_rate = ds3231_clk_sqw_round_rate,
1544+
.determine_rate = ds3231_clk_sqw_determine_rate,
15401545
.set_rate = ds3231_clk_sqw_set_rate,
15411546
};
15421547

0 commit comments

Comments
 (0)