summaryrefslogtreecommitdiff
path: root/drivers/media/media-devnode.c
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@iki.fi>2013-01-22 19:27:55 +0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-03-19 03:44:36 +0400
commitc6c1d50b51e76b57fbf0651d38a7ae0c3fb9d5cc (patch)
tree448be2161521c9af331e4ea5468528b6a388dcd4 /drivers/media/media-devnode.c
parentcab3e1ffbe1b9c7a607506338f590dc1e6ca9909 (diff)
downloadlinux-c6c1d50b51e76b57fbf0651d38a7ae0c3fb9d5cc.tar.xz
[media] media: Add 64--32 bit compat ioctl handler
Provide an ioctl handler for 32-bit binaries on 64-bit systems. Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/media-devnode.c')
-rw-r--r--drivers/media/media-devnode.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/drivers/media/media-devnode.c b/drivers/media/media-devnode.c
index 023b2a1cbb9b..fb0f0469fad7 100644
--- a/drivers/media/media-devnode.c
+++ b/drivers/media/media-devnode.c
@@ -116,19 +116,41 @@ static unsigned int media_poll(struct file *filp,
return mdev->fops->poll(filp, poll);
}
-static long media_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
+static long
+__media_ioctl(struct file *filp, unsigned int cmd, unsigned long arg,
+ long (*ioctl_func)(struct file *filp, unsigned int cmd,
+ unsigned long arg))
{
struct media_devnode *mdev = media_devnode_data(filp);
- if (!mdev->fops->ioctl)
+ if (!ioctl_func)
return -ENOTTY;
if (!media_devnode_is_registered(mdev))
return -EIO;
- return mdev->fops->ioctl(filp, cmd, arg);
+ return ioctl_func(filp, cmd, arg);
+}
+
+static long media_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
+{
+ struct media_devnode *mdev = media_devnode_data(filp);
+
+ return __media_ioctl(filp, cmd, arg, mdev->fops->ioctl);
}
+#ifdef CONFIG_COMPAT
+
+static long media_compat_ioctl(struct file *filp, unsigned int cmd,
+ unsigned long arg)
+{
+ struct media_devnode *mdev = media_devnode_data(filp);
+
+ return __media_ioctl(filp, cmd, arg, mdev->fops->compat_ioctl);
+}
+
+#endif /* CONFIG_COMPAT */
+
/* Override for the open function */
static int media_open(struct inode *inode, struct file *filp)
{
@@ -188,6 +210,9 @@ static const struct file_operations media_devnode_fops = {
.write = media_write,
.open = media_open,
.unlocked_ioctl = media_ioctl,
+#ifdef CONFIG_COMPAT
+ .compat_ioctl = media_compat_ioctl,
+#endif /* CONFIG_COMPAT */
.release = media_release,
.poll = media_poll,
.llseek = no_llseek,