mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-05-07 15:53:49 +00:00
clocksource/drivers/sh_cmt: Fix clocksource width for 32-bit machines
The driver seems to abuse *unsigned long* not only for the (32-bit)
register values but also for the 'sh_cmt_channel::total_cycles' which
needs to always be 64-bit -- as a result, the clocksource's mask is
needlessly clamped down to 32-bits on the 32-bit machines...
Fixes: 19bdc9d061
("clocksource: sh_cmt clocksource support")
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
This commit is contained in:
parent
22627c6f3e
commit
37e7742c55
1 changed files with 3 additions and 3 deletions
|
@ -100,7 +100,7 @@ struct sh_cmt_channel {
|
||||||
raw_spinlock_t lock;
|
raw_spinlock_t lock;
|
||||||
struct clock_event_device ced;
|
struct clock_event_device ced;
|
||||||
struct clocksource cs;
|
struct clocksource cs;
|
||||||
unsigned long total_cycles;
|
u64 total_cycles;
|
||||||
bool cs_enabled;
|
bool cs_enabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -605,8 +605,8 @@ static u64 sh_cmt_clocksource_read(struct clocksource *cs)
|
||||||
{
|
{
|
||||||
struct sh_cmt_channel *ch = cs_to_sh_cmt(cs);
|
struct sh_cmt_channel *ch = cs_to_sh_cmt(cs);
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
unsigned long value;
|
|
||||||
u32 has_wrapped;
|
u32 has_wrapped;
|
||||||
|
u64 value;
|
||||||
u32 raw;
|
u32 raw;
|
||||||
|
|
||||||
raw_spin_lock_irqsave(&ch->lock, flags);
|
raw_spin_lock_irqsave(&ch->lock, flags);
|
||||||
|
@ -680,7 +680,7 @@ static int sh_cmt_register_clocksource(struct sh_cmt_channel *ch,
|
||||||
cs->disable = sh_cmt_clocksource_disable;
|
cs->disable = sh_cmt_clocksource_disable;
|
||||||
cs->suspend = sh_cmt_clocksource_suspend;
|
cs->suspend = sh_cmt_clocksource_suspend;
|
||||||
cs->resume = sh_cmt_clocksource_resume;
|
cs->resume = sh_cmt_clocksource_resume;
|
||||||
cs->mask = CLOCKSOURCE_MASK(sizeof(unsigned long) * 8);
|
cs->mask = CLOCKSOURCE_MASK(sizeof(u64) * 8);
|
||||||
cs->flags = CLOCK_SOURCE_IS_CONTINUOUS;
|
cs->flags = CLOCK_SOURCE_IS_CONTINUOUS;
|
||||||
|
|
||||||
dev_info(&ch->cmt->pdev->dev, "ch%u: used as clock source\n",
|
dev_info(&ch->cmt->pdev->dev, "ch%u: used as clock source\n",
|
||||||
|
|
Loading…
Add table
Reference in a new issue