[media] v4l2-ioctl.c: use the new table for overlay/streamon/off ioctls
authorHans Verkuil <hans.verkuil@cisco.com>
Sat, 9 Jun 2012 15:50:15 +0000 (12:50 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 6 Jul 2012 20:19:04 +0000 (17:19 -0300)
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/v4l2-ioctl.c

index 25c0a8acc79126050e8fb04cffd0a3b1dc5ac9b7..78ff09f559beebd6409a91a2254d161dcf6c3a9a 100644 (file)
@@ -359,6 +359,11 @@ static void v4l_print_framebuffer(const void *arg, bool write_only)
                        p->fmt.colorspace);
 }
 
+static void v4l_print_buftype(const void *arg, bool write_only)
+{
+       pr_cont("type=%s\n", prt_names(*(u32 *)arg, v4l2_type_names));
+}
+
 static void v4l_print_u32(const void *arg, bool write_only)
 {
        pr_cont("value=%u\n", *(const u32 *)arg);
@@ -844,6 +849,18 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops,
        return -EINVAL;
 }
 
+static int v4l_streamon(const struct v4l2_ioctl_ops *ops,
+                               struct file *file, void *fh, void *arg)
+{
+       return ops->vidioc_streamon(file, fh, *(unsigned int *)arg);
+}
+
+static int v4l_streamoff(const struct v4l2_ioctl_ops *ops,
+                               struct file *file, void *fh, void *arg)
+{
+       return ops->vidioc_streamoff(file, fh, *(unsigned int *)arg);
+}
+
 struct v4l2_ioctl_info {
        unsigned int ioctl;
        u32 flags;
@@ -903,11 +920,11 @@ static struct v4l2_ioctl_info v4l2_ioctls[] = {
        IOCTL_INFO(VIDIOC_QUERYBUF, INFO_FL_CLEAR(v4l2_buffer, length)),
        IOCTL_INFO_STD(VIDIOC_G_FBUF, vidioc_g_fbuf, v4l_print_framebuffer, 0),
        IOCTL_INFO_STD(VIDIOC_S_FBUF, vidioc_s_fbuf, v4l_print_framebuffer, INFO_FL_PRIO),
-       IOCTL_INFO(VIDIOC_OVERLAY, INFO_FL_PRIO),
+       IOCTL_INFO_STD(VIDIOC_OVERLAY, vidioc_overlay, v4l_print_u32, INFO_FL_PRIO),
        IOCTL_INFO(VIDIOC_QBUF, 0),
        IOCTL_INFO(VIDIOC_DQBUF, 0),
-       IOCTL_INFO(VIDIOC_STREAMON, INFO_FL_PRIO),
-       IOCTL_INFO(VIDIOC_STREAMOFF, INFO_FL_PRIO),
+       IOCTL_INFO_FNC(VIDIOC_STREAMON, v4l_streamon, v4l_print_buftype, INFO_FL_PRIO),
+       IOCTL_INFO_FNC(VIDIOC_STREAMOFF, v4l_streamoff, v4l_print_buftype, INFO_FL_PRIO),
        IOCTL_INFO(VIDIOC_G_PARM, INFO_FL_CLEAR(v4l2_streamparm, type)),
        IOCTL_INFO(VIDIOC_S_PARM, INFO_FL_PRIO),
        IOCTL_INFO(VIDIOC_G_STD, 0),
@@ -1143,30 +1160,6 @@ static long __video_do_ioctl(struct file *file,
                        dbgbuf(cmd, vfd, p);
                break;
        }
-       case VIDIOC_OVERLAY:
-       {
-               int *i = arg;
-
-               dbgarg(cmd, "value=%d\n", *i);
-               ret = ops->vidioc_overlay(file, fh, *i);
-               break;
-       }
-       case VIDIOC_STREAMON:
-       {
-               enum v4l2_buf_type i = *(int *)arg;
-
-               dbgarg(cmd, "type=%s\n", prt_names(i, v4l2_type_names));
-               ret = ops->vidioc_streamon(file, fh, i);
-               break;
-       }
-       case VIDIOC_STREAMOFF:
-       {
-               enum v4l2_buf_type i = *(int *)arg;
-
-               dbgarg(cmd, "type=%s\n", prt_names(i, v4l2_type_names));
-               ret = ops->vidioc_streamoff(file, fh, i);
-               break;
-       }
        /* ---------- tv norms ---------- */
        case VIDIOC_ENUMSTD:
        {