summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2008-05-15 09:38:18 -0600
committerJonathan Corbet <corbet@lwn.net>2008-06-20 14:03:43 -0600
commit51a776fa7a7997e726d4a478eda0854c6f9143bd (patch)
tree4e56020d78b78c36d6bd153cc716dabd65af1eea /drivers
parent0bec0bba7a507bdaf07312fcabdc00b5576abb32 (diff)
rtc: cdev lock_kernel() pushdown
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/rtc/rtc-dev.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c
index 90dfa0df747..0114a78b7cb 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;
}