diff options
author | Alan Cox <alan@lxorguk.ukuu.org.uk> | 2008-07-25 04:48:16 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-25 13:53:43 -0400 |
commit | 6d535d3e6ad395345750c361bd2b7f1b9429455d (patch) | |
tree | c00178880958f2d81a1e57c5372e5cdfb828e60c | |
parent | e05e9f7c4aeb82eaa23e46b29580ff514590c641 (diff) |
ppdev: wrap ioctl handler in driver and push lock down
Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/char/ppdev.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c index 7af7a7e6b9c2..bee39fdfba73 100644 --- a/drivers/char/ppdev.c +++ b/drivers/char/ppdev.c | |||
@@ -67,7 +67,7 @@ | |||
67 | #include <linux/major.h> | 67 | #include <linux/major.h> |
68 | #include <linux/ppdev.h> | 68 | #include <linux/ppdev.h> |
69 | #include <linux/smp_lock.h> | 69 | #include <linux/smp_lock.h> |
70 | #include <asm/uaccess.h> | 70 | #include <linux/uaccess.h> |
71 | 71 | ||
72 | #define PP_VERSION "ppdev: user-space parallel port driver" | 72 | #define PP_VERSION "ppdev: user-space parallel port driver" |
73 | #define CHRDEV "ppdev" | 73 | #define CHRDEV "ppdev" |
@@ -328,10 +328,9 @@ static enum ieee1284_phase init_phase (int mode) | |||
328 | return IEEE1284_PH_FWD_IDLE; | 328 | return IEEE1284_PH_FWD_IDLE; |
329 | } | 329 | } |
330 | 330 | ||
331 | static int pp_ioctl(struct inode *inode, struct file *file, | 331 | static int pp_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
332 | unsigned int cmd, unsigned long arg) | ||
333 | { | 332 | { |
334 | unsigned int minor = iminor(inode); | 333 | unsigned int minor = iminor(file->f_path.dentry->d_inode); |
335 | struct pp_struct *pp = file->private_data; | 334 | struct pp_struct *pp = file->private_data; |
336 | struct parport * port; | 335 | struct parport * port; |
337 | void __user *argp = (void __user *)arg; | 336 | void __user *argp = (void __user *)arg; |
@@ -634,6 +633,15 @@ static int pp_ioctl(struct inode *inode, struct file *file, | |||
634 | return 0; | 633 | return 0; |
635 | } | 634 | } |
636 | 635 | ||
636 | static long pp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | ||
637 | { | ||
638 | long ret; | ||
639 | lock_kernel(); | ||
640 | ret = pp_do_ioctl(file, cmd, arg); | ||
641 | unlock_kernel(); | ||
642 | return ret; | ||
643 | } | ||
644 | |||
637 | static int pp_open (struct inode * inode, struct file * file) | 645 | static int pp_open (struct inode * inode, struct file * file) |
638 | { | 646 | { |
639 | unsigned int minor = iminor(inode); | 647 | unsigned int minor = iminor(inode); |
@@ -745,7 +753,7 @@ static const struct file_operations pp_fops = { | |||
745 | .read = pp_read, | 753 | .read = pp_read, |
746 | .write = pp_write, | 754 | .write = pp_write, |
747 | .poll = pp_poll, | 755 | .poll = pp_poll, |
748 | .ioctl = pp_ioctl, | 756 | .unlocked_ioctl = pp_ioctl, |
749 | .open = pp_open, | 757 | .open = pp_open, |
750 | .release = pp_release, | 758 | .release = pp_release, |
751 | }; | 759 | }; |