Re: [PATCH] nwflash: Push down BKL

Previous thread: [PATCH] DAC960: Push down BKL by Alan Cox on Thursday, May 22, 2008 - 5:14 pm. (1 message)

Next thread: [PATCH] cm4000_cs: Switch to unlocked_ioctl by Alan Cox on Thursday, May 22, 2008 - 5:17 pm. (1 message)
To: <linux-kernel@...>, <rmk@...>
Date: Thursday, May 22, 2008 - 5:16 pm

Push the BKL down into the driver ready for the BKL ioctl removal

Signed-off-by: Alan Cox <alan@redhat.com>

diff --git a/drivers/char/nwflash.c b/drivers/char/nwflash.c
index ba012c2..02d882b 100644
--- a/drivers/char/nwflash.c
+++ b/drivers/char/nwflash.c
@@ -95,8 +95,11 @@ static int get_flash_id(void)
return c2;
}

-static int flash_ioctl(struct inode *inodep, struct file *filep, unsigned int cmd, unsigned long arg)
+static long flash_ioctl(struct file *filep, unsigned int cmd,
+ unsigned long arg)
{
+ long ret = 0;
+ lock_kernel();
switch (cmd) {
case CMD_WRITE_DISABLE:
gbWriteBase64Enable = 0;
@@ -114,9 +117,10 @@ static int flash_ioctl(struct inode *inodep, struct file *filep, unsigned int cm
default:
gbWriteBase64Enable = 0;
gbWriteEnable = 0;
- return -EINVAL;
+ ret = -ENOTTY;
}
- return 0;
+ unlock_kernel();
+ return ret;
}

static ssize_t flash_read(struct file *file, char __user *buf, size_t size,
@@ -647,7 +651,7 @@ static const struct file_operations flash_fops =
.llseek = flash_llseek,
.read = flash_read,
.write = flash_write,
- .ioctl = flash_ioctl,
+ .unlocked_ioctl = flash_ioctl,
};

static struct miscdevice flash_miscdev =
--

To: Alan Cox <alan@...>
Cc: <linux-kernel@...>
Date: Tuesday, July 8, 2008 - 4:10 pm

I'm nervous about large changes to this driver, since it's possible to

Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of:
--

Previous thread: [PATCH] DAC960: Push down BKL by Alan Cox on Thursday, May 22, 2008 - 5:14 pm. (1 message)

Next thread: [PATCH] cm4000_cs: Switch to unlocked_ioctl by Alan Cox on Thursday, May 22, 2008 - 5:17 pm. (1 message)