[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250326-cross-lock-dep-v1-4-3199e49e8652@bootlin.com>
Date: Wed, 26 Mar 2025 19:26:19 +0100
From: Miquel Raynal <miquel.raynal@...tlin.com>
To: "Rafael J. Wysocki" <rafael@...nel.org>, Pavel Machek <pavel@....cz>,
Len Brown <len.brown@...el.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Danilo Krummrich <dakr@...nel.org>,
Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>
Cc: Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-clk@...r.kernel.org, Chen-Yu Tsai <wenst@...omium.org>,
Lucas Stach <l.stach@...gutronix.de>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Marek Vasut <marex@...x.de>, Ulf Hansson <ulf.hansson@...aro.org>,
Kevin Hilman <khilman@...nel.org>, Fabio Estevam <festevam@...x.de>,
Jacky Bai <ping.bai@....com>, Peng Fan <peng.fan@....com>,
Shawn Guo <shawnguo@...nel.org>, Shengjiu Wang <shengjiu.wang@....com>,
linux-imx@....com, Ian Ray <ian.ray@...ealthcare.com>,
Hervé Codina <herve.codina@...tlin.com>,
Luca Ceresoli <luca.ceresoli@...tlin.com>,
Saravana Kannan <saravanak@...gle.com>,
Miquel Raynal <miquel.raynal@...tlin.com>
Subject: [PATCH RFC 04/10] clk: Avoid open coded-logic when a there is a
helper available
The logic for checking whether a clock is already runtime resumed
exists (and increasing the refcounting in this case) is already
available. Reuse the helper instead of open-coding the logic here again.
Signed-off-by: Miquel Raynal <miquel.raynal@...tlin.com>
---
drivers/clk/clk.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 1c15d72cd3daeeb5bb4f0d94c9f387526fab75ae..a6148eae7b6615d23d6ac665e8f94e2ae69f93b6 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -338,13 +338,8 @@ static bool clk_core_is_enabled(struct clk_core *core)
* taking enable spinlock, but the below check is needed if one tries
* to call it from other places.
*/
- if (core->rpm_enabled) {
- pm_runtime_get_noresume(core->dev);
- if (!pm_runtime_active(core->dev)) {
- ret = false;
- goto done;
- }
- }
+ if (clk_pm_runtime_get_if_active(core))
+ return false;
/*
* This could be called with the enable lock held, or from atomic
@@ -359,8 +354,7 @@ static bool clk_core_is_enabled(struct clk_core *core)
ret = core->ops->is_enabled(core->hw);
done:
- if (core->rpm_enabled)
- pm_runtime_put(core->dev);
+ clk_pm_runtime_put(core);
return ret;
}
--
2.48.1
Powered by blists - more mailing lists