提交 6d535d3e 编写于 作者: A Alan Cox 提交者: Linus Torvalds

ppdev: wrap ioctl handler in driver and push lock down

Signed-off-by: NAlan Cox <alan@redhat.com>
Cc: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 e05e9f7c
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
#include <linux/major.h> #include <linux/major.h>
#include <linux/ppdev.h> #include <linux/ppdev.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <asm/uaccess.h> #include <linux/uaccess.h>
#define PP_VERSION "ppdev: user-space parallel port driver" #define PP_VERSION "ppdev: user-space parallel port driver"
#define CHRDEV "ppdev" #define CHRDEV "ppdev"
...@@ -328,10 +328,9 @@ static enum ieee1284_phase init_phase (int mode) ...@@ -328,10 +328,9 @@ static enum ieee1284_phase init_phase (int mode)
return IEEE1284_PH_FWD_IDLE; return IEEE1284_PH_FWD_IDLE;
} }
static int pp_ioctl(struct inode *inode, struct file *file, static int pp_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{ {
unsigned int minor = iminor(inode); unsigned int minor = iminor(file->f_path.dentry->d_inode);
struct pp_struct *pp = file->private_data; struct pp_struct *pp = file->private_data;
struct parport * port; struct parport * port;
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
...@@ -634,6 +633,15 @@ static int pp_ioctl(struct inode *inode, struct file *file, ...@@ -634,6 +633,15 @@ static int pp_ioctl(struct inode *inode, struct file *file,
return 0; return 0;
} }
static long pp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
long ret;
lock_kernel();
ret = pp_do_ioctl(file, cmd, arg);
unlock_kernel();
return ret;
}
static int pp_open (struct inode * inode, struct file * file) static int pp_open (struct inode * inode, struct file * file)
{ {
unsigned int minor = iminor(inode); unsigned int minor = iminor(inode);
...@@ -745,7 +753,7 @@ static const struct file_operations pp_fops = { ...@@ -745,7 +753,7 @@ static const struct file_operations pp_fops = {
.read = pp_read, .read = pp_read,
.write = pp_write, .write = pp_write,
.poll = pp_poll, .poll = pp_poll,
.ioctl = pp_ioctl, .unlocked_ioctl = pp_ioctl,
.open = pp_open, .open = pp_open,
.release = pp_release, .release = pp_release,
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册