public inbox for linux-sh@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sh: call clock framework init() callback once
@ 2009-05-07 10:31 Magnus Damm
  2009-05-08  5:34 ` Francesco VIRLINZI
  0 siblings, 1 reply; 2+ messages in thread
From: Magnus Damm @ 2009-05-07 10:31 UTC (permalink / raw)
  To: linux-sh

From: Magnus Damm <damm@igel.co.jp>

Make sure that clk->ops->init() only gets called once in
the case of CLK_ALWAYS_ENABLED. Without this patch the
init() callback may be called multiple times.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
---

 arch/sh/kernel/cpu/clock.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

--- 0001/arch/sh/kernel/cpu/clock.c
+++ work/arch/sh/kernel/cpu/clock.c	2009-05-07 15:00:52.000000000 +0900
@@ -99,15 +99,18 @@ static int __clk_enable(struct clk *clk)
 	 * changes and the clock needs to hunt for the proper set of
 	 * divisors to use before it can effectively recalc.
 	 */
+
+	if (clk->flags & CLK_ALWAYS_ENABLED) {
+		kref_get(&clk->kref);
+		return 0;
+	}
+
 	if (unlikely(atomic_read(&clk->kref.refcount) = 1))
 		if (clk->ops && clk->ops->init)
 			clk->ops->init(clk);
 
 	kref_get(&clk->kref);
 
-	if (clk->flags & CLK_ALWAYS_ENABLED)
-		return 0;
-
 	if (likely(clk->ops && clk->ops->enable))
 		clk->ops->enable(clk);
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-05-08  5:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-07 10:31 [PATCH] sh: call clock framework init() callback once Magnus Damm
2009-05-08  5:34 ` Francesco VIRLINZI

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox