linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtc: Make rtc_update_irq callable with irqs enabled
@ 2009-04-06 16:50 Atsushi Nemoto
  2009-04-09 22:39 ` Andrew Morton
  0 siblings, 1 reply; 29+ messages in thread
From: Atsushi Nemoto @ 2009-04-06 16:50 UTC (permalink / raw)
  To: Alessandro Zummo; +Cc: rtc-linux, linux-kernel

The rtc_update_irq() might be called with irqs enabled, if a interrupt
handler was registered without IRQF_DISABLED.
Use spin_lock_irqsave/spin_unlock_irqrestore instead of
spin_lock/spin_unlock.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
 drivers/rtc/interface.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index 4348c4b..a8641f7 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -376,14 +376,16 @@ EXPORT_SYMBOL_GPL(rtc_update_irq_enable);
 void rtc_update_irq(struct rtc_device *rtc,
 		unsigned long num, unsigned long events)
 {
-	spin_lock(&rtc->irq_lock);
+	unsigned long flags;
+
+	spin_lock_irqsave(&rtc->irq_lock, flags);
 	rtc->irq_data = (rtc->irq_data + (num << 8)) | events;
-	spin_unlock(&rtc->irq_lock);
+	spin_unlock_irqrestore(&rtc->irq_lock, flags);
 
-	spin_lock(&rtc->irq_task_lock);
+	spin_lock_irqsave(&rtc->irq_task_lock, flags);
 	if (rtc->irq_task)
 		rtc->irq_task->func(rtc->irq_task->private_data);
-	spin_unlock(&rtc->irq_task_lock);
+	spin_unlock_irqrestore(&rtc->irq_task_lock, flags);
 
 	wake_up_interruptible(&rtc->irq_queue);
 	kill_fasync(&rtc->async_queue, SIGIO, POLL_IN);
-- 
1.5.6.3


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

end of thread, other threads:[~2009-04-28 15:57 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-06 16:50 [PATCH] rtc: Make rtc_update_irq callable with irqs enabled Atsushi Nemoto
2009-04-09 22:39 ` Andrew Morton
2009-04-09 22:58   ` Alessandro Zummo
2009-04-23 14:51     ` Atsushi Nemoto
2009-04-23 15:02       ` Alessandro Zummo
2009-04-23 15:07         ` [rtc-linux] " Mike Frysinger
     [not found]           ` <200904091627.15776.david-b@pacbell.net>
2009-04-23 15:29             ` Atsushi Nemoto
2009-04-23 15:46               ` Alessandro Zummo
2009-04-23 18:15                 ` David Brownell
2009-04-23 18:27                   ` [rtc-linux] " Alessandro Zummo
2009-04-23 19:02                     ` David Brownell
2009-04-23 19:09                       ` Alessandro Zummo
2009-04-23 19:25                         ` David Brownell
2009-04-23 19:26                           ` Alessandro Zummo
2009-04-23 19:45                             ` David Brownell
2009-04-23 19:55                               ` Alessandro Zummo
2009-04-24  9:31                                 ` David Brownell
2009-04-24 10:01                                   ` Alessandro Zummo
2009-04-24 11:10                                     ` David Brownell
2009-04-24 11:13                                       ` Alessandro Zummo
2009-04-24 16:48                                         ` Atsushi Nemoto
2009-04-24 17:06                                           ` Atsushi Nemoto
2009-04-24 19:41                                             ` Alessandro Zummo
2009-04-25 12:40                                               ` Atsushi Nemoto
2009-04-28 13:13                                             ` Hans-Christian Egtvedt
2009-04-28 15:56                                               ` Atsushi Nemoto
2009-04-23 15:37           ` Alessandro Zummo
2009-04-23 16:30             ` Mike Frysinger
2009-04-23 16:40               ` Alessandro Zummo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).