Skip to content

Commit

Permalink
clocksource: sh_cmt: Initialize 'max_match_value' and 'lock' in sh_cm…
Browse files Browse the repository at this point in the history
…t_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>
  • Loading branch information
Magnus Damm authored and Simon Horman committed Mar 12, 2013
1 parent 2fd61b3 commit 44a10f9
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions drivers/clocksource/sh_cmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,14 +625,6 @@ static int sh_cmt_register(struct sh_cmt_priv *p, char *name,
unsigned long clockevent_rating,
unsigned long clocksource_rating)
{
if (p->width == (sizeof(p->max_match_value) * 8))
p->max_match_value = ~0;
else
p->max_match_value = (1 << p->width) - 1;

p->match_value = p->max_match_value;
raw_spin_lock_init(&p->lock);

if (clockevent_rating)
sh_cmt_register_clockevent(p, name, clockevent_rating);

Expand Down Expand Up @@ -703,6 +695,14 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev)
p->clear_bits = ~0xc000;
}

if (p->width == (sizeof(p->max_match_value) * 8))
p->max_match_value = ~0;
else
p->max_match_value = (1 << p->width) - 1;

p->match_value = p->max_match_value;
raw_spin_lock_init(&p->lock);

ret = sh_cmt_register(p, (char *)dev_name(&p->pdev->dev),
cfg->clockevent_rating,
cfg->clocksource_rating);
Expand Down

0 comments on commit 44a10f9

Please sign in to comment.