[media] gspca: Use the global error status for get/set streamparm
authorJean-François Moine <moinejf@free.fr>
Sat, 25 Dec 2010 16:46:14 +0000 (13:46 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 29 Dec 2010 10:17:06 +0000 (08:17 -0200)
Also, in ov534, don't check the parm type.

Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/gspca/gspca.c
drivers/media/video/gspca/gspca.h
drivers/media/video/gspca/ov534.c

index 03381c6..92b5dfb 100644 (file)
@@ -1708,12 +1708,13 @@ static int vidioc_g_parm(struct file *filp, void *priv,
 
                if (mutex_lock_interruptible(&gspca_dev->usb_lock))
                        return -ERESTARTSYS;
-               gspca_dev->usb_err = 0;
-               if (gspca_dev->present)
-                       ret = gspca_dev->sd_desc->get_streamparm(gspca_dev,
-                                                                parm);
-               else
+               if (gspca_dev->present) {
+                       gspca_dev->usb_err = 0;
+                       gspca_dev->sd_desc->get_streamparm(gspca_dev, parm);
+                       ret = gspca_dev->usb_err;
+               } else {
                        ret = -ENODEV;
+               }
                mutex_unlock(&gspca_dev->usb_lock);
                return ret;
        }
@@ -1738,12 +1739,13 @@ static int vidioc_s_parm(struct file *filp, void *priv,
 
                if (mutex_lock_interruptible(&gspca_dev->usb_lock))
                        return -ERESTARTSYS;
-               gspca_dev->usb_err = 0;
-               if (gspca_dev->present)
-                       ret = gspca_dev->sd_desc->set_streamparm(gspca_dev,
-                                                                parm);
-               else
+               if (gspca_dev->present) {
+                       gspca_dev->usb_err = 0;
+                       gspca_dev->sd_desc->set_streamparm(gspca_dev, parm);
+                       ret = gspca_dev->usb_err;
+               } else {
                        ret = -ENODEV;
+               }
                mutex_unlock(&gspca_dev->usb_lock);
                return ret;
        }
index d4d210b..3c8a63b 100644 (file)
@@ -93,7 +93,7 @@ typedef int (*cam_reg_op) (struct gspca_dev *,
                                struct v4l2_dbg_register *);
 typedef int (*cam_ident_op) (struct gspca_dev *,
                                struct v4l2_dbg_chip_ident *);
-typedef int (*cam_streamparm_op) (struct gspca_dev *,
+typedef void (*cam_streamparm_op) (struct gspca_dev *,
                                  struct v4l2_streamparm *);
 typedef int (*cam_qmnu_op) (struct gspca_dev *,
                        struct v4l2_querymenu *);
index 88ef03f..0edf939 100644 (file)
@@ -1243,34 +1243,26 @@ static int sd_querymenu(struct gspca_dev *gspca_dev,
 }
 
 /* get stream parameters (framerate) */
-static int sd_get_streamparm(struct gspca_dev *gspca_dev,
+static void sd_get_streamparm(struct gspca_dev *gspca_dev,
                             struct v4l2_streamparm *parm)
 {
        struct v4l2_captureparm *cp = &parm->parm.capture;
        struct v4l2_fract *tpf = &cp->timeperframe;
        struct sd *sd = (struct sd *) gspca_dev;
 
-       if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
-               return -EINVAL;
-
        cp->capability |= V4L2_CAP_TIMEPERFRAME;
        tpf->numerator = 1;
        tpf->denominator = sd->frame_rate;
-
-       return 0;
 }
 
 /* set stream parameters (framerate) */
-static int sd_set_streamparm(struct gspca_dev *gspca_dev,
+static void sd_set_streamparm(struct gspca_dev *gspca_dev,
                             struct v4l2_streamparm *parm)
 {
        struct v4l2_captureparm *cp = &parm->parm.capture;
        struct v4l2_fract *tpf = &cp->timeperframe;
        struct sd *sd = (struct sd *) gspca_dev;
 
-       if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
-               return -EINVAL;
-
        /* Set requested framerate */
        sd->frame_rate = tpf->denominator / tpf->numerator;
        if (gspca_dev->streaming)
@@ -1279,8 +1271,6 @@ static int sd_set_streamparm(struct gspca_dev *gspca_dev,
        /* Return the actual framerate */
        tpf->numerator = 1;
        tpf->denominator = sd->frame_rate;
-
-       return 0;
 }
 
 /* sub-driver description */