[media] sliced vbi: subdevs shouldn't clear the full v4l2_sliced_vbi_format struct
authorHans Verkuil <hans.verkuil@cisco.com>
Wed, 5 Sep 2012 13:38:10 +0000 (10:38 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 1 Oct 2012 20:12:51 +0000 (17:12 -0300)
Various subdevs cleared the full v4l2_sliced_vbi_format struct, when
only the service_set/lines fields should have been cleared.
Due to this the io_size field was wrongly cleared to 0, causing a
v4l2-compliance error.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/i2c/cx25840/cx25840-vbi.c
drivers/media/i2c/saa7115.c
drivers/media/i2c/saa7127.c
drivers/media/i2c/tvp5150.c
drivers/media/pci/cx18/cx18-av-vbi.c
drivers/media/pci/cx18/cx18-ioctl.c
drivers/media/pci/ivtv/ivtv-ioctl.c

index 64a4004f8a97c9f041296cd1da2799a5042129b2..c39e91dc113794b936fd484da0686a635724ff01 100644 (file)
@@ -96,7 +96,8 @@ int cx25840_g_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *
        int is_pal = !(state->std & V4L2_STD_525_60);
        int i;
 
-       memset(svbi, 0, sizeof(*svbi));
+       memset(svbi->service_lines, 0, sizeof(svbi->service_lines));
+       svbi->service_set = 0;
        /* we're done if raw VBI is active */
        if ((cx25840_read(client, 0x404) & 0x10) == 0)
                return 0;
index 2107336cd8369cd055e5d43362349fc936d4518e..6b6788cd08f6d6862020d0ab8d6b76e40fbb1402 100644 (file)
@@ -1066,7 +1066,8 @@ static int saa711x_g_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_f
        };
        int i;
 
-       memset(sliced, 0, sizeof(*sliced));
+       memset(sliced->service_lines, 0, sizeof(sliced->service_lines));
+       sliced->service_set = 0;
        /* done if using raw VBI */
        if (saa711x_read(sd, R_80_GLOBAL_CNTL_1) & 0x10)
                return 0;
index 8ecb6564a3158db872147f87ceb1c38b88882088..b745f68fbc92d9c1c142a5a712f61180c928dd28 100644 (file)
@@ -625,7 +625,7 @@ static int saa7127_g_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_f
 {
        struct saa7127_state *state = to_state(sd);
 
-       memset(fmt, 0, sizeof(*fmt));
+       memset(fmt->service_lines, 0, sizeof(fmt->service_lines));
        if (state->vps_enable)
                fmt->service_lines[0][16] = V4L2_SLICED_VPS;
        if (state->wss_enable)
index b5b1792479d06eee2681f60980c62f1b2bbcdcae..31104a9606529a1ad57040527e9e3cc53f8361f9 100644 (file)
@@ -1020,7 +1020,7 @@ static int tvp5150_g_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_f
 {
        int i, mask = 0;
 
-       memset(svbi, 0, sizeof(*svbi));
+       memset(svbi->service_lines, 0, sizeof(svbi->service_lines));
 
        for (i = 0; i <= 23; i++) {
                svbi->service_lines[0][i] =
index baa36fbcd4d4d18c1e1d16906e138fbaaa73fc8e..246982841fece5ac75df67c9beb08604d56f3eba 100644 (file)
@@ -143,7 +143,9 @@ int cx18_av_g_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *
        int is_pal = !(state->std & V4L2_STD_525_60);
        int i;
 
-       memset(svbi, 0, sizeof(*svbi));
+       memset(svbi->service_lines, 0, sizeof(svbi->service_lines));
+       svbi->service_set = 0;
+
        /* we're done if raw VBI is active */
        if ((cx18_av_read(cx, 0x404) & 0x10) == 0)
                return 0;
index bb5073f72c4251b97d76a7cbd55238f8c8694260..cd8d2c2b16246e667e8e78053558cd7c30f6261d 100644 (file)
@@ -210,10 +210,6 @@ static int cx18_g_fmt_sliced_vbi_cap(struct file *file, void *fh,
        if (v4l2_subdev_call(cx->sd_av, vbi, g_sliced_fmt, &fmt->fmt.sliced))
                return -EINVAL;
 
-       /* Ensure V4L2 spec compliant output */
-       vbifmt->reserved[0] = 0;
-       vbifmt->reserved[1] = 0;
-       vbifmt->io_size = sizeof(struct v4l2_sliced_vbi_data) * 36;
        vbifmt->service_set = cx18_get_service_set(vbifmt);
        return 0;
 }
index ed6dcc7e61bcb3bfd912ab55497fb68cbddfc317..4e40c4e301ed0dd79fcd9b2f37a97eff241eaab9 100644 (file)
@@ -326,6 +326,7 @@ static int ivtv_g_fmt_sliced_vbi_out(struct file *file, void *fh, struct v4l2_fo
        if (!(itv->v4l2_cap & V4L2_CAP_SLICED_VBI_OUTPUT))
                return -EINVAL;
        vbifmt->io_size = sizeof(struct v4l2_sliced_vbi_data) * 36;
+       memset(vbifmt->service_lines, 0, sizeof(vbifmt->service_lines));
        if (itv->is_60hz) {
                vbifmt->service_lines[0][21] = V4L2_SLICED_CAPTION_525;
                vbifmt->service_lines[1][21] = V4L2_SLICED_CAPTION_525;