LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] Skip clk_put for attached clocks when freeing context
@ 2018-05-15  0:50 James Kelly
  2018-05-15  6:42 ` Maxime Ripard
  2018-05-17 16:41 ` Applied "regmap: Skip clk_put for attached clocks when freeing context" to the regmap tree Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: James Kelly @ 2018-05-15  0:50 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	[flat|nested] 3+ messages in thread

* Re: [PATCH] Skip clk_put for attached clocks when freeing context
  2018-05-15  0:50 [PATCH] Skip clk_put for attached clocks when freeing context James Kelly
@ 2018-05-15  6:42 ` Maxime Ripard
  2018-05-17 16:41 ` Applied "regmap: Skip clk_put for attached clocks when freeing context" to the regmap tree Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Maxime Ripard @ 2018-05-15  6:42 UTC (permalink / raw)
  To: James Kelly; +Cc: Mark Brown, linux-kernel

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

On Tue, May 15, 2018 at 10:50:17AM +1000, James Kelly wrote:
> 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>

Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>

Thanks!
Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

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

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

* Applied "regmap: Skip clk_put for attached clocks when freeing context" to the regmap tree
  2018-05-15  0:50 [PATCH] Skip clk_put for attached clocks when freeing context James Kelly
  2018-05-15  6:42 ` Maxime Ripard
@ 2018-05-17 16:41 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2018-05-17 16:41 UTC (permalink / raw)
  To: James Kelly
  Cc: Maxime Ripard, Mark Brown, Mark Brown, Maxime Ripard,
	linux-kernel, linux-kernel

The patch

   regmap: Skip clk_put for attached clocks when freeing context

has been applied to the regmap tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From eb4a219d19fde99616f120f5655a7121c918cd49 Mon Sep 17 00:00:00 2001
From: James Kelly <jamespeterkelly@gmail.com>
Date: Tue, 15 May 2018 10:59:58 +1000
Subject: [PATCH] regmap: Skip clk_put for attached clocks when freeing context

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>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 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.17.0

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-15  0:50 [PATCH] Skip clk_put for attached clocks when freeing context James Kelly
2018-05-15  6:42 ` Maxime Ripard
2018-05-17 16:41 ` Applied "regmap: Skip clk_put for attached clocks when freeing context" to the regmap tree Mark Brown

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).