From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 2/3] clk: Do not let the enable count of critical clocks go below 1
Date: Tue, 25 Feb 2020 09:22:01 +0100 [thread overview]
Message-ID: <20200225082202.10569-2-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20200225082202.10569-1-s.hauer@pengutronix.de>
The enable count of critical clocks may not drop below 1. Otherwise
the new parent during a reparenting of a critical clock will not
be enabled.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/clk/clk.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 05bc21a6d4..5777c9c58e 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -84,12 +84,14 @@ void clk_disable(struct clk *clk)
if (!clk->enable_count)
return;
+ if (clk->enable_count == 1 && clk->flags & CLK_IS_CRITICAL) {
+ pr_warn("Disabling critical clock %s\n", clk->name);
+ return;
+ }
+
clk->enable_count--;
if (!clk->enable_count) {
- if (clk->flags & CLK_IS_CRITICAL)
- return;
-
if (clk->ops->disable)
clk->ops->disable(clk);
--
2.25.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2020-02-25 8:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-25 8:22 [PATCH 1/3] clk: initially enable critical clocks Sascha Hauer
2020-02-25 8:22 ` Sascha Hauer [this message]
2020-02-25 8:22 ` [PATCH 3/3] clk: print more consistent clock states Sascha Hauer
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=20200225082202.10569-2-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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