From 559e4069be2b9ecaebe83d1f41370dc4929378dd Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Fri, 27 Jun 2008 14:46:41 +0100 Subject: [PATCH] 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 --- drivers/acpi/sleep/proc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/acpi/sleep/proc.c b/drivers/acpi/sleep/proc.c index 34962578..f094c249 100644 --- a/drivers/acpi/sleep/proc.c +++ b/drivers/acpi/sleep/proc.c @@ -251,6 +251,8 @@ acpi_system_write_alarm(struct file *file, 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); -- 2.39.5