Commit 44a10f943f59339f1206d599d4269a35995e397e

Authored by Magnus Damm
Committed by Simon Horman
1 parent 2fd61b3276

clocksource: sh_cmt: Initialize 'max_match_value' and 'lock' in sh_cmt_setup()

Move the setup of spinlock and max_match_value to sh_cmt_setup().
There's no need to defer those steps until sh_cmt_register().

Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com>
Signed-off-by: Magnus Damm <damm@opensource.se>
Acked-by: John Stultz <john.stultz@linaro.org>
Tested-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>

Showing 1 changed file with 8 additions and 8 deletions Side-by-side Diff

drivers/clocksource/sh_cmt.c
... ... @@ -625,14 +625,6 @@
625 625 unsigned long clockevent_rating,
626 626 unsigned long clocksource_rating)
627 627 {
628   - if (p->width == (sizeof(p->max_match_value) * 8))
629   - p->max_match_value = ~0;
630   - else
631   - p->max_match_value = (1 << p->width) - 1;
632   -
633   - p->match_value = p->max_match_value;
634   - raw_spin_lock_init(&p->lock);
635   -
636 628 if (clockevent_rating)
637 629 sh_cmt_register_clockevent(p, name, clockevent_rating);
638 630  
... ... @@ -702,6 +694,14 @@
702 694 p->overflow_bit = 0x8000;
703 695 p->clear_bits = ~0xc000;
704 696 }
  697 +
  698 + if (p->width == (sizeof(p->max_match_value) * 8))
  699 + p->max_match_value = ~0;
  700 + else
  701 + p->max_match_value = (1 << p->width) - 1;
  702 +
  703 + p->match_value = p->max_match_value;
  704 + raw_spin_lock_init(&p->lock);
705 705  
706 706 ret = sh_cmt_register(p, (char *)dev_name(&p->pdev->dev),
707 707 cfg->clockevent_rating,