diff mbox

[lucid/mvl-dove,maverick/mvl-dove] SRU: Setting rtc wakealarm through sysfs interface fails

Message ID 4D7F7CD8.10609@canonical.com
State New
Headers show

Commit Message

Paolo Pisati March 15, 2011, 2:51 p.m. UTC
SRU Justification:

    Impact: alarm date are always improperly set to 2091.
    Fix: see attached patch.
    Testcase:

     sudo sh -c "echo `date '+%s' -d '+ 5 minutes'` >
/sys/class/rtc/rtc0/wakealarm" && cat /proc/driver/rtc

     you will notice that alrm_date is 2091.

BugLink: https://bugs.launchpad.net/ubuntu/+bug/503546

This affects lucid/mvl-dove and maverick/mvl-dove.

Comments

Eric Miao March 15, 2011, 3:10 p.m. UTC | #1
Looks good to me

Acked-by: Eric Miao <eric.miao@canonical.com>

On Tue, Mar 15, 2011 at 10:51 PM, Paolo Pisati
<paolo.pisati@canonical.com> wrote:
> SRU Justification:
>
>    Impact: alarm date are always improperly set to 2091.
>    Fix: see attached patch.
>    Testcase:
>
>     sudo sh -c "echo `date '+%s' -d '+ 5 minutes'` >
> /sys/class/rtc/rtc0/wakealarm" && cat /proc/driver/rtc
>
>     you will notice that alrm_date is 2091.
>
> BugLink: https://bugs.launchpad.net/ubuntu/+bug/503546
>
> This affects lucid/mvl-dove and maverick/mvl-dove.
>
> --
> bye,
> p.
>
>
> --
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
>
>
Eric Miao March 15, 2011, 3:27 p.m. UTC | #2
Looks good to me

Acked-by: Eric Miao <eric.miao@canonical.com>

On Tue, Mar 15, 2011 at 10:51 PM, Paolo Pisati
<paolo.pisati@canonical.com> wrote:
> SRU Justification:
>
>    Impact: alarm date are always improperly set to 2091.
>    Fix: see attached patch.
>    Testcase:
>
>     sudo sh -c "echo `date '+%s' -d '+ 5 minutes'` >
> /sys/class/rtc/rtc0/wakealarm" && cat /proc/driver/rtc
>
>     you will notice that alrm_date is 2091.
>
> BugLink: https://bugs.launchpad.net/ubuntu/+bug/503546
>
> This affects lucid/mvl-dove and maverick/mvl-dove.
>
> --
> bye,
> p.
>
>
> --
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
>
>
Tim Gardner March 16, 2011, 1:12 p.m. UTC | #3
On 03/15/2011 08:51 AM, Paolo Pisati wrote:
> SRU Justification:
>
>      Impact: alarm date are always improperly set to 2091.
>      Fix: see attached patch.
>      Testcase:
>
>       sudo sh -c "echo `date '+%s' -d '+ 5 minutes'`>
> /sys/class/rtc/rtc0/wakealarm"&&  cat /proc/driver/rtc
>
>       you will notice that alrm_date is 2091.
>
> BugLink: https://bugs.launchpad.net/ubuntu/+bug/503546
>
> This affects lucid/mvl-dove and maverick/mvl-dove.
>
>

applied and pushed to Lucid mvl-dove
diff mbox

Patch

From 39771eca99a21077d163fe150c086d99391d119d Mon Sep 17 00:00:00 2001
From: Paolo Pisati <paolo.pisati@canonical.com>
Date: Mon, 14 Mar 2011 17:50:13 +0100
Subject: [PATCH] rtc dove: fix reading back alarm's date.

When reading back next alarm year, correctly mask out the RTC_ALARM_VALID
constant: this prevents all alarms to _apparently_ be pending in 2091.

BugLink: https://bugs.launchpad.net/ubuntu/+bug/503546

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
---
 drivers/rtc/rtc-mv.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c
index daf7c5e..8446717 100755
--- a/drivers/rtc/rtc-mv.c
+++ b/drivers/rtc/rtc-mv.c
@@ -112,7 +112,7 @@  static int mv_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
 
 	day = rtc_date & 0x3f;
 	month = (rtc_date >> RTC_MONTH_OFFS) & 0x3f;
-	year = (rtc_date >> RTC_YEAR_OFFS) & 0xff;
+	year = (rtc_date >> RTC_YEAR_OFFS) & 0x7f;
 
 	alm->time.tm_sec = bcd2bin(second);
 	alm->time.tm_min = bcd2bin(minute);
-- 
1.7.1