summaryrefslogtreecommitdiffstats
path: root/arch/ppc/kernel/pmac_time.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-06-19 22:45:37 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-06-19 22:45:37 +0000
commit6d403070f28cd44860fdb3a53be5da0275c65cf4 (patch)
tree0d0e7fe7b5fb7568d19e11d7d862b77a866ce081 /arch/ppc/kernel/pmac_time.c
parentecf1bf5f6c2e668d03b0a9fb026db7aa41e292e1 (diff)
Merge with 2.4.0-test1-ac21 + pile of MIPS cleanups to make merging
possible. Chainsawed RM200 kernel to compile again. Jazz machine status unknown.
Diffstat (limited to 'arch/ppc/kernel/pmac_time.c')
-rw-r--r--arch/ppc/kernel/pmac_time.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/ppc/kernel/pmac_time.c b/arch/ppc/kernel/pmac_time.c
index 3b7dd283f..ebd0037de 100644
--- a/arch/ppc/kernel/pmac_time.c
+++ b/arch/ppc/kernel/pmac_time.c
@@ -28,6 +28,8 @@
#include "time.h"
+extern rwlock_t xtime_lock;
+
/* Apparently the RTC stores seconds since 1 Jan 1904 */
#define RTC_OFFSET 2082844800
@@ -151,16 +153,21 @@ int __init via_calibrate_decr(void)
static int time_sleep_notify(struct pmu_sleep_notifier *self, int when)
{
static unsigned long time_diff;
+ unsigned long flags;
switch (when) {
case PBOOK_SLEEP_NOW:
+ read_lock_irqsave(&xtime_lock, flags);
time_diff = xtime.tv_sec - pmac_get_rtc_time();
+ read_unlock_irqrestore(&xtime_lock, flags);
break;
case PBOOK_WAKE:
+ write_lock_irqsave(&xtime_lock, flags);
xtime.tv_sec = pmac_get_rtc_time() + time_diff;
xtime.tv_usec = 0;
set_dec(decrementer_count);
last_rtc_update = xtime.tv_sec;
+ write_unlock_irqrestore(&xtime_lock, flags);
break;
}
return PBOOK_SLEEP_OK;