Merge branch 'timers/for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[cascardo/linux.git] / drivers / sbus / char / flash.c
index 262f01e..7d95e15 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/init.h>
 #include <linux/smp_lock.h>
 #include <linux/spinlock.h>
+#include <linux/mm.h>
 
 #include <asm/system.h>
 #include <asm/uaccess.h>
@@ -126,9 +127,13 @@ flash_read(struct file * file, char __user * buf,
 static int
 flash_open(struct inode *inode, struct file *file)
 {
-       if (test_and_set_bit(0, (void *)&flash.busy) != 0)
+       lock_kernel();
+       if (test_and_set_bit(0, (void *)&flash.busy) != 0) {
+               unlock_kernel();
                return -EBUSY;
+       }
 
+       unlock_kernel();
        return 0;
 }