[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] Fix CMOS time error after writing /proc/acpi/alarm



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1214574401 -3600
# Node ID e7b48c70c7270d46ba645fc643b63bb49860ea44
# Parent  043dc7488c1105670a78cd45efa459fc4defa52d
Fix CMOS time error after writing /proc/acpi/alarm

When writing /proc/acpi/alarm in adjust mode, e.g.
        echo "+0000-00-00 00:00:15" >/proc/acpi/alarm
The "century" field should be read and added to "year" field before
writing, otherwise the CMOS time will go back to 2000 years ago, e.g.
        # cat /proc/acpi/alarm
        0008-06-21 11:38:46=20
Then the system time may be reset to the date of manufacture after
rebooting. This patch fixes this issue.

Signed-off-by: Huacai Chen <huacai.chen@xxxxxxxxx>
---
 drivers/acpi/sleep/proc.c |    2 ++
 1 files changed, 2 insertions(+)

diff -r 043dc7488c11 -r e7b48c70c727 drivers/acpi/sleep/proc.c
--- a/drivers/acpi/sleep/proc.c Tue Jun 24 21:02:47 2008 +0100
+++ b/drivers/acpi/sleep/proc.c Fri Jun 27 14:46:41 2008 +0100
@@ -251,6 +251,8 @@ acpi_system_write_alarm(struct file *fil
 
        if (adjust) {
                yr += CMOS_READ(RTC_YEAR);
+               if (acpi_gbl_FADT->century)
+                       yr += CMOS_READ(acpi_gbl_FADT->century) * 100;
                mo += CMOS_READ(RTC_MONTH);
                day += CMOS_READ(RTC_DAY_OF_MONTH);
                hr += CMOS_READ(RTC_HOURS);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.