Thread (126 messages) 126 messages, 18 authors, 2011-04-20
STALE5579d

[RFC,

From: Jeremy Kerr <hidden>
Date: 2011-02-09 06:41:47
Also in: linux-arm-kernel, lkml
Subsystem: common clk framework, the rest · Maintainers: Michael Turquette, Stephen Boyd, Linus Torvalds

This change adds warnings to check for:

 1) enabling a clock that hasn't been prepared; and

 2) unpreparing a clock that is still enabled

While the correctness can't be guaranteed, the warnings should cover
most situations, and won't indicate false positives.

Signed-off-by: Jeremy Kerr <redacted>

---
 drivers/clk/clk.c |    4 ++++
 1 file changed, 4 insertions(+)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index bbbdb0d..8c96623 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -29,6 +29,8 @@ EXPORT_SYMBOL_GPL(clk_prepare);
 
 void clk_unprepare(struct clk *clk)
 {
+	WARN_ON(clk->enable_count != 0);
+
 	mutex_lock(&clk->prepare_lock);
 
 	WARN_ON(clk->prepare_count = 0);
@@ -45,6 +47,8 @@ int clk_enable(struct clk *clk)
 	unsigned long flags;
 	int ret = 0;
 
+	WARN_ON(clk->prepare_count = 0);
+
 	spin_lock_irqsave(&clk->enable_lock, flags);
 	if (clk->enable_count = 0 && clk->ops->enable)
 		ret = clk->ops->enable(clk);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help