V4L/DVB (11303): tda7432: remove legacy code for old-style i2c API
[safe/jmp/linux-2.6] / drivers / media / video / v4l2-ioctl.c
index df8d1ff..f41c6f5 100644 (file)
@@ -1551,6 +1551,9 @@ static long __video_do_ioctl(struct file *file,
                struct v4l2_streamparm *p = arg;
 
                if (ops->vidioc_g_parm) {
+                       ret = check_fmt(ops, p->type);
+                       if (ret)
+                               break;
                        ret = ops->vidioc_g_parm(file, fh, p);
                } else {
                        if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
@@ -1570,6 +1573,10 @@ static long __video_do_ioctl(struct file *file,
 
                if (!ops->vidioc_s_parm)
                        break;
+               ret = check_fmt(ops, p->type);
+               if (ret)
+                       break;
+
                dbgarg(cmd, "type=%d\n", p->type);
                ret = ops->vidioc_s_parm(file, fh, p);
                break;
@@ -1796,11 +1803,12 @@ static long __video_do_ioctl(struct file *file,
 static unsigned long cmd_input_size(unsigned int cmd)
 {
        /* Size of structure up to and including 'field' */
-#define CMDINSIZE(cmd, type, field) case _IOC_NR(VIDIOC_##cmd): return \
-               offsetof(struct v4l2_##type, field) + \
-               sizeof(((struct v4l2_##type *)0)->field);
+#define CMDINSIZE(cmd, type, field)                            \
+       case VIDIOC_##cmd:                                      \
+               return offsetof(struct v4l2_##type, field) +    \
+                       sizeof(((struct v4l2_##type *)0)->field);
 
-       switch (_IOC_NR(cmd)) {
+       switch (cmd) {
                CMDINSIZE(ENUM_FMT,             fmtdesc,        type);
                CMDINSIZE(G_FMT,                format,         type);
                CMDINSIZE(QUERYBUF,             buffer,         type);