[RFC] [PATCH 1/3] Allow to override the RTC alarm time

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

 



Subject: ACPI: Allow to override the RTC alarm time 
>From : Zhao Yakui <yakui.zhao@xxxxxxxxx>

In current kernel when RTC alarm time is set and not fired,
it is impossible to set RTC alarm again. But it is more
reasonable that the RTC alarm time can be overrided.

At the same time there is a bug in the function of 
cmos_set_alarm. RTC alarm time for October can't be set 
correctly. 
For October: 0x0A will be written into the RTC region
(MONTH_ALARM). But in fact 0x10 should be written.

Signed-off-by: Zhao Yakui <yakui.zhao@xxxxxxxxx>
Signed-off-by: Zhang Rui  <rui.zhang@xxxxxxxxx>

---
 drivers/rtc/rtc-cmos.c  |    5 ++---
 drivers/rtc/rtc-sysfs.c |    2 --
 2 files changed, 2 insertions(+), 5 deletions(-)

Index: linux-2.6/drivers/rtc/rtc-cmos.c
===================================================================
--- linux-2.6.orig/drivers/rtc/rtc-cmos.c
+++ linux-2.6/drivers/rtc/rtc-cmos.c
@@ -198,9 +198,8 @@ static int cmos_set_alarm(struct device 
 
 	/* Writing 0xff means "don't care" or "match all".  */
 
-	mon = t->time.tm_mon;
-	mon = (mon < 12) ? BIN2BCD(mon) : 0xff;
-	mon++;
+	mon = t->time.tm_mon + 1;
+	mon = (mon <= 12) ? BIN2BCD(mon) : 0xff;
 
 	mday = t->time.tm_mday;
 	mday = (mday >= 1 && mday <= 31) ? BIN2BCD(mday) : 0xff;
Index: linux-2.6/drivers/rtc/rtc-sysfs.c
===================================================================
--- linux-2.6.orig/drivers/rtc/rtc-sysfs.c
+++ linux-2.6/drivers/rtc/rtc-sysfs.c
@@ -163,8 +163,6 @@ rtc_sysfs_set_wakealarm(struct device *d
 		retval = rtc_read_alarm(rtc, &alm);
 		if (retval < 0)
 			return retval;
-		if (alm.enabled)
-			return -EBUSY;
 
 		alm.enabled = 1;
 	} else {


--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux