aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clocksource/sh_cmt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/clocksource/sh_cmt.c')
-rw-r--r--drivers/clocksource/sh_cmt.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
index a44611652282..f975d24890fa 100644
--- a/drivers/clocksource/sh_cmt.c
+++ b/drivers/clocksource/sh_cmt.c
@@ -283,16 +283,21 @@ static void sh_cmt_clock_event_program_verify(struct sh_cmt_priv *p,
283 } while (delay); 283 } while (delay);
284} 284}
285 285
286static void sh_cmt_set_next(struct sh_cmt_priv *p, unsigned long delta) 286static void __sh_cmt_set_next(struct sh_cmt_priv *p, unsigned long delta)
287{ 287{
288 unsigned long flags;
289
290 if (delta > p->max_match_value) 288 if (delta > p->max_match_value)
291 dev_warn(&p->pdev->dev, "delta out of range\n"); 289 dev_warn(&p->pdev->dev, "delta out of range\n");
292 290
293 spin_lock_irqsave(&p->lock, flags);
294 p->next_match_value = delta; 291 p->next_match_value = delta;
295 sh_cmt_clock_event_program_verify(p, 0); 292 sh_cmt_clock_event_program_verify(p, 0);
293}
294
295static void sh_cmt_set_next(struct sh_cmt_priv *p, unsigned long delta)
296{
297 unsigned long flags;
298
299 spin_lock_irqsave(&p->lock, flags);
300 __sh_cmt_set_next(p, delta);
296 spin_unlock_irqrestore(&p->lock, flags); 301 spin_unlock_irqrestore(&p->lock, flags);
297} 302}
298 303
@@ -359,7 +364,7 @@ static int sh_cmt_start(struct sh_cmt_priv *p, unsigned long flag)
359 364
360 /* setup timeout if no clockevent */ 365 /* setup timeout if no clockevent */
361 if ((flag == FLAG_CLOCKSOURCE) && (!(p->flags & FLAG_CLOCKEVENT))) 366 if ((flag == FLAG_CLOCKSOURCE) && (!(p->flags & FLAG_CLOCKEVENT)))
362 sh_cmt_set_next(p, p->max_match_value); 367 __sh_cmt_set_next(p, p->max_match_value);
363 out: 368 out:
364 spin_unlock_irqrestore(&p->lock, flags); 369 spin_unlock_irqrestore(&p->lock, flags);
365 370
@@ -381,7 +386,7 @@ static void sh_cmt_stop(struct sh_cmt_priv *p, unsigned long flag)
381 386
382 /* adjust the timeout to maximum if only clocksource left */ 387 /* adjust the timeout to maximum if only clocksource left */
383 if ((flag == FLAG_CLOCKEVENT) && (p->flags & FLAG_CLOCKSOURCE)) 388 if ((flag == FLAG_CLOCKEVENT) && (p->flags & FLAG_CLOCKSOURCE))
384 sh_cmt_set_next(p, p->max_match_value); 389 __sh_cmt_set_next(p, p->max_match_value);
385 390
386 spin_unlock_irqrestore(&p->lock, flags); 391 spin_unlock_irqrestore(&p->lock, flags);
387} 392}
@@ -616,13 +621,9 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev)
616 /* get hold of clock */ 621 /* get hold of clock */
617 p->clk = clk_get(&p->pdev->dev, "cmt_fck"); 622 p->clk = clk_get(&p->pdev->dev, "cmt_fck");
618 if (IS_ERR(p->clk)) { 623 if (IS_ERR(p->clk)) {
619 dev_warn(&p->pdev->dev, "using deprecated clock lookup\n"); 624 dev_err(&p->pdev->dev, "cannot get clock\n");
620 p->clk = clk_get(&p->pdev->dev, cfg->clk); 625 ret = PTR_ERR(p->clk);
621 if (IS_ERR(p->clk)) { 626 goto err1;
622 dev_err(&p->pdev->dev, "cannot get clock\n");
623 ret = PTR_ERR(p->clk);
624 goto err1;
625 }
626 } 627 }
627 628
628 if (resource_size(res) == 6) { 629 if (resource_size(res) == 6) {