Commit 6432e734 authored by John Kacur's avatar John Kacur Committed by Linus Torvalds

sony_pi: Remove the BKL from open and ioctl

The BKL is in this function because of the BKL pushdown (see commit
f8f2c79d)

It is not needed here because the mutex_lock sonypi_device.lock provides
the necessary locking.

sonypi_misc_ioctl can be converted to unlocked ioctls since it relies on
its own locking (the mutex sonypi_device.lock) and not the bkl

Document that llseek is not needed by explictly setting it to no_llseek

LKML-Reference: <alpine.LFD.2.00.0910192019420.3563@localhost.localdomain>
Signed-off-by: default avatarJohn Kacur <jkacur@redhat.com>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a87da408
...@@ -50,7 +50,6 @@ ...@@ -50,7 +50,6 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/kfifo.h> #include <linux/kfifo.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/smp_lock.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/io.h> #include <asm/io.h>
...@@ -905,14 +904,13 @@ static int sonypi_misc_release(struct inode *inode, struct file *file) ...@@ -905,14 +904,13 @@ static int sonypi_misc_release(struct inode *inode, struct file *file)
static int sonypi_misc_open(struct inode *inode, struct file *file) static int sonypi_misc_open(struct inode *inode, struct file *file)
{ {
lock_kernel();
mutex_lock(&sonypi_device.lock); mutex_lock(&sonypi_device.lock);
/* Flush input queue on first open */ /* Flush input queue on first open */
if (!sonypi_device.open_count) if (!sonypi_device.open_count)
kfifo_reset(&sonypi_device.fifo); kfifo_reset(&sonypi_device.fifo);
sonypi_device.open_count++; sonypi_device.open_count++;
mutex_unlock(&sonypi_device.lock); mutex_unlock(&sonypi_device.lock);
unlock_kernel();
return 0; return 0;
} }
...@@ -955,10 +953,10 @@ static unsigned int sonypi_misc_poll(struct file *file, poll_table *wait) ...@@ -955,10 +953,10 @@ static unsigned int sonypi_misc_poll(struct file *file, poll_table *wait)
return 0; return 0;
} }
static int sonypi_misc_ioctl(struct inode *ip, struct file *fp, static long sonypi_misc_ioctl(struct file *fp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
int ret = 0; long ret = 0;
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
u8 val8; u8 val8;
u16 val16; u16 val16;
...@@ -1074,7 +1072,8 @@ static const struct file_operations sonypi_misc_fops = { ...@@ -1074,7 +1072,8 @@ static const struct file_operations sonypi_misc_fops = {
.open = sonypi_misc_open, .open = sonypi_misc_open,
.release = sonypi_misc_release, .release = sonypi_misc_release,
.fasync = sonypi_misc_fasync, .fasync = sonypi_misc_fasync,
.ioctl = sonypi_misc_ioctl, .unlocked_ioctl = sonypi_misc_ioctl,
.llseek = no_llseek,
}; };
static struct miscdevice sonypi_misc_device = { static struct miscdevice sonypi_misc_device = {
......
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