Skip to contentSkip to conversation

rtc: core: Prevent repeated calling of alarm_irq_enable().

PATCH In review Jonghwa Lee 2 participants 2 messages Feb 6, 2013 Real time clock (RTC)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtc: core: Prevent repeated calling of alarm_irq_enable().

This patch removes repeated execution of disabling alarm in rtc_alarm_irq_enable() of rtc core interface. It made useless call even all alarm had been disabled from rtc_timer_remove(). We'd better to skip disabling alarm when timer queue is empty.

---
 drivers/rtc/interface.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/interface.c +1 -1
index 9592b93..11cfb76 100644
@@ -428,7 +428,7 @@ int rtc_alarm_irq_enable(struct rtc_device *rtc, unsigned int enabled)
 			rtc_timer_remove(rtc, &rtc->aie_timer);
 	}
 
-	if (err)
+	if (err || !rtc->timerqueue.next)
 		/* nothing */;
 	else if (!rtc->ops)
 		err = -ENODEV;
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 5 lines · On Wed, 06 Feb 2013 20:22:45 +0900 Jonghwa Lee <[email protected]> wrote:

This patch removes repeated execution of disabling alarm in rtc_alarm_irq_enable() of rtc core interface. It made useless call even all alarm had been disabled from rtc_timer_remove(). We'd better to skip disabling alarm when timer queue is empty.

I fear that patch does more than that.

drivers/rtc/interface.c int rtc_alarm_irq_enable(struct rtc_device *rtc, unsigned int enabled) · line 434

Quoted 11 lines
drivers/rtc/interface.c +1 -1
@@ -428,7 +428,7 @@ int rtc_alarm_irq_enable(struct rtc_device *rtc, unsigned int enabled)
 			rtc_timer_remove(rtc, &rtc->aie_timer);
 	}
 
-	if (err)
+	if (err || !rtc->timerqueue.next)
 		/* nothing */;
 	else if (!rtc->ops)
 		err = -ENODEV;

This will prevent the irq from being *enabled*, as well as disabled.

To match your description, we'd need to also check that enabled==0?