public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/5] regmap: mmio: Don't unprepare attached clock
@ 2022-08-05 20:53 Andy Shevchenko
  2022-08-05 20:53 ` [PATCH v1 2/5] regmap: mmio: Drop unneeded and duplicative checks around CLK calls Andy Shevchenko
                   ` (5 more replies)
  0 siblings, 6 replies; 20+ messages in thread
From: Andy Shevchenko @ 2022-08-05 20:53 UTC (permalink / raw)
  To: Andy Shevchenko, Mark Brown, Aidan MacDonald, linux-kernel
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki

The commit eb4a219d19fd ("regmap: Skip clk_put for attached clocks when
freeing context") oexcluded clk_put() call on regmap freeing. But the
same is needed for clk_unprepare() since the regmap MMIO users should
call regmap_mmio_detach_clk() which does unprepare the clock. Update
the code accordingly, so neither clk_put() nor clk_unprepare() would
be called for the attached clock.

Fixes: eb4a219d19fd ("regmap: Skip clk_put for attached clocks when freeing context")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/base/regmap/regmap-mmio.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/base/regmap/regmap-mmio.c b/drivers/base/regmap/regmap-mmio.c
index 71f16be7e717..e83a2c3ba95a 100644
--- a/drivers/base/regmap/regmap-mmio.c
+++ b/drivers/base/regmap/regmap-mmio.c
@@ -245,10 +245,9 @@ static void regmap_mmio_free_context(void *context)
 {
 	struct regmap_mmio_context *ctx = context;
 
-	if (!IS_ERR(ctx->clk)) {
+	if (!IS_ERR(ctx->clk) && !ctx->attached_clk) {
 		clk_unprepare(ctx->clk);
-		if (!ctx->attached_clk)
-			clk_put(ctx->clk);
+		clk_put(ctx->clk);
 	}
 	kfree(context);
 }
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2022-08-15 17:42 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-05 20:53 [PATCH v1 1/5] regmap: mmio: Don't unprepare attached clock Andy Shevchenko
2022-08-05 20:53 ` [PATCH v1 2/5] regmap: mmio: Drop unneeded and duplicative checks around CLK calls Andy Shevchenko
2022-08-08 13:02   ` Mark Brown
2022-08-08 13:43     ` Andy Shevchenko
2022-08-05 20:53 ` [PATCH v1 3/5] regmap: mmio: Remove mmio_relaxed member from context Andy Shevchenko
2022-08-05 20:53 ` [PATCH v1 4/5] regmap: mmio: Get rid of broken 64-bit IO Andy Shevchenko
2022-08-05 20:53 ` [PATCH v1 5/5] regmap: mmio: Introduce IO accessors that can talk to IO port Andy Shevchenko
2022-08-05 21:22   ` Andy Shevchenko
2022-08-08 13:18   ` Mark Brown
2022-08-08 14:40     ` Andy Shevchenko
2022-08-08 16:04       ` Mark Brown
2022-08-08 18:39         ` Andy Shevchenko
2022-08-08 13:07 ` [PATCH v1 1/5] regmap: mmio: Don't unprepare attached clock Mark Brown
2022-08-08 13:41   ` Andy Shevchenko
2022-08-08 13:48     ` Mark Brown
2022-08-08 14:42       ` Andy Shevchenko
2022-08-08 15:52         ` Mark Brown
2022-08-08 18:23           ` Andy Shevchenko
2022-08-08 19:01             ` Mark Brown
2022-08-15 17:42 ` (subset) " Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox