patch-2.4.0-test2 linux/arch/ppc/kernel/pmac_time.c
Next file: linux/arch/ppc/kernel/ppc_asm.h
Previous file: linux/arch/ppc/kernel/open_pic.c
Back to the patch index
Back to the overall index
- Lines: 31
- Date:
Mon Jun 19 17:59:36 2000
- Orig file:
v2.4.0-test1/linux/arch/ppc/kernel/pmac_time.c
- Orig date:
Sun Feb 13 19:29:03 2000
diff -u --recursive --new-file v2.4.0-test1/linux/arch/ppc/kernel/pmac_time.c linux/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 @@
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;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)