]> err.no Git - linux-2.6/blobdiff - drivers/rtc/rtc-m41t80.c
Merge branch 'for-linus' of git://www.jni.nu/cris
[linux-2.6] / drivers / rtc / rtc-m41t80.c
index 316bfaa80872195badfeda9ec87de81265d77d96..0a19c06019be6c32ea71ccc3849cd7d108040385 100644 (file)
@@ -15,7 +15,9 @@
 
 #include <linux/module.h>
 #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>
@@ -654,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;
@@ -803,6 +809,7 @@ static int m41t80_probe(struct i2c_client *client,
 
 #ifdef CONFIG_RTC_DRV_M41T80_WDT
        if (clientdata->features & M41T80_FEATURE_HT) {
+               save_client = client;
                rc = misc_register(&wdt_dev);
                if (rc)
                        goto exit;
@@ -811,7 +818,6 @@ static int m41t80_probe(struct i2c_client *client,
                        misc_deregister(&wdt_dev);
                        goto exit;
                }
-               save_client = client;
        }
 #endif
        return 0;