Commit 1fa984b5 authored by Jonathan Corbet's avatar Jonathan Corbet

sh: cdev lock_kernel() pushdown

Push the cdev lock_kernel() call down into the sh gio driver.
Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent 7558da94
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/smp_lock.h>
#include <linux/kdev_t.h> #include <linux/kdev_t.h>
#include <linux/cdev.h> #include <linux/cdev.h>
#include <linux/fs.h> #include <linux/fs.h>
...@@ -32,17 +33,20 @@ static int openCnt; ...@@ -32,17 +33,20 @@ static int openCnt;
static int gio_open(struct inode *inode, struct file *filp) static int gio_open(struct inode *inode, struct file *filp)
{ {
int minor; int minor;
int ret = -ENOENT;
lock_kernel();
minor = MINOR(inode->i_rdev); minor = MINOR(inode->i_rdev);
if (minor < DEVCOUNT) { if (minor < DEVCOUNT) {
if (openCnt > 0) { if (openCnt > 0) {
return -EALREADY; ret = -EALREADY;
} else { } else {
openCnt++; openCnt++;
return 0; ret = 0;
} }
} }
return -ENOENT; unlock_kernel();
return ret;
} }
static int gio_close(struct inode *inode, struct file *filp) static int gio_close(struct inode *inode, struct file *filp)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment