imx.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Brian Masney <bmasney@redhat.com>
To: Abel Vesa <abelvesa@kernel.org>, Peng Fan <peng.fan@nxp.com>,
	 Michael Turquette <mturquette@baylibre.com>,
	 Stephen Boyd <sboyd@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
	 Sascha Hauer <s.hauer@pengutronix.de>,
	 Pengutronix Kernel Team <kernel@pengutronix.de>,
	 Fabio Estevam <festevam@gmail.com>,
	Maxime Ripard <mripard@kernel.org>
Cc: linux-clk@vger.kernel.org, imx@lists.linux.dev,
	 linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,  Brian Masney <bmasney@redhat.com>
Subject: [PATCH 10/13] clk: imx: pllv2: convert from round_rate() to determine_rate()
Date: Thu, 10 Jul 2025 17:10:42 -0400	[thread overview]
Message-ID: <20250710-clk-imx-round-rate-v1-10-5726f98e6d8d@redhat.com> (raw)
In-Reply-To: <20250710-clk-imx-round-rate-v1-0-5726f98e6d8d@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/clk/imx/clk-pllv2.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/imx/clk-pllv2.c b/drivers/clk/imx/clk-pllv2.c
index ff17f0664faad23d826d384fa8f972e21ebd7da7..bb497ad5e0ae3df923e8f01eb2b8af710f8f8f29 100644
--- a/drivers/clk/imx/clk-pllv2.c
+++ b/drivers/clk/imx/clk-pllv2.c
@@ -178,18 +178,25 @@ static int clk_pllv2_set_rate(struct clk_hw *hw, unsigned long rate,
 	return 0;
 }
 
-static long clk_pllv2_round_rate(struct clk_hw *hw, unsigned long rate,
-		unsigned long *prate)
+static int clk_pllv2_determine_rate(struct clk_hw *hw,
+				    struct clk_rate_request *req)
 {
 	u32 dp_op, dp_mfd, dp_mfn;
 	int ret;
 
-	ret = __clk_pllv2_set_rate(rate, *prate, &dp_op, &dp_mfd, &dp_mfn);
-	if (ret)
-		return ret;
+	ret = __clk_pllv2_set_rate(req->rate, req->best_parent_rate, &dp_op,
+				   &dp_mfd, &dp_mfn);
+	if (ret) {
+		req->rate = ret;
 
-	return __clk_pllv2_recalc_rate(*prate, MXC_PLL_DP_CTL_DPDCK0_2_EN,
-			dp_op, dp_mfd, dp_mfn);
+		return 0;
+	}
+
+	req->rate = __clk_pllv2_recalc_rate(req->best_parent_rate,
+					    MXC_PLL_DP_CTL_DPDCK0_2_EN, dp_op,
+					    dp_mfd, dp_mfn);
+
+	return 0;
 }
 
 static int clk_pllv2_prepare(struct clk_hw *hw)
@@ -235,7 +242,7 @@ static const struct clk_ops clk_pllv2_ops = {
 	.prepare = clk_pllv2_prepare,
 	.unprepare = clk_pllv2_unprepare,
 	.recalc_rate = clk_pllv2_recalc_rate,
-	.round_rate = clk_pllv2_round_rate,
+	.determine_rate = clk_pllv2_determine_rate,
 	.set_rate = clk_pllv2_set_rate,
 };
 

-- 
2.50.0


  parent reply	other threads:[~2025-07-10 21:11 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-10 21:10 [PATCH 00/13] clk: imx: convert from clk round_rate() to determine_rate() Brian Masney
2025-07-10 21:10 ` [PATCH 01/13] clk: imx: composite-8m: remove round_rate() in favor of determine_rate() Brian Masney
2025-07-24 22:16   ` Stephen Boyd
2025-07-10 21:10 ` [PATCH 02/13] clk: imx: composite-93: " Brian Masney
2025-07-24 22:16   ` Stephen Boyd
2025-07-10 21:10 ` [PATCH 03/13] clk: imx: busy: convert from round_rate() to determine_rate() Brian Masney
2025-07-24 22:16   ` Stephen Boyd
2025-07-10 21:10 ` [PATCH 04/13] clk: imx: cpu: " Brian Masney
2025-07-24 22:16   ` Stephen Boyd
2025-07-10 21:10 ` [PATCH 05/13] clk: imx: fixup-div: " Brian Masney
2025-07-24 22:16   ` Stephen Boyd
2025-07-10 21:10 ` [PATCH 06/13] clk: imx: fracn-gppll: " Brian Masney
2025-07-24 22:15   ` Stephen Boyd
2025-07-10 21:10 ` [PATCH 07/13] clk: imx: frac-pll: " Brian Masney
2025-07-24 22:15   ` Stephen Boyd
2025-07-10 21:10 ` [PATCH 08/13] clk: imx: pfd: " Brian Masney
2025-07-24 22:15   ` Stephen Boyd
2025-07-10 21:10 ` [PATCH 09/13] clk: imx: pll14xx: " Brian Masney
2025-07-24 22:15   ` Stephen Boyd
2025-07-10 21:10 ` Brian Masney [this message]
2025-07-24 22:15   ` [PATCH 10/13] clk: imx: pllv2: " Stephen Boyd
2025-07-10 21:10 ` [PATCH 11/13] clk: imx: pllv3: " Brian Masney
2025-07-24 22:15   ` Stephen Boyd
2025-07-10 21:10 ` [PATCH 12/13] clk: imx: pllv4: " Brian Masney
2025-07-24 22:15   ` Stephen Boyd
2025-07-10 21:10 ` [PATCH 13/13] clk: imx: scu: " Brian Masney
2025-07-24 22:15   ` Stephen Boyd
2025-07-15  6:57 ` [PATCH 00/13] clk: imx: convert from clk " Peng Fan

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-clk-imx-round-rate-v1-10-5726f98e6d8d@redhat.com \
    --to=bmasney@redhat.com \
    --cc=abelvesa@kernel.org \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mripard@kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=peng.fan@nxp.com \
    --cc=s.hauer@pengutronix.de \
    --cc=sboyd@kernel.org \
    --cc=shawnguo@kernel.org \
    /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).