Commit 52a94909 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Paul Mundt

sh: Remove BKL from landisk gio.

The open function got the BKL via the big push down. Replace it by
preempt_enable/disable as this is sufficient for an UP machine.

The ioctl can be unlocked because there is no functionality which
requires serialization. The usage by multiple callers is broken with
and without the BKL due to the local static variable addr.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent 5fb80ae8
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
*/ */
#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>
...@@ -35,7 +34,7 @@ static int gio_open(struct inode *inode, struct file *filp) ...@@ -35,7 +34,7 @@ static int gio_open(struct inode *inode, struct file *filp)
int minor; int minor;
int ret = -ENOENT; int ret = -ENOENT;
lock_kernel(); preempt_disable();
minor = MINOR(inode->i_rdev); minor = MINOR(inode->i_rdev);
if (minor < DEVCOUNT) { if (minor < DEVCOUNT) {
if (openCnt > 0) { if (openCnt > 0) {
...@@ -45,7 +44,7 @@ static int gio_open(struct inode *inode, struct file *filp) ...@@ -45,7 +44,7 @@ static int gio_open(struct inode *inode, struct file *filp)
ret = 0; ret = 0;
} }
} }
unlock_kernel(); preempt_enable();
return ret; return ret;
} }
...@@ -60,8 +59,7 @@ static int gio_close(struct inode *inode, struct file *filp) ...@@ -60,8 +59,7 @@ static int gio_close(struct inode *inode, struct file *filp)
return 0; return 0;
} }
static int gio_ioctl(struct inode *inode, struct file *filp, static long gio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{ {
unsigned int data; unsigned int data;
static unsigned int addr = 0; static unsigned int addr = 0;
...@@ -129,7 +127,7 @@ static const struct file_operations gio_fops = { ...@@ -129,7 +127,7 @@ static const struct file_operations gio_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = gio_open, /* open */ .open = gio_open, /* open */
.release = gio_close, /* release */ .release = gio_close, /* release */
.ioctl = gio_ioctl, /* ioctl */ .unlocked_ioctl = gio_ioctl,
}; };
static int __init gio_init(void) static int __init gio_init(void)
......
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