lkml.org 
[lkml]   [2007]   [Jan]   [6]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
FromDavid Brownell <>
Subject[patch 2.6.20-rc3] rtc-sh correctly reports rtc_wkalrm.enabled
DateFri, 5 Jan 2007 20:55:05 -0800
This fixes the SH rtc driver to
  (a) correctly report 'enabled' status with other alarm status;
  (b) not duplicate that status in its procfs dump

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>

---
An audit of the RTC driver treatment of the "enabled" flag turned
up a handful of clear bugs; most drivers handle it the same now
(assuming they support alarms).
This driver has another issue:  sh_rtc_set_alarm() ignores the
"enabled" flag, rather than using it to tell whether the alarm
should be enabled on exit from that routine.  One at a time.  :)

Index: at91/drivers/rtc/rtc-sh.c
===================================================================
--- at91.orig/drivers/rtc/rtc-sh.c	2006-12-18 23:32:22.000000000 -0800
+++ at91/drivers/rtc/rtc-sh.c	2006-12-18 23:34:37.000000000 -0800
@@ -264,8 +264,6 @@ static int sh_rtc_proc(struct device *de
 	unsigned int tmp;
 
 	tmp = readb(rtc->regbase + RCR1);
-	seq_printf(seq, "alarm_IRQ\t: %s\n",
-		   (tmp & RCR1_AIE) ? "yes" : "no");
 	seq_printf(seq, "carry_IRQ\t: %s\n",
 		   (tmp & RCR1_CIE) ? "yes" : "no");
 
@@ -428,6 +426,8 @@ static int sh_rtc_read_alarm(struct devi
 		tm->tm_mon -= 1; /* RTC is 1-12, tm_mon is 0-11 */
 	tm->tm_year     = 0xffff;
 
+	wkalrm->enabled = (readb(rtc->regbase + RCR1) & RCR1_AIE) ? 1 : 0;
+
 	spin_unlock_irq(&rtc->lock);
 
 	return 0;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2007-01-06 07:51    [from the cache]
©2003-2008