diff options
author | Magnus Damm <damm@igel.co.jp> | 2009-05-07 10:31:39 +0000 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-05-08 11:38:28 +0900 |
commit | b3cacf318172757783d8272fc333284dd4f50140 (patch) | |
tree | d1fae2277559908d5c86db8daabd605db233c2b7 /arch/sh | |
parent | 5dafc91fca9135a7b0acb76d9709f4abfad92d6e (diff) |
sh: call clock framework init() callback once
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>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh')
-rw-r--r-- | arch/sh/kernel/cpu/clock.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/arch/sh/kernel/cpu/clock.c b/arch/sh/kernel/cpu/clock.c index 1dc896483b5..099373ae57d 100644 --- a/arch/sh/kernel/cpu/clock.c +++ b/arch/sh/kernel/cpu/clock.c @@ -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); |