rtc-rtc-m41t80: BKL pushdown
authorArnd Bergmann <arnd@arndb.de>
Tue, 20 May 2008 17:16:39 +0000 (19:16 +0200)
committerJonathan Corbet <corbet@lwn.net>
Wed, 2 Jul 2008 21:06:24 +0000 (15:06 -0600)
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
drivers/rtc/rtc-m41t80.c

index a3e0880..0a19c06 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
+#include <linux/smp_lock.h>
 #include <linux/string.h>
 #include <linux/i2c.h>
 #include <linux/rtc.h>
@@ -655,12 +656,16 @@ static int wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
 static int wdt_open(struct inode *inode, struct file *file)
 {
        if (MINOR(inode->i_rdev) == WATCHDOG_MINOR) {
-               if (test_and_set_bit(0, &wdt_is_open))
+               lock_kernel();
+               if (test_and_set_bit(0, &wdt_is_open)) {
+                       unlock_kernel();
                        return -EBUSY;
+               }
                /*
                 *      Activate
                 */
                wdt_is_open = 1;
+               unlock_kernel();
                return 0;
        }
        return -ENODEV;