From: James Kelly <jamespeterkelly@gmail.com>
To: Mark Brown <broonie@kernel.org>
Cc: James Kelly <jamespeterkelly@gmail.com>,
Maxime Ripard <maxime.ripard@free-electrons.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] Skip clk_put for attached clocks when freeing context
Date: Tue, 15 May 2018 10:50:17 +1000 [thread overview]
Message-ID: <20180515005017.46851-1-jamespeterkelly@gmail.com> (raw)
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)
next reply other threads:[~2018-05-15 0:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-15 0:50 James Kelly [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180515005017.46851-1-jamespeterkelly@gmail.com \
--to=jamespeterkelly@gmail.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maxime.ripard@free-electrons.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®