diff options
| author | Magnus Damm <damm@opensource.se> | 2012-12-14 00:53:41 -0500 |
|---|---|---|
| committer | Simon Horman <horms+renesas@verge.net.au> | 2013-03-12 13:24:36 -0400 |
| commit | 44a10f943f59339f1206d599d4269a35995e397e (patch) | |
| tree | e1c93f550d7bd1d4a022de10c2519babb7b57ee8 /drivers/clocksource | |
| parent | 2fd61b32764c82b8410a4374d0ab3ec418ce37c7 (diff) | |
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>
Diffstat (limited to 'drivers/clocksource')
| -rw-r--r-- | drivers/clocksource/sh_cmt.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c index 4b8d2962cad7..2e496841b167 100644 --- a/drivers/clocksource/sh_cmt.c +++ b/drivers/clocksource/sh_cmt.c | |||
| @@ -625,14 +625,6 @@ static int sh_cmt_register(struct sh_cmt_priv *p, char *name, | |||
| 625 | unsigned long clockevent_rating, | 625 | unsigned long clockevent_rating, |
| 626 | unsigned long clocksource_rating) | 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 | if (clockevent_rating) | 628 | if (clockevent_rating) |
| 637 | sh_cmt_register_clockevent(p, name, clockevent_rating); | 629 | sh_cmt_register_clockevent(p, name, clockevent_rating); |
| 638 | 630 | ||
| @@ -703,6 +695,14 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev) | |||
| 703 | p->clear_bits = ~0xc000; | 695 | p->clear_bits = ~0xc000; |
| 704 | } | 696 | } |
| 705 | 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 | |||
| 706 | ret = sh_cmt_register(p, (char *)dev_name(&p->pdev->dev), | 706 | ret = sh_cmt_register(p, (char *)dev_name(&p->pdev->dev), |
| 707 | cfg->clockevent_rating, | 707 | cfg->clockevent_rating, |
| 708 | cfg->clocksource_rating); | 708 | cfg->clocksource_rating); |
