aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/cpu
diff options
context:
space:
mode:
authorMagnus Damm <damm@igel.co.jp>2009-05-07 06:31:39 -0400
committerPaul Mundt <lethal@linux-sh.org>2009-05-07 22:38:28 -0400
commitb3cacf318172757783d8272fc333284dd4f50140 (patch)
treed1fae2277559908d5c86db8daabd605db233c2b7 /arch/sh/kernel/cpu
parent5dafc91fca9135a7b0acb76d9709f4abfad92d6e (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/kernel/cpu')
-rw-r--r--arch/sh/kernel/cpu/clock.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/arch/sh/kernel/cpu/clock.c b/arch/sh/kernel/cpu/clock.c
index 1dc896483b59..099373ae57d8 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)
99 * changes and the clock needs to hunt for the proper set of 99 * changes and the clock needs to hunt for the proper set of
100 * divisors to use before it can effectively recalc. 100 * divisors to use before it can effectively recalc.
101 */ 101 */
102
103 if (clk->flags & CLK_ALWAYS_ENABLED) {
104 kref_get(&clk->kref);
105 return 0;
106 }
107
102 if (unlikely(atomic_read(&clk->kref.refcount) == 1)) 108 if (unlikely(atomic_read(&clk->kref.refcount) == 1))
103 if (clk->ops && clk->ops->init) 109 if (clk->ops && clk->ops->init)
104 clk->ops->init(clk); 110 clk->ops->init(clk);
105 111
106 kref_get(&clk->kref); 112 kref_get(&clk->kref);
107 113
108 if (clk->flags & CLK_ALWAYS_ENABLED)
109 return 0;
110
111 if (likely(clk->ops && clk->ops->enable)) 114 if (likely(clk->ops && clk->ops->enable))
112 clk->ops->enable(clk); 115 clk->ops->enable(clk);
113 116