aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/time.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2006-11-30 23:12:05 -0500
committerPaul Mundt <lethal@linux-sh.org>2006-12-05 20:45:39 -0500
commite74b56800e78a10bc09b56a87831876a1d9d09ae (patch)
tree0468f7bd4324ffe8d6d7f00ffd2fa3376fcc65aa /arch/sh/kernel/time.c
parentbca7c20764c83a44c7b8b0831089922d56a3a9a2 (diff)
sh: Turn off IRQs around get_timer_offset() calls.
Since all of the sys_timer sources currently do this on their own within the ->get_offset() path, it's more sensible to just have the caller take care of it when grabbing xtime_lock. Incidentally, this is more in line with what others (ie, ARM) are doing already. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel/time.c')
-rw-r--r--arch/sh/kernel/time.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/arch/sh/kernel/time.c b/arch/sh/kernel/time.c
index 57e708d7b52d..c55d6f217a46 100644
--- a/arch/sh/kernel/time.c
+++ b/arch/sh/kernel/time.c
@@ -50,15 +50,20 @@ unsigned long long __attribute__ ((weak)) sched_clock(void)
50#ifndef CONFIG_GENERIC_TIME 50#ifndef CONFIG_GENERIC_TIME
51void do_gettimeofday(struct timeval *tv) 51void do_gettimeofday(struct timeval *tv)
52{ 52{
53 unsigned long flags;
53 unsigned long seq; 54 unsigned long seq;
54 unsigned long usec, sec; 55 unsigned long usec, sec;
55 56
56 do { 57 do {
57 seq = read_seqbegin(&xtime_lock); 58 /*
59 * Turn off IRQs when grabbing xtime_lock, so that
60 * the sys_timer get_offset code doesn't have to handle it.
61 */
62 seq = read_seqbegin_irqsave(&xtime_lock, flags);
58 usec = get_timer_offset(); 63 usec = get_timer_offset();
59 sec = xtime.tv_sec; 64 sec = xtime.tv_sec;
60 usec += xtime.tv_nsec / 1000; 65 usec += xtime.tv_nsec / NSEC_PER_USEC;
61 } while (read_seqretry(&xtime_lock, seq)); 66 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
62 67
63 while (usec >= 1000000) { 68 while (usec >= 1000000) {
64 usec -= 1000000; 69 usec -= 1000000;
@@ -85,7 +90,7 @@ int do_settimeofday(struct timespec *tv)
85 * wall time. Discover what correction gettimeofday() would have 90 * wall time. Discover what correction gettimeofday() would have
86 * made, and then undo it! 91 * made, and then undo it!
87 */ 92 */
88 nsec -= 1000 * get_timer_offset(); 93 nsec -= get_timer_offset() * NSEC_PER_USEC;
89 94
90 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); 95 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
91 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); 96 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);