summaryrefslogtreecommitdiff
path: root/drivers/media/video/v4l2-compat-ioctl32.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-12-18 20:41:19 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-03-19 14:06:12 -0300
commitb9d0aa6e211039548f1480a5838398d517f1c3a9 (patch)
tree2e1a6bab9e8d9c393c6a2af528bbe0bc0a91e215 /drivers/media/video/v4l2-compat-ioctl32.c
parentf769c26085ee0945fba3ba0ea48781770a8c81e2 (diff)
[media] v4l: Add custom compat_ioctl32 operation
Drivers implementing custom ioctls need to handle 32-bit/64-bit compatibility themselves. Provide them with a way to do so. To avoid circular module dependencies, merge the v4l2-compat-ioctl32 module into videodev. There is no point in keeping them separate, as the v4l2_compat_ioctl32() function is required by videodev if CONFIG_COMPAT is set anyway. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/v4l2-compat-ioctl32.c')
-rw-r--r--drivers/media/video/v4l2-compat-ioctl32.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/media/video/v4l2-compat-ioctl32.c b/drivers/media/video/v4l2-compat-ioctl32.c
index e6f67aa5b4c0..2829d256e4b7 100644
--- a/drivers/media/video/v4l2-compat-ioctl32.c
+++ b/drivers/media/video/v4l2-compat-ioctl32.c
@@ -14,12 +14,11 @@
*/
#include <linux/compat.h>
-#include <linux/videodev2.h>
#include <linux/module.h>
+#include <linux/videodev2.h>
+#include <media/v4l2-dev.h>
#include <media/v4l2-ioctl.h>
-#ifdef CONFIG_COMPAT
-
static long native_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
long ret = -ENOIOCTLCMD;
@@ -937,6 +936,7 @@ static long do_video_ioctl(struct file *file, unsigned int cmd, unsigned long ar
long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
{
+ struct video_device *vdev = video_devdata(file);
long ret = -ENOIOCTLCMD;
if (!file->f_op->unlocked_ioctl)
@@ -1027,14 +1027,16 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
break;
default:
- printk(KERN_WARNING "compat_ioctl32: "
- "unknown ioctl '%c', dir=%d, #%d (0x%08x)\n",
- _IOC_TYPE(cmd), _IOC_DIR(cmd), _IOC_NR(cmd), cmd);
+ if (vdev->fops->compat_ioctl32)
+ ret = vdev->fops->compat_ioctl32(file, cmd, arg);
+
+ if (ret == -ENOIOCTLCMD)
+ printk(KERN_WARNING "compat_ioctl32: "
+ "unknown ioctl '%c', dir=%d, #%d (0x%08x)\n",
+ _IOC_TYPE(cmd), _IOC_DIR(cmd), _IOC_NR(cmd),
+ cmd);
break;
}
return ret;
}
EXPORT_SYMBOL_GPL(v4l2_compat_ioctl32);
-#endif
-
-MODULE_LICENSE("GPL");