Commit 3392b309 authored by Andrew Victor's avatar Andrew Victor Committed by Russell King

[ARM] 4149/1: AT91: Overrun in SAM9 gettimeoffset().

Fix an overrun in the AT91SAM9 gettimeoffset() function.  This causes
the time value returned by gettimeofday() to jump "backwards".

Original patch from Michel Benoit.
Signed-off-by: default avatarAndrew Victor <andrew@sanpeople.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 127a7ec6
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
* Returns number of microseconds since last timer interrupt. Note that interrupts * Returns number of microseconds since last timer interrupt. Note that interrupts
* will have been disabled by do_gettimeofday() * will have been disabled by do_gettimeofday()
* 'LATCH' is hwclock ticks (see CLOCK_TICK_RATE in timex.h) per jiffy. * 'LATCH' is hwclock ticks (see CLOCK_TICK_RATE in timex.h) per jiffy.
* 'tick' is usecs per jiffy (linux/timex.h).
*/ */
static unsigned long at91sam926x_gettimeoffset(void) static unsigned long at91sam926x_gettimeoffset(void)
{ {
...@@ -39,7 +38,7 @@ static unsigned long at91sam926x_gettimeoffset(void) ...@@ -39,7 +38,7 @@ static unsigned long at91sam926x_gettimeoffset(void)
elapsed = (PIT_PICNT(t) * LATCH) + PIT_CPIV(t); /* hardware clock cycles */ elapsed = (PIT_PICNT(t) * LATCH) + PIT_CPIV(t); /* hardware clock cycles */
return (unsigned long)(elapsed * 1000000) / LATCH; return (unsigned long)(elapsed * jiffies_to_usecs(1)) / LATCH;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment