Skip to contentSkip to conversation

rtc-sh correctly reports rtc_wkalrm.enabled

PATCH In review David Brownell 3 participants 3 messages Jan 6, 2007 – Jan 11, 2007 Real time clock (RTC)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtc-sh correctly reports rtc_wkalrm.enabled

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

---
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. :)

drivers/rtc/rtc-sh.c +2 -2
Index: at91/drivers/rtc/rtc-sh.c
===================================================================
@@ -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;
#2 lore raw
In reply to David Brownell

On Fri, Jan 05, 2007 at 08:55:05PM -0800, David Brownell wrote:
[...]

Quoted 2 lines

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

Yeah, I missed the existing of the enabled flag when I added alarm support to the driver. Your patch is fine.

Quoted 3 lines

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. :)

I'll can take care of this.

Signature · 1 line
 Jamie Lenehan <[email protected]>