aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc/kernel/time.c
diff options
context:
space:
mode:
authorjohn stultz <johnstul@us.ibm.com>2005-07-05 21:54:44 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-05 22:18:59 -0400
commitf326d22b8cc5bfebfa5b3f6a4066dc737def2234 (patch)
treeef7f968164e71fd5a4cd390e489a95c84e9afa9a /arch/ppc/kernel/time.c
parente6b6239f8e8e5bd9ba0192a854652abf14e28ce4 (diff)
[PATCH] ppc32: stop misusing NTP's time_offset value
As part of my timeofday rework, I've been looking at the NTP code and I noticed that the PPC architecture is apparently misusing the NTP's time_offset (it is a terrible name!) value as some form of timezone offset. This could cause problems when time_offset changed by the NTP code. This patch changes the PPC code so it uses a more clear local variable: timezone_offset. Signed-off-by: John Stultz <johnstul@us.ibm.com> Acked-by: Tom Rini <trini@kernel.crashing.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/ppc/kernel/time.c')
-rw-r--r--arch/ppc/kernel/time.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/arch/ppc/kernel/time.c b/arch/ppc/kernel/time.c
index 735866559199..bf4ddca5e853 100644
--- a/arch/ppc/kernel/time.c
+++ b/arch/ppc/kernel/time.c
@@ -89,6 +89,9 @@ unsigned long tb_to_ns_scale;
89 89
90extern unsigned long wall_jiffies; 90extern unsigned long wall_jiffies;
91 91
92/* used for timezone offset */
93static long timezone_offset;
94
92DEFINE_SPINLOCK(rtc_lock); 95DEFINE_SPINLOCK(rtc_lock);
93 96
94EXPORT_SYMBOL(rtc_lock); 97EXPORT_SYMBOL(rtc_lock);
@@ -170,7 +173,7 @@ void timer_interrupt(struct pt_regs * regs)
170 xtime.tv_sec - last_rtc_update >= 659 && 173 xtime.tv_sec - last_rtc_update >= 659 &&
171 abs((xtime.tv_nsec / 1000) - (1000000-1000000/HZ)) < 500000/HZ && 174 abs((xtime.tv_nsec / 1000) - (1000000-1000000/HZ)) < 500000/HZ &&
172 jiffies - wall_jiffies == 1) { 175 jiffies - wall_jiffies == 1) {
173 if (ppc_md.set_rtc_time(xtime.tv_sec+1 + time_offset) == 0) 176 if (ppc_md.set_rtc_time(xtime.tv_sec+1 + timezone_offset) == 0)
174 last_rtc_update = xtime.tv_sec+1; 177 last_rtc_update = xtime.tv_sec+1;
175 else 178 else
176 /* Try again one minute later */ 179 /* Try again one minute later */
@@ -286,7 +289,7 @@ void __init time_init(void)
286 unsigned old_stamp, stamp, elapsed; 289 unsigned old_stamp, stamp, elapsed;
287 290
288 if (ppc_md.time_init != NULL) 291 if (ppc_md.time_init != NULL)
289 time_offset = ppc_md.time_init(); 292 timezone_offset = ppc_md.time_init();
290 293
291 if (__USE_RTC()) { 294 if (__USE_RTC()) {
292 /* 601 processor: dec counts down by 128 every 128ns */ 295 /* 601 processor: dec counts down by 128 every 128ns */
@@ -331,10 +334,10 @@ void __init time_init(void)
331 set_dec(tb_ticks_per_jiffy); 334 set_dec(tb_ticks_per_jiffy);
332 335
333 /* If platform provided a timezone (pmac), we correct the time */ 336 /* If platform provided a timezone (pmac), we correct the time */
334 if (time_offset) { 337 if (timezone_offset) {
335 sys_tz.tz_minuteswest = -time_offset / 60; 338 sys_tz.tz_minuteswest = -timezone_offset / 60;
336 sys_tz.tz_dsttime = 0; 339 sys_tz.tz_dsttime = 0;
337 xtime.tv_sec -= time_offset; 340 xtime.tv_sec -= timezone_offset;
338 } 341 }
339 set_normalized_timespec(&wall_to_monotonic, 342 set_normalized_timespec(&wall_to_monotonic,
340 -xtime.tv_sec, -xtime.tv_nsec); 343 -xtime.tv_sec, -xtime.tv_nsec);