summaryrefslogtreecommitdiffstats
path: root/drivers/rtc/interface.c
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2007-12-04 23:45:05 -0800
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-12-05 09:21:18 -0800
commit372a302e9a892229206aafca0352584a745bc5f3 (patch)
tree14cf4e06735d8dd9284e843f36a5abcfcc4cc476 /drivers/rtc/interface.c
parent5cd17569fd0eeca510735e63a6061291e3971bf6 (diff)
downloadblackbird-obmc-linux-372a302e9a892229206aafca0352584a745bc5f3.tar.gz
blackbird-obmc-linux-372a302e9a892229206aafca0352584a745bc5f3.zip
RTC: assure proper memory ordering with respect to RTC_DEV_BUSY flag
We must make sure that the RTC_DEV_BUSY flag has proper lock semantics, i.e. that the RTC_DEV_BUSY stores clearing the flag don't get reordered before the preceeding stores and loads and vice versa. Spotted by Nick Piggin. Signed-off-by: Jiri Kosina <jkosina@suse.cz> Cc: Nick Piggin <nickpiggin@yahoo.com.au> Cc: David Brownell <david-b@pacbell.net> Acked-by: Alessandro Zummo <a.zummo@towertech.it> 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.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index a4f56e95cf96..f1e00ff54ce8 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -293,7 +293,7 @@ int rtc_irq_register(struct rtc_device *rtc, struct rtc_task *task)
return -EINVAL;
/* Cannot register while the char dev is in use */
- if (test_and_set_bit(RTC_DEV_BUSY, &rtc->flags))
+ if (test_and_set_bit_lock(RTC_DEV_BUSY, &rtc->flags))
return -EBUSY;
spin_lock_irq(&rtc->irq_task_lock);
@@ -303,7 +303,7 @@ int rtc_irq_register(struct rtc_device *rtc, struct rtc_task *task)
}
spin_unlock_irq(&rtc->irq_task_lock);
- clear_bit(RTC_DEV_BUSY, &rtc->flags);
+ clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags);
return retval;
}
OpenPOWER on IntegriCloud