Commit 17a3596f authored by Bamvor Jian Zhang's avatar Bamvor Jian Zhang Committed by Greg Kroah-Hartman

ppdev: add support for compat ioctl

The arg of ioctl in ppdev is the pointer of integer except the
timeval in PPSETTIME, PPGETTIME. Different size of timeval
is already supported by the previous patches. So, it is safe
to add compat support.
Signed-off-by: default avatarBamvor Jian Zhang <bamvor.zhangjian@linaro.org>
Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
Tested-by: default avatarSudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3b9ab374
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
#include <linux/ppdev.h> #include <linux/ppdev.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/compat.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"
...@@ -670,6 +671,14 @@ static long pp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -670,6 +671,14 @@ static long pp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
return ret; return ret;
} }
#ifdef CONFIG_COMPAT
static long pp_compat_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{
return pp_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
}
#endif
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);
...@@ -779,6 +788,9 @@ static const struct file_operations pp_fops = { ...@@ -779,6 +788,9 @@ static const struct file_operations pp_fops = {
.write = pp_write, .write = pp_write,
.poll = pp_poll, .poll = pp_poll,
.unlocked_ioctl = pp_ioctl, .unlocked_ioctl = pp_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = pp_compat_ioctl,
#endif
.open = pp_open, .open = pp_open,
.release = pp_release, .release = pp_release,
}; };
......
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