From: Brian Masney <bmasney@redhat.com>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>,
Akinobu Mita <akinobu.mita@gmail.com>,
Michael Turquette <mturquette@baylibre.com>,
Heiko Stuebner <heiko@sntech.de>,
Andrew Morton <akpm@linux-foundation.org>,
Avi Fishman <avifishman70@gmail.com>,
Tomer Maimon <tmaimon77@gmail.com>,
Tali Perry <tali.perry1@gmail.com>,
Patrick Venture <venture@google.com>,
Nancy Yuen <yuenn@google.com>,
Benjamin Fair <benjaminfair@google.com>,
Mia Lin <mimi05633@gmail.com>,
Michael McCormick <michael.mccormick@enatel.net>,
Heiko Schocher <hs@denx.de>, Parthiban Nallathambi <pn@denx.de>,
Antoniu Miclaus <antoniu.miclaus@analog.com>,
Maxime Ripard <mripard@kernel.org>,
Stephen Boyd <sboyd@kernel.org>
Cc: linux-clk@vger.kernel.org, linux-rtc@vger.kernel.org,
linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org,
Brian Masney <bmasney@redhat.com>
Subject: [PATCH 07/15] rtc: ds1307: convert from round_rate() to determine_rate()
Date: Thu, 10 Jul 2025 11:20:27 -0400 [thread overview]
Message-ID: <20250710-rtc-clk-round-rate-v1-7-33140bb2278e@redhat.com> (raw)
In-Reply-To: <20250710-rtc-clk-round-rate-v1-0-33140bb2278e@redhat.com>
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>
---
drivers/rtc/rtc-ds1307.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index c8a666de9cbe9163ab7e112b01b99d97c94970d3..d9d0e482b5ea9300ec9d7e77e4c3ec531b9df867 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -1456,17 +1456,22 @@ static unsigned long ds3231_clk_sqw_recalc_rate(struct clk_hw *hw,
return ds3231_clk_sqw_rates[rate_sel];
}
-static long ds3231_clk_sqw_round_rate(struct clk_hw *hw, unsigned long rate,
- unsigned long *prate)
+static int ds3231_clk_sqw_determine_rate(struct clk_hw *hw,
+ struct clk_rate_request *req)
{
int i;
for (i = ARRAY_SIZE(ds3231_clk_sqw_rates) - 1; i >= 0; i--) {
- if (ds3231_clk_sqw_rates[i] <= rate)
- return ds3231_clk_sqw_rates[i];
+ if (ds3231_clk_sqw_rates[i] <= req->rate) {
+ 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,
@@ -1525,7 +1530,7 @@ static const struct clk_ops ds3231_clk_sqw_ops = {
.unprepare = ds3231_clk_sqw_unprepare,
.is_prepared = ds3231_clk_sqw_is_prepared,
.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,
};
--
2.50.0
next prev parent reply other threads:[~2025-07-10 15:23 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-10 15:20 [PATCH 00/15] rtc: convert from clk round_rate() to determine_rate() and fix a few bugs Brian Masney
2025-07-10 15:20 ` [PATCH 01/15] rtc: ds1307: fix incorrect maximum clock rate handling Brian Masney
2025-07-10 15:20 ` [PATCH 02/15] rtc: hym8563: " Brian Masney
2025-07-10 15:20 ` [PATCH 03/15] rtc: nct3018y: " Brian Masney
2025-07-10 15:20 ` [PATCH 04/15] rtc: pcf85063: " Brian Masney
2025-07-10 15:20 ` [PATCH 05/15] rtc: pcf8563: " Brian Masney
2025-07-10 15:20 ` [PATCH 06/15] rtc: rv3028: " Brian Masney
2025-07-10 15:20 ` Brian Masney [this message]
2025-07-10 15:20 ` [PATCH 08/15] rtc: hym8563: convert from round_rate() to determine_rate() Brian Masney
2025-07-10 15:20 ` [PATCH 09/15] rtc: m41t80: " Brian Masney
2025-07-10 15:20 ` [PATCH 10/15] rtc: max31335: " Brian Masney
2025-07-10 15:20 ` [PATCH 11/15] rtc: nct3018y: " Brian Masney
2025-07-10 15:20 ` [PATCH 12/15] rtc: pcf85063: " Brian Masney
2025-07-10 15:20 ` [PATCH 13/15] rtc: pcf8563: " Brian Masney
2025-07-10 15:20 ` [PATCH 14/15] rtc: rv3028: " Brian Masney
2025-07-10 15:20 ` [PATCH 15/15] rtc: rv3032: " Brian Masney
2025-08-03 1:01 ` [PATCH 00/15] rtc: convert from clk round_rate() to determine_rate() and fix a few bugs Alexandre Belloni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250710-rtc-clk-round-rate-v1-7-33140bb2278e@redhat.com \
--to=bmasney@redhat.com \
--cc=akinobu.mita@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=alexandre.belloni@bootlin.com \
--cc=antoniu.miclaus@analog.com \
--cc=avifishman70@gmail.com \
--cc=benjaminfair@google.com \
--cc=heiko@sntech.de \
--cc=hs@denx.de \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=michael.mccormick@enatel.net \
--cc=mimi05633@gmail.com \
--cc=mripard@kernel.org \
--cc=mturquette@baylibre.com \
--cc=openbmc@lists.ozlabs.org \
--cc=pn@denx.de \
--cc=sboyd@kernel.org \
--cc=tali.perry1@gmail.com \
--cc=tmaimon77@gmail.com \
--cc=venture@google.com \
--cc=yuenn@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).