Skip to content

Commit

Permalink
[ARM] 4149/1: AT91: Overrun in SAM9 gettimeoffset().
Browse files Browse the repository at this point in the history
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: Andrew Victor <andrew@sanpeople.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
Andrew Victor authored and Russell King committed Feb 8, 2007
1 parent 127a7ec commit 3392b30
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions arch/arm/mach-at91/at91sam926x_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
* Returns number of microseconds since last timer interrupt. Note that interrupts
* will have been disabled by do_gettimeofday()
* '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)
{
Expand All @@ -39,7 +38,7 @@ static unsigned long at91sam926x_gettimeoffset(void)

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;
}

/*
Expand Down

0 comments on commit 3392b30

Please sign in to comment.