Skip to content

Commit

Permalink
sh: cdev lock_kernel() pushdown
Browse files Browse the repository at this point in the history
Push the cdev lock_kernel() call down into the sh gio driver.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
  • Loading branch information
Jonathan Corbet committed May 18, 2008
1 parent 7558da9 commit 1fa984b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions arch/sh/boards/landisk/gio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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)
Expand Down

0 comments on commit 1fa984b

Please sign in to comment.