Browse Source

sh: cdev lock_kernel() pushdown

Push the cdev lock_kernel() call down into the sh gio driver.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Jonathan Corbet 17 years ago
parent
commit
1fa984b583
1 changed files with 7 additions and 3 deletions
  1. 7 3
      arch/sh/boards/landisk/gio.c

+ 7 - 3
arch/sh/boards/landisk/gio.c

@@ -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)