diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-07-18 19:53:16 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-18 19:53:16 +0200 |
commit | 9b610fda0df5d0f0b0c64242e37441ad1b384aac (patch) | |
tree | 0ea14b15f2e6546f37fe18d8ac3dc83077ec0e55 /drivers/rtc/rtc-dev.c | |
parent | b8f8c3cf0a4ac0632ec3f0e15e9dc0c29de917af (diff) | |
parent | 5b664cb235e97afbf34db9c4d77f08ebd725335e (diff) | |
download | linux-stable-9b610fda0df5d0f0b0c64242e37441ad1b384aac.tar.gz linux-stable-9b610fda0df5d0f0b0c64242e37441ad1b384aac.tar.bz2 linux-stable-9b610fda0df5d0f0b0c64242e37441ad1b384aac.zip |
Merge branch 'linus' into timers/nohz
Diffstat (limited to 'drivers/rtc/rtc-dev.c')
-rw-r--r-- | drivers/rtc/rtc-dev.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c index 90dfa0df747a..0114a78b7cbb 100644 --- a/drivers/rtc/rtc-dev.c +++ b/drivers/rtc/rtc-dev.c @@ -13,6 +13,7 @@ #include <linux/module.h> #include <linux/rtc.h> +#include <linux/smp_lock.h> #include "rtc-core.h" static dev_t rtc_devt; @@ -26,8 +27,11 @@ static int rtc_dev_open(struct inode *inode, struct file *file) struct rtc_device, char_dev); const struct rtc_class_ops *ops = rtc->ops; - if (test_and_set_bit_lock(RTC_DEV_BUSY, &rtc->flags)) - return -EBUSY; + lock_kernel(); + if (test_and_set_bit_lock(RTC_DEV_BUSY, &rtc->flags)) { + err = -EBUSY; + goto out; + } file->private_data = rtc; @@ -37,11 +41,13 @@ static int rtc_dev_open(struct inode *inode, struct file *file) rtc->irq_data = 0; spin_unlock_irq(&rtc->irq_lock); - return 0; + goto out; } /* something has gone wrong */ clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags); +out: + unlock_kernel(); return err; } |