aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-dev.c
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2006-11-25 14:09:28 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-11-25 16:28:33 -0500
commitd728b1e69fd5829ec2ab2434381e5a268d4f684a (patch)
treee11b3dea35247074628f04f5441e4a458bdbd86b /drivers/rtc/rtc-dev.c
parent2601a46474db2dcbc08ee690e56f08a10abe65cb (diff)
[PATCH] rtc class locking bugfixes
I got a lockdep warning when running "rtctest" so I though it'd be good to see what was up. - The warning was for rtc->irq_task_lock, gotten from rtc_update_irq() by irq handlerss ... but in a handful of other cases, grabbed without blocking IRQs. - Some callers to rtc_update_irq() were not ensuring IRQs were blocked, yet the routine expects that; make sure all callers block IRQs. It would appear that RTC API tests haven't been part of anyone's kernel regression test suite recently, at least not with lockdep running. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Acked-by: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/rtc/rtc-dev.c')
-rw-r--r--drivers/rtc/rtc-dev.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c
index 3109865e8d73..814b9e1873f5 100644
--- a/drivers/rtc/rtc-dev.c
+++ b/drivers/rtc/rtc-dev.c
@@ -61,7 +61,9 @@ static void rtc_uie_task(void *data)
61 int err; 61 int err;
62 62
63 err = rtc_read_time(&rtc->class_dev, &tm); 63 err = rtc_read_time(&rtc->class_dev, &tm);
64 spin_lock_irq(&rtc->irq_lock); 64
65 local_irq_disable();
66 spin_lock(&rtc->irq_lock);
65 if (rtc->stop_uie_polling || err) { 67 if (rtc->stop_uie_polling || err) {
66 rtc->uie_task_active = 0; 68 rtc->uie_task_active = 0;
67 } else if (rtc->oldsecs != tm.tm_sec) { 69 } else if (rtc->oldsecs != tm.tm_sec) {
@@ -74,11 +76,11 @@ static void rtc_uie_task(void *data)
74 } else if (schedule_work(&rtc->uie_task) == 0) { 76 } else if (schedule_work(&rtc->uie_task) == 0) {
75 rtc->uie_task_active = 0; 77 rtc->uie_task_active = 0;
76 } 78 }
77 spin_unlock_irq(&rtc->irq_lock); 79 spin_unlock(&rtc->irq_lock);
78 if (num) 80 if (num)
79 rtc_update_irq(&rtc->class_dev, num, RTC_UF | RTC_IRQF); 81 rtc_update_irq(&rtc->class_dev, num, RTC_UF | RTC_IRQF);
82 local_irq_enable();
80} 83}
81
82static void rtc_uie_timer(unsigned long data) 84static void rtc_uie_timer(unsigned long data)
83{ 85{
84 struct rtc_device *rtc = (struct rtc_device *)data; 86 struct rtc_device *rtc = (struct rtc_device *)data;
@@ -238,10 +240,10 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file,
238 240
239 /* avoid conflicting IRQ users */ 241 /* avoid conflicting IRQ users */
240 if (cmd == RTC_PIE_ON || cmd == RTC_PIE_OFF || cmd == RTC_IRQP_SET) { 242 if (cmd == RTC_PIE_ON || cmd == RTC_PIE_OFF || cmd == RTC_IRQP_SET) {
241 spin_lock(&rtc->irq_task_lock); 243 spin_lock_irq(&rtc->irq_task_lock);
242 if (rtc->irq_task) 244 if (rtc->irq_task)
243 err = -EBUSY; 245 err = -EBUSY;
244 spin_unlock(&rtc->irq_task_lock); 246 spin_unlock_irq(&rtc->irq_task_lock);
245 247
246 if (err < 0) 248 if (err < 0)
247 return err; 249 return err;