summaryrefslogtreecommitdiffstats
path: root/drivers/char/ppdev.c
diff options
context:
space:
mode:
authorBamvor Jian Zhang <bamvor.zhangjian@linaro.org>2016-01-08 15:50:49 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-02-08 15:00:04 -0800
commit17a3596f2122b4d88dc0efe297aa2de7be1bb31c (patch)
tree645a7bf84204783fed3c760c1cb85482211fa08b /drivers/char/ppdev.c
parent3b9ab374a1e6d3cd6d16231ec6fe11fe2c49a72a (diff)
downloadlinux-17a3596f2122b4d88dc0efe297aa2de7be1bb31c.tar.bz2
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: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Tested-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/char/ppdev.c')
-rw-r--r--drivers/char/ppdev.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c
index c03d998731ea..9e98d0153148 100644
--- a/drivers/char/ppdev.c
+++ b/drivers/char/ppdev.c
@@ -69,6 +69,7 @@
#include <linux/ppdev.h>
#include <linux/mutex.h>
#include <linux/uaccess.h>
+#include <linux/compat.h>
#define PP_VERSION "ppdev: user-space parallel port driver"
#define CHRDEV "ppdev"
@@ -670,6 +671,14 @@ static long pp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
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)
{
unsigned int minor = iminor(inode);
@@ -779,6 +788,9 @@ static const struct file_operations pp_fops = {
.write = pp_write,
.poll = pp_poll,
.unlocked_ioctl = pp_ioctl,
+#ifdef CONFIG_COMPAT
+ .compat_ioctl = pp_compat_ioctl,
+#endif
.open = pp_open,
.release = pp_release,
};