sh: cdev lock_kernel() pushdown
authorJonathan Corbet <corbet@lwn.net>
Thu, 15 May 2008 15:11:26 +0000 (09:11 -0600)
committerJonathan Corbet <corbet@lwn.net>
Sun, 18 May 2008 21:43:40 +0000 (15:43 -0600)
Push the cdev lock_kernel() call down into the sh gio driver.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
arch/sh/boards/landisk/gio.c

index 1702508..0c15b0a 100644 (file)
@@ -14,6 +14,7 @@
  */
 #include <linux/module.h>
 #include <linux/init.h>
+#include <linux/smp_lock.h>
 #include <linux/kdev_t.h>
 #include <linux/cdev.h>
 #include <linux/fs.h>
@@ -32,17 +33,20 @@ static int openCnt;
 static int gio_open(struct inode *inode, struct file *filp)
 {
        int minor;
+       int ret = -ENOENT;
 
+       lock_kernel();
        minor = MINOR(inode->i_rdev);
        if (minor < DEVCOUNT) {
                if (openCnt > 0) {
-                       return -EALREADY;
+                       ret = -EALREADY;
                } else {
                        openCnt++;
-                       return 0;
+                       ret = 0;
                }
        }
-       return -ENOENT;
+       unlock_kernel();
+       return ret;
 }
 
 static int gio_close(struct inode *inode, struct file *filp)