aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-07-14 17:48:31 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-14 17:48:31 -0400
commitd1794f2c5b5817eb79ccc5e00701ca748d1b073a (patch)
tree5a4c98e694e88a8c82f342d0cc9edb2a4cbbef36 /drivers/rtc
parenta41eebab7537890409ea9dfe0fcda9b5fbdb090d (diff)
parent2fceef397f9880b212a74c418290ce69e7ac00eb (diff)
Merge branch 'bkl-removal' of git://git.lwn.net/linux-2.6
* 'bkl-removal' of git://git.lwn.net/linux-2.6: (146 commits) IB/umad: BKL is not needed for ib_umad_open() IB/uverbs: BKL is not needed for ib_uverbs_open() bf561-coreb: BKL unneeded for open() Call fasync() functions without the BKL snd/PCM: fasync BKL pushdown ipmi: fasync BKL pushdown ecryptfs: fasync BKL pushdown Bluetooth VHCI: fasync BKL pushdown tty_io: fasync BKL pushdown tun: fasync BKL pushdown i2o: fasync BKL pushdown mpt: fasync BKL pushdown Remove BKL from remote_llseek v2 Make FAT users happier by not deadlocking x86-mce: BKL pushdown vmwatchdog: BKL pushdown vmcp: BKL pushdown via-pmu: BKL pushdown uml-random: BKL pushdown uml-mmapper: BKL pushdown ...
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-dev.c12
-rw-r--r--drivers/rtc/rtc-m41t80.c7
2 files changed, 15 insertions, 4 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 @@
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>
16#include "rtc-core.h" 17#include "rtc-core.h"
17 18
18static dev_t rtc_devt; 19static dev_t rtc_devt;
@@ -26,8 +27,11 @@ static int rtc_dev_open(struct inode *inode, struct file *file)
26 struct rtc_device, char_dev); 27 struct rtc_device, char_dev);
27 const struct rtc_class_ops *ops = rtc->ops; 28 const struct rtc_class_ops *ops = rtc->ops;
28 29
29 if (test_and_set_bit_lock(RTC_DEV_BUSY, &rtc->flags)) 30 lock_kernel();
30 return -EBUSY; 31 if (test_and_set_bit_lock(RTC_DEV_BUSY, &rtc->flags)) {
32 err = -EBUSY;
33 goto out;
34 }
31 35
32 file->private_data = rtc; 36 file->private_data = rtc;
33 37
@@ -37,11 +41,13 @@ static int rtc_dev_open(struct inode *inode, struct file *file)
37 rtc->irq_data = 0; 41 rtc->irq_data = 0;
38 spin_unlock_irq(&rtc->irq_lock); 42 spin_unlock_irq(&rtc->irq_lock);
39 43
40 return 0; 44 goto out;
41 } 45 }
42 46
43 /* something has gone wrong */ 47 /* something has gone wrong */
44 clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags); 48 clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags);
49out:
50 unlock_kernel();
45 return err; 51 return err;
46} 52}
47 53
diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c
index a3e0880b38fb..0a19c06019be 100644
--- a/drivers/rtc/rtc-m41t80.c
+++ b/drivers/rtc/rtc-m41t80.c
@@ -17,6 +17,7 @@
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/smp_lock.h>
20#include <linux/string.h> 21#include <linux/string.h>
21#include <linux/i2c.h> 22#include <linux/i2c.h>
22#include <linux/rtc.h> 23#include <linux/rtc.h>
@@ -655,12 +656,16 @@ static int wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
655static int wdt_open(struct inode *inode, struct file *file) 656static int wdt_open(struct inode *inode, struct file *file)
656{ 657{
657 if (MINOR(inode->i_rdev) == WATCHDOG_MINOR) { 658 if (MINOR(inode->i_rdev) == WATCHDOG_MINOR) {
658 if (test_and_set_bit(0, &wdt_is_open)) 659 lock_kernel();
660 if (test_and_set_bit(0, &wdt_is_open)) {
661 unlock_kernel();
659 return -EBUSY; 662 return -EBUSY;
663 }
660 /* 664 /*
661 * Activate 665 * Activate
662 */ 666 */
663 wdt_is_open = 1; 667 wdt_is_open = 1;
668 unlock_kernel();
664 return 0; 669 return 0;
665 } 670 }
666 return -ENODEV; 671 return -ENODEV;