diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2020-02-24 11:37:13 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-02-25 09:21:52 +0100 |
commit | f0b531594f0e7c133fc80ff050171d8ce5f8192a (patch) | |
tree | ba156c37b6824baa55eb3575e04bae3718480368 /drivers | |
parent | ca18a9ebf0d6e8be8bebb93957de1d86917910a0 (diff) | |
download | barebox-f0b531594f0e7c133fc80ff050171d8ce5f8192a.tar.gz barebox-f0b531594f0e7c133fc80ff050171d8ce5f8192a.tar.xz |
clk: Do not let the enable count of critical clocks go below 1
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/clk/clk.c | 8 |
1 files 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); |