Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

[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>

authored by

john stultz and committed by
Linus Torvalds
f326d22b e6b6239f

+8 -5
+8 -5
arch/ppc/kernel/time.c
··· 89 89 90 90 extern unsigned long wall_jiffies; 91 91 92 + /* used for timezone offset */ 93 + static long timezone_offset; 94 + 92 95 DEFINE_SPINLOCK(rtc_lock); 93 96 94 97 EXPORT_SYMBOL(rtc_lock); ··· 173 170 xtime.tv_sec - last_rtc_update >= 659 && 174 171 abs((xtime.tv_nsec / 1000) - (1000000-1000000/HZ)) < 500000/HZ && 175 172 jiffies - wall_jiffies == 1) { 176 - if (ppc_md.set_rtc_time(xtime.tv_sec+1 + time_offset) == 0) 173 + if (ppc_md.set_rtc_time(xtime.tv_sec+1 + timezone_offset) == 0) 177 174 last_rtc_update = xtime.tv_sec+1; 178 175 else 179 176 /* Try again one minute later */ ··· 289 286 unsigned old_stamp, stamp, elapsed; 290 287 291 288 if (ppc_md.time_init != NULL) 292 - time_offset = ppc_md.time_init(); 289 + timezone_offset = ppc_md.time_init(); 293 290 294 291 if (__USE_RTC()) { 295 292 /* 601 processor: dec counts down by 128 every 128ns */ ··· 334 331 set_dec(tb_ticks_per_jiffy); 335 332 336 333 /* If platform provided a timezone (pmac), we correct the time */ 337 - if (time_offset) { 338 - sys_tz.tz_minuteswest = -time_offset / 60; 334 + if (timezone_offset) { 335 + sys_tz.tz_minuteswest = -timezone_offset / 60; 339 336 sys_tz.tz_dsttime = 0; 340 - xtime.tv_sec -= time_offset; 337 + xtime.tv_sec -= timezone_offset; 341 338 } 342 339 set_normalized_timespec(&wall_to_monotonic, 343 340 -xtime.tv_sec, -xtime.tv_nsec);