aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/cpu/clock.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/kernel/cpu/clock.c')
-rw-r--r--arch/sh/kernel/cpu/clock.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/arch/sh/kernel/cpu/clock.c b/arch/sh/kernel/cpu/clock.c
index 2ced20f870d..0a7755cc8a2 100644
--- a/arch/sh/kernel/cpu/clock.c
+++ b/arch/sh/kernel/cpu/clock.c
@@ -265,20 +265,27 @@ EXPORT_SYMBOL_GPL(clk_set_rate);
265int clk_set_rate_ex(struct clk *clk, unsigned long rate, int algo_id) 265int clk_set_rate_ex(struct clk *clk, unsigned long rate, int algo_id)
266{ 266{
267 int ret = -EOPNOTSUPP; 267 int ret = -EOPNOTSUPP;
268 unsigned long flags;
268 269
269 if (likely(clk->ops && clk->ops->set_rate)) { 270 spin_lock_irqsave(&clock_lock, flags);
270 unsigned long flags;
271 271
272 spin_lock_irqsave(&clock_lock, flags); 272 if (likely(clk->ops && clk->ops->set_rate)) {
273 ret = clk->ops->set_rate(clk, rate, algo_id); 273 ret = clk->ops->set_rate(clk, rate, algo_id);
274 if (ret == 0) { 274 if (ret != 0)
275 if (clk->ops->recalc) 275 goto out_unlock;
276 clk->rate = clk->ops->recalc(clk); 276 } else {
277 propagate_rate(clk); 277 clk->rate = rate;
278 } 278 ret = 0;
279 spin_unlock_irqrestore(&clock_lock, flags);
280 } 279 }
281 280
281 if (clk->ops && clk->ops->recalc)
282 clk->rate = clk->ops->recalc(clk);
283
284 propagate_rate(clk);
285
286out_unlock:
287 spin_unlock_irqrestore(&clock_lock, flags);
288
282 return ret; 289 return ret;
283} 290}
284EXPORT_SYMBOL_GPL(clk_set_rate_ex); 291EXPORT_SYMBOL_GPL(clk_set_rate_ex);