diff options
Diffstat (limited to 'drivers/rtc/rtc-dev.c')
-rw-r--r-- | drivers/rtc/rtc-dev.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c index 856cc1af40df..f118252f3a9f 100644 --- a/drivers/rtc/rtc-dev.c +++ b/drivers/rtc/rtc-dev.c | |||
@@ -13,7 +13,6 @@ | |||
13 | 13 | ||
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/rtc.h> | 15 | #include <linux/rtc.h> |
16 | #include <linux/smp_lock.h> | ||
17 | #include "rtc-core.h" | 16 | #include "rtc-core.h" |
18 | 17 | ||
19 | static dev_t rtc_devt; | 18 | static dev_t rtc_devt; |
@@ -27,11 +26,8 @@ static int rtc_dev_open(struct inode *inode, struct file *file) | |||
27 | struct rtc_device, char_dev); | 26 | struct rtc_device, char_dev); |
28 | const struct rtc_class_ops *ops = rtc->ops; | 27 | const struct rtc_class_ops *ops = rtc->ops; |
29 | 28 | ||
30 | lock_kernel(); | 29 | if (test_and_set_bit_lock(RTC_DEV_BUSY, &rtc->flags)) |
31 | if (test_and_set_bit_lock(RTC_DEV_BUSY, &rtc->flags)) { | 30 | return -EBUSY; |
32 | err = -EBUSY; | ||
33 | goto out; | ||
34 | } | ||
35 | 31 | ||
36 | file->private_data = rtc; | 32 | file->private_data = rtc; |
37 | 33 | ||
@@ -41,13 +37,11 @@ static int rtc_dev_open(struct inode *inode, struct file *file) | |||
41 | rtc->irq_data = 0; | 37 | rtc->irq_data = 0; |
42 | spin_unlock_irq(&rtc->irq_lock); | 38 | spin_unlock_irq(&rtc->irq_lock); |
43 | 39 | ||
44 | goto out; | 40 | return 0; |
45 | } | 41 | } |
46 | 42 | ||
47 | /* something has gone wrong */ | 43 | /* something has gone wrong */ |
48 | clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags); | 44 | clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags); |
49 | out: | ||
50 | unlock_kernel(); | ||
51 | return err; | 45 | return err; |
52 | } | 46 | } |
53 | 47 | ||
@@ -409,11 +403,14 @@ static long rtc_dev_ioctl(struct file *file, | |||
409 | 403 | ||
410 | #ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL | 404 | #ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL |
411 | case RTC_UIE_OFF: | 405 | case RTC_UIE_OFF: |
406 | mutex_unlock(&rtc->ops_lock); | ||
412 | clear_uie(rtc); | 407 | clear_uie(rtc); |
413 | break; | 408 | return 0; |
414 | 409 | ||
415 | case RTC_UIE_ON: | 410 | case RTC_UIE_ON: |
411 | mutex_unlock(&rtc->ops_lock); | ||
416 | err = set_uie(rtc); | 412 | err = set_uie(rtc); |
413 | return err; | ||
417 | #endif | 414 | #endif |
418 | default: | 415 | default: |
419 | err = -ENOTTY; | 416 | err = -ENOTTY; |