aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/interface.c
diff options
context:
space:
mode:
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>2009-06-18 19:49:09 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-19 19:46:05 -0400
commite6229bec25be4ba00f31dd26e25721cc96c22262 (patch)
treea27e4c51dd8b9aaeb589a147a22bbd06bde77cf0 /drivers/rtc/interface.c
parent575c5807f6842422e9fe2432fd48dfcc1d7aef41 (diff)
rtc: make rtc_update_irq callable with irqs enabled
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. Also update kerneldoc and drivers which do extra work to follow the current interface spec, as suggestted by David Brownell. Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: David Brownell <david-b@pacbell.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc/interface.c')
-rw-r--r--drivers/rtc/interface.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index 4348c4b0d45..4cdb31a362c 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -371,19 +371,21 @@ EXPORT_SYMBOL_GPL(rtc_update_irq_enable);
371 * @rtc: the rtc device 371 * @rtc: the rtc device
372 * @num: how many irqs are being reported (usually one) 372 * @num: how many irqs are being reported (usually one)
373 * @events: mask of RTC_IRQF with one or more of RTC_PF, RTC_AF, RTC_UF 373 * @events: mask of RTC_IRQF with one or more of RTC_PF, RTC_AF, RTC_UF
374 * Context: in_interrupt(), irqs blocked 374 * Context: any
375 */ 375 */
376void rtc_update_irq(struct rtc_device *rtc, 376void rtc_update_irq(struct rtc_device *rtc,
377 unsigned long num, unsigned long events) 377 unsigned long num, unsigned long events)
378{ 378{
379 spin_lock(&rtc->irq_lock); 379 unsigned long flags;
380
381 spin_lock_irqsave(&rtc->irq_lock, flags);
380 rtc->irq_data = (rtc->irq_data + (num << 8)) | events; 382 rtc->irq_data = (rtc->irq_data + (num << 8)) | events;
381 spin_unlock(&rtc->irq_lock); 383 spin_unlock_irqrestore(&rtc->irq_lock, flags);
382 384
383 spin_lock(&rtc->irq_task_lock); 385 spin_lock_irqsave(&rtc->irq_task_lock, flags);
384 if (rtc->irq_task) 386 if (rtc->irq_task)
385 rtc->irq_task->func(rtc->irq_task->private_data); 387 rtc->irq_task->func(rtc->irq_task->private_data);
386 spin_unlock(&rtc->irq_task_lock); 388 spin_unlock_irqrestore(&rtc->irq_task_lock, flags);
387 389
388 wake_up_interruptible(&rtc->irq_queue); 390 wake_up_interruptible(&rtc->irq_queue);
389 kill_fasync(&rtc->async_queue, SIGIO, POLL_IN); 391 kill_fasync(&rtc->async_queue, SIGIO, POLL_IN);