ia64/linux-2.6.18-xen.hg

changeset 580:e7b48c70c727

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@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Jun 27 14:46:41 2008 +0100 (2008-06-27)
parents 043dc7488c11
children 65faf5fc61a1
files drivers/acpi/sleep/proc.c
line diff
     1.1 --- a/drivers/acpi/sleep/proc.c	Tue Jun 24 21:02:47 2008 +0100
     1.2 +++ b/drivers/acpi/sleep/proc.c	Fri Jun 27 14:46:41 2008 +0100
     1.3 @@ -251,6 +251,8 @@ acpi_system_write_alarm(struct file *fil
     1.4  
     1.5  	if (adjust) {
     1.6  		yr += CMOS_READ(RTC_YEAR);
     1.7 +		if (acpi_gbl_FADT->century)
     1.8 +			yr += CMOS_READ(acpi_gbl_FADT->century) * 100;
     1.9  		mo += CMOS_READ(RTC_MONTH);
    1.10  		day += CMOS_READ(RTC_DAY_OF_MONTH);
    1.11  		hr += CMOS_READ(RTC_HOURS);