]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
V4L/DVB (11263): gspca: Stop setting buffer type, and avoid memset in querycap
authorTrent Piepho <xyzzy@speakeasy.org>
Sun, 29 Mar 2009 01:25:35 +0000 (22:25 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 30 Mar 2009 15:43:44 +0000 (12:43 -0300)
The v4l2-ioctl core checks the buffer type now by only allowing buffer
types for which the corresponding ->vidioc_try_fmt_xxx() methods are
defined.

This driver only defines ->vidioc_try_fmt_vid_cap() so only VIDEO_CAPTURE
buffers are allowed to be used with vidioc_g_parm.  Also,
->vidioc_enum_fmt_vid_cap() is only called for VIDEO_CAPTURE buffers.
There is no need to set the buffer type since it must already be the
correct value.

The struct which ->vidioc_querycap() is supposed to fill in is already
zeroed so it's not necessary to call memset on it.

Cc: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/gspca/gspca.c

index 66e91d896eda450f78fae253263e3f0ce23a1806..a75c1ca2db41d05953c8d9c6cba9c8ddc3701861 100644 (file)
@@ -765,7 +765,6 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void  *priv,
        fmtdesc->pixelformat = fmt_tb[index];
        if (gspca_is_compressed(fmt_tb[index]))
                fmtdesc->flags = V4L2_FMT_FLAG_COMPRESSED;
-       fmtdesc->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
        fmtdesc->description[0] = fmtdesc->pixelformat & 0xff;
        fmtdesc->description[1] = (fmtdesc->pixelformat >> 8) & 0xff;
        fmtdesc->description[2] = (fmtdesc->pixelformat >> 16) & 0xff;
@@ -962,8 +961,6 @@ static int vidioc_querycap(struct file *file, void  *priv,
        struct gspca_dev *gspca_dev = priv;
        int ret;
 
-       memset(cap, 0, sizeof *cap);
-
        /* protect the access to the usb device */
        if (mutex_lock_interruptible(&gspca_dev->usb_lock))
                return -ERESTARTSYS;
@@ -1341,7 +1338,6 @@ static int vidioc_g_parm(struct file *filp, void *priv,
 {
        struct gspca_dev *gspca_dev = priv;
 
-       parm->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
        parm->parm.capture.readbuffers = gspca_dev->nbufread;
 
        if (gspca_dev->sd_desc->get_streamparm) {