Commit f80a0ca6 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Linus Torvalds

pktcdvd: improve BKL and compat_ioctl.c usage

The pktcdvd driver uses proper locking and does not need the BKL in the
ioctl and llseek functions of the character device, so kill both.

Moving the compat_ioctl handling from common code into the driver itself
fixes build problems when CONFIG_BLOCK is disabled.
Acked-by: default avatarRandy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a36fed12
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/compat.h>
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
...@@ -2984,7 +2985,7 @@ static void pkt_get_status(struct pkt_ctrl_command *ctrl_cmd) ...@@ -2984,7 +2985,7 @@ static void pkt_get_status(struct pkt_ctrl_command *ctrl_cmd)
mutex_unlock(&ctl_mutex); mutex_unlock(&ctl_mutex);
} }
static int pkt_ctl_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) static long pkt_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ {
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
struct pkt_ctrl_command ctrl_cmd; struct pkt_ctrl_command ctrl_cmd;
...@@ -3021,9 +3022,19 @@ static int pkt_ctl_ioctl(struct inode *inode, struct file *file, unsigned int cm ...@@ -3021,9 +3022,19 @@ static int pkt_ctl_ioctl(struct inode *inode, struct file *file, unsigned int cm
return ret; return ret;
} }
#ifdef CONFIG_COMPAT
static long pkt_ctl_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
return pkt_ctl_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
}
#endif
static const struct file_operations pkt_ctl_fops = { static const struct file_operations pkt_ctl_fops = {
.ioctl = pkt_ctl_ioctl, .open = nonseekable_open,
.unlocked_ioctl = pkt_ctl_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = pkt_ctl_compat_ioctl,
#endif
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
......
...@@ -102,7 +102,6 @@ ...@@ -102,7 +102,6 @@
#include <linux/nbd.h> #include <linux/nbd.h>
#include <linux/random.h> #include <linux/random.h>
#include <linux/filter.h> #include <linux/filter.h>
#include <linux/pktcdvd.h>
#include <linux/hiddev.h> #include <linux/hiddev.h>
...@@ -1126,8 +1125,6 @@ COMPATIBLE_IOCTL(PPGETMODE) ...@@ -1126,8 +1125,6 @@ COMPATIBLE_IOCTL(PPGETMODE)
COMPATIBLE_IOCTL(PPGETPHASE) COMPATIBLE_IOCTL(PPGETPHASE)
COMPATIBLE_IOCTL(PPGETFLAGS) COMPATIBLE_IOCTL(PPGETFLAGS)
COMPATIBLE_IOCTL(PPSETFLAGS) COMPATIBLE_IOCTL(PPSETFLAGS)
/* pktcdvd */
COMPATIBLE_IOCTL(PACKET_CTRL_CMD)
/* Big A */ /* Big A */
/* sparc only */ /* sparc only */
/* Big Q for sound/OSS */ /* Big Q for sound/OSS */
......
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