All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers: regmap: Skip clk_put for attached clocks when freeing context
@ 2018-05-15  0:59 James Kelly
  2018-05-17  4:33 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: James Kelly @ 2018-05-15  0:59 UTC (permalink / raw)
  To: Mark Brown; +Cc: James Kelly, Maxime Ripard, linux-kernel

Capability to attach an existing clk to a MMIO regmap was
introduced in 4.17rc1.

However, when using attached clk, regmap does not do the clk_get.
Therefore it should not do the clk_put when freeing the MMIO
regmap context.

There does not appear to be any users of attached clocks yet
so this would be a good time to make this change before anything
depends on the existing behaviour.

Signed-off-by: James Kelly <jamespeterkelly@gmail.com>
---
 drivers/base/regmap/regmap-mmio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/base/regmap/regmap-mmio.c b/drivers/base/regmap/regmap-mmio.c
index 5cadfd3394d8..8741fb5f8f54 100644
--- a/drivers/base/regmap/regmap-mmio.c
+++ b/drivers/base/regmap/regmap-mmio.c
@@ -206,7 +206,8 @@ static void regmap_mmio_free_context(void *context)
 
 	if (!IS_ERR(ctx->clk)) {
 		clk_unprepare(ctx->clk);
-		clk_put(ctx->clk);
+		if (!ctx->attached_clk)
+			clk_put(ctx->clk);
 	}
 	kfree(context);
 }
-- 
2.15.1 (Apple Git-101)

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

* Re: [PATCH] drivers: regmap: Skip clk_put for attached clocks when freeing context
  2018-05-15  0:59 [PATCH] drivers: regmap: Skip clk_put for attached clocks when freeing context James Kelly
@ 2018-05-17  4:33 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2018-05-17  4:33 UTC (permalink / raw)
  To: James Kelly; +Cc: Maxime Ripard, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 273 bytes --]

On Tue, May 15, 2018 at 10:59:58AM +1000, James Kelly wrote:
> Capability to attach an existing clk to a MMIO regmap was
> introduced in 4.17rc1.

Please use subject lines matching the style for the subsystem.  This
makes it easier for people to identify relevant patches.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2018-05-17 16:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-15  0:59 [PATCH] drivers: regmap: Skip clk_put for attached clocks when freeing context James Kelly
2018-05-17  4:33 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.