Skip to contentSkip to conversation

sh: enable and disable clocks recursively

PATCH New Magnus Damm 1 participant 1 message Oct 31, 2008 SuperH

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sh: enable and disable clocks recursively

From: Magnus Damm <[email protected]>

Recurse and make sure parent clocks get enabled/disabled.

---

 arch/sh/kernel/cpu/clock.c |   10 ++++++++++
 1 file changed, 10 insertions(+)
arch/sh/kernel/cpu/clock.c +10 -0
@@ -117,6 +117,11 @@ int clk_enable(struct clk *clk)
 	unsigned long flags;
 	int ret;
 
+	if (!clk)
+		return -EINVAL;
+
+	clk_enable(clk->parent);
+
 	spin_lock_irqsave(&clock_lock, flags);
 	ret = __clk_enable(clk);
 	spin_unlock_irqrestore(&clock_lock, flags);
@@ -147,9 +152,14 @@ void clk_disable(struct clk *clk)
 {
 	unsigned long flags;
 
+	if (!clk)
+		return -EINVAL;
+
 	spin_lock_irqsave(&clock_lock, flags);
 	__clk_disable(clk);
 	spin_unlock_irqrestore(&clock_lock, flags);
+
+	clk_disable(clk->parent);
 }
 EXPORT_SYMBOL_GPL(clk_disable);