mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] rtc: core: Prevent repeated calling of alarm_irq_enable().
@ 2013-02-06 11:22 Jonghwa Lee
  2013-02-06 21:12 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Jonghwa Lee @ 2013-02-06 11:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: a.zummo, Andrew Morton, rtc-linux, Jonghwa Lee

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.

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
---
 drivers/rtc/interface.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index 9592b93..11cfb76 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -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;
-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] rtc: core: Prevent repeated calling of alarm_irq_enable().
  2013-02-06 11:22 [PATCH] rtc: core: Prevent repeated calling of alarm_irq_enable() Jonghwa Lee
@ 2013-02-06 21:12 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2013-02-06 21:12 UTC (permalink / raw)
  To: Jonghwa Lee; +Cc: linux-kernel, a.zummo, rtc-linux

On Wed, 06 Feb 2013 20:22:45 +0900
Jonghwa Lee <jonghwa3.lee@samsung.com> 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.

> --- a/drivers/rtc/interface.c
> +++ b/drivers/rtc/interface.c
> @@ -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?

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-06 21:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-06 11:22 [PATCH] rtc: core: Prevent repeated calling of alarm_irq_enable() Jonghwa Lee
2013-02-06 21:12 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome