diff options
| author | Paul Mundt <lethal@linux-sh.org> | 2012-05-25 00:36:43 -0400 |
|---|---|---|
| committer | Paul Mundt <lethal@linux-sh.org> | 2012-06-11 03:01:38 -0400 |
| commit | 7d0c399fe94d4fe572eadc7405654a282e5df63d (patch) | |
| tree | 23a1fa5847b4c6eb0624dea4d85557389f76a081 /drivers/clocksource | |
| parent | cfaf025112d3856637ff34a767ef785ef5cf2ca9 (diff) | |
clocksource: sh_cmt: Convert timer lock to raw spinlock.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/clocksource')
| -rw-r--r-- | drivers/clocksource/sh_cmt.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c index 32fe9ef5cc5c..98b06baafcc6 100644 --- a/drivers/clocksource/sh_cmt.c +++ b/drivers/clocksource/sh_cmt.c | |||
| @@ -48,13 +48,13 @@ struct sh_cmt_priv { | |||
| 48 | unsigned long next_match_value; | 48 | unsigned long next_match_value; |
| 49 | unsigned long max_match_value; | 49 | unsigned long max_match_value; |
| 50 | unsigned long rate; | 50 | unsigned long rate; |
| 51 | spinlock_t lock; | 51 | raw_spinlock_t lock; |
| 52 | struct clock_event_device ced; | 52 | struct clock_event_device ced; |
| 53 | struct clocksource cs; | 53 | struct clocksource cs; |
| 54 | unsigned long total_cycles; | 54 | unsigned long total_cycles; |
| 55 | }; | 55 | }; |
| 56 | 56 | ||
| 57 | static DEFINE_SPINLOCK(sh_cmt_lock); | 57 | static DEFINE_RAW_SPINLOCK(sh_cmt_lock); |
| 58 | 58 | ||
| 59 | #define CMSTR -1 /* shared register */ | 59 | #define CMSTR -1 /* shared register */ |
| 60 | #define CMCSR 0 /* channel register */ | 60 | #define CMCSR 0 /* channel register */ |
| @@ -139,7 +139,7 @@ static void sh_cmt_start_stop_ch(struct sh_cmt_priv *p, int start) | |||
| 139 | unsigned long flags, value; | 139 | unsigned long flags, value; |
| 140 | 140 | ||
| 141 | /* start stop register shared by multiple timer channels */ | 141 | /* start stop register shared by multiple timer channels */ |
| 142 | spin_lock_irqsave(&sh_cmt_lock, flags); | 142 | raw_spin_lock_irqsave(&sh_cmt_lock, flags); |
| 143 | value = sh_cmt_read(p, CMSTR); | 143 | value = sh_cmt_read(p, CMSTR); |
| 144 | 144 | ||
| 145 | if (start) | 145 | if (start) |
| @@ -148,7 +148,7 @@ static void sh_cmt_start_stop_ch(struct sh_cmt_priv *p, int start) | |||
| 148 | value &= ~(1 << cfg->timer_bit); | 148 | value &= ~(1 << cfg->timer_bit); |
| 149 | 149 | ||
| 150 | sh_cmt_write(p, CMSTR, value); | 150 | sh_cmt_write(p, CMSTR, value); |
| 151 | spin_unlock_irqrestore(&sh_cmt_lock, flags); | 151 | raw_spin_unlock_irqrestore(&sh_cmt_lock, flags); |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | static int sh_cmt_enable(struct sh_cmt_priv *p, unsigned long *rate) | 154 | static int sh_cmt_enable(struct sh_cmt_priv *p, unsigned long *rate) |
| @@ -328,9 +328,9 @@ static void sh_cmt_set_next(struct sh_cmt_priv *p, unsigned long delta) | |||
| 328 | { | 328 | { |
| 329 | unsigned long flags; | 329 | unsigned long flags; |
| 330 | 330 | ||
| 331 | spin_lock_irqsave(&p->lock, flags); | 331 | raw_spin_lock_irqsave(&p->lock, flags); |
| 332 | __sh_cmt_set_next(p, delta); | 332 | __sh_cmt_set_next(p, delta); |
| 333 | spin_unlock_irqrestore(&p->lock, flags); | 333 | raw_spin_unlock_irqrestore(&p->lock, flags); |
| 334 | } | 334 | } |
| 335 | 335 | ||
| 336 | static irqreturn_t sh_cmt_interrupt(int irq, void *dev_id) | 336 | static irqreturn_t sh_cmt_interrupt(int irq, void *dev_id) |
| @@ -385,7 +385,7 @@ static int sh_cmt_start(struct sh_cmt_priv *p, unsigned long flag) | |||
| 385 | int ret = 0; | 385 | int ret = 0; |
| 386 | unsigned long flags; | 386 | unsigned long flags; |
| 387 | 387 | ||
| 388 | spin_lock_irqsave(&p->lock, flags); | 388 | raw_spin_lock_irqsave(&p->lock, flags); |
| 389 | 389 | ||
| 390 | if (!(p->flags & (FLAG_CLOCKEVENT | FLAG_CLOCKSOURCE))) | 390 | if (!(p->flags & (FLAG_CLOCKEVENT | FLAG_CLOCKSOURCE))) |
| 391 | ret = sh_cmt_enable(p, &p->rate); | 391 | ret = sh_cmt_enable(p, &p->rate); |
| @@ -398,7 +398,7 @@ static int sh_cmt_start(struct sh_cmt_priv *p, unsigned long flag) | |||
| 398 | if ((flag == FLAG_CLOCKSOURCE) && (!(p->flags & FLAG_CLOCKEVENT))) | 398 | if ((flag == FLAG_CLOCKSOURCE) && (!(p->flags & FLAG_CLOCKEVENT))) |
| 399 | __sh_cmt_set_next(p, p->max_match_value); | 399 | __sh_cmt_set_next(p, p->max_match_value); |
| 400 | out: | 400 | out: |
| 401 | spin_unlock_irqrestore(&p->lock, flags); | 401 | raw_spin_unlock_irqrestore(&p->lock, flags); |
| 402 | 402 | ||
| 403 | return ret; | 403 | return ret; |
| 404 | } | 404 | } |
| @@ -408,7 +408,7 @@ static void sh_cmt_stop(struct sh_cmt_priv *p, unsigned long flag) | |||
| 408 | unsigned long flags; | 408 | unsigned long flags; |
| 409 | unsigned long f; | 409 | unsigned long f; |
| 410 | 410 | ||
| 411 | spin_lock_irqsave(&p->lock, flags); | 411 | raw_spin_lock_irqsave(&p->lock, flags); |
| 412 | 412 | ||
| 413 | f = p->flags & (FLAG_CLOCKEVENT | FLAG_CLOCKSOURCE); | 413 | f = p->flags & (FLAG_CLOCKEVENT | FLAG_CLOCKSOURCE); |
| 414 | p->flags &= ~flag; | 414 | p->flags &= ~flag; |
| @@ -420,7 +420,7 @@ static void sh_cmt_stop(struct sh_cmt_priv *p, unsigned long flag) | |||
| 420 | if ((flag == FLAG_CLOCKEVENT) && (p->flags & FLAG_CLOCKSOURCE)) | 420 | if ((flag == FLAG_CLOCKEVENT) && (p->flags & FLAG_CLOCKSOURCE)) |
| 421 | __sh_cmt_set_next(p, p->max_match_value); | 421 | __sh_cmt_set_next(p, p->max_match_value); |
| 422 | 422 | ||
| 423 | spin_unlock_irqrestore(&p->lock, flags); | 423 | raw_spin_unlock_irqrestore(&p->lock, flags); |
| 424 | } | 424 | } |
| 425 | 425 | ||
| 426 | static struct sh_cmt_priv *cs_to_sh_cmt(struct clocksource *cs) | 426 | static struct sh_cmt_priv *cs_to_sh_cmt(struct clocksource *cs) |
| @@ -435,13 +435,13 @@ static cycle_t sh_cmt_clocksource_read(struct clocksource *cs) | |||
| 435 | unsigned long value; | 435 | unsigned long value; |
| 436 | int has_wrapped; | 436 | int has_wrapped; |
| 437 | 437 | ||
| 438 | spin_lock_irqsave(&p->lock, flags); | 438 | raw_spin_lock_irqsave(&p->lock, flags); |
| 439 | value = p->total_cycles; | 439 | value = p->total_cycles; |
| 440 | raw = sh_cmt_get_counter(p, &has_wrapped); | 440 | raw = sh_cmt_get_counter(p, &has_wrapped); |
| 441 | 441 | ||
| 442 | if (unlikely(has_wrapped)) | 442 | if (unlikely(has_wrapped)) |
| 443 | raw += p->match_value + 1; | 443 | raw += p->match_value + 1; |
| 444 | spin_unlock_irqrestore(&p->lock, flags); | 444 | raw_spin_unlock_irqrestore(&p->lock, flags); |
| 445 | 445 | ||
| 446 | return value + raw; | 446 | return value + raw; |
| 447 | } | 447 | } |
| @@ -591,7 +591,7 @@ static int sh_cmt_register(struct sh_cmt_priv *p, char *name, | |||
| 591 | p->max_match_value = (1 << p->width) - 1; | 591 | p->max_match_value = (1 << p->width) - 1; |
| 592 | 592 | ||
| 593 | p->match_value = p->max_match_value; | 593 | p->match_value = p->max_match_value; |
| 594 | spin_lock_init(&p->lock); | 594 | raw_spin_lock_init(&p->lock); |
| 595 | 595 | ||
| 596 | if (clockevent_rating) | 596 | if (clockevent_rating) |
| 597 | sh_cmt_register_clockevent(p, name, clockevent_rating); | 597 | sh_cmt_register_clockevent(p, name, clockevent_rating); |
