Skip to contentSkip to conversation

drivers: regmap: Skip clk_put for attached clocks when freeing context

PATCH In review James Kelly 2 participants 2 messages May 15, 2018 – May 17, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: 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.

---
 drivers/base/regmap/regmap-mmio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/base/regmap/regmap-mmio.c +2 -1
index 5cadfd3394d8..8741fb5f8f54 100644
@@ -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);
 }
Signature · 1 line
2.15.1 (Apple Git-101)
maintainer
#1 lore raw
Quoted 2 lines · James Kelly

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.