diff options
Diffstat (limited to 'drivers/rtc/rtc-m41t80.c')
-rw-r--r-- | drivers/rtc/rtc-m41t80.c | 7 |
1 files changed, 6 insertions, 1 deletions
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, | |||
655 | static int wdt_open(struct inode *inode, struct file *file) | 656 | static 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; |