media: drivers/media: don't set pix->priv = 0
[sfrench/cifs-2.6.git] / drivers / media / usb / gspca / gspca.c
index 83b78a42414e704e2d2cf5bb679d8174be7b41d3..4add2b12d33023d3f340ebc12204d205e3e7e010 100644 (file)
@@ -1027,15 +1027,15 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void  *priv,
        return 0;
 }
 
-static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
-                           struct v4l2_format *fmt)
+static int vidioc_g_fmt_vid_cap(struct file *file, void *_priv,
+                               struct v4l2_format *fmt)
 {
        struct gspca_dev *gspca_dev = video_drvdata(file);
+       u32 priv = fmt->fmt.pix.priv;
 
        fmt->fmt.pix = gspca_dev->pixfmt;
-       /* some drivers use priv internally, zero it before giving it back to
-          the core */
-       fmt->fmt.pix.priv = 0;
+       /* some drivers use priv internally, so keep the original value */
+       fmt->fmt.pix.priv = priv;
        return 0;
 }
 
@@ -1070,27 +1070,27 @@ static int try_fmt_vid_cap(struct gspca_dev *gspca_dev,
                fmt->fmt.pix.height = h;
                gspca_dev->sd_desc->try_fmt(gspca_dev, fmt);
        }
-       /* some drivers use priv internally, zero it before giving it back to
-          the core */
-       fmt->fmt.pix.priv = 0;
        return mode;                    /* used when s_fmt */
 }
 
-static int vidioc_try_fmt_vid_cap(struct file *file,
-                             void *priv,
-                             struct v4l2_format *fmt)
+static int vidioc_try_fmt_vid_cap(struct file *file, void *_priv,
+                                 struct v4l2_format *fmt)
 {
        struct gspca_dev *gspca_dev = video_drvdata(file);
+       u32 priv = fmt->fmt.pix.priv;
 
        if (try_fmt_vid_cap(gspca_dev, fmt) < 0)
                return -EINVAL;
+       /* some drivers use priv internally, so keep the original value */
+       fmt->fmt.pix.priv = priv;
        return 0;
 }
 
-static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
-                           struct v4l2_format *fmt)
+static int vidioc_s_fmt_vid_cap(struct file *file, void *_priv,
+                               struct v4l2_format *fmt)
 {
        struct gspca_dev *gspca_dev = video_drvdata(file);
+       u32 priv = fmt->fmt.pix.priv;
        int mode;
 
        if (vb2_is_busy(&gspca_dev->queue))
@@ -1106,6 +1106,8 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
                gspca_dev->pixfmt = fmt->fmt.pix;
        else
                gspca_dev->pixfmt = gspca_dev->cam.cam_mode[mode];
+       /* some drivers use priv internally, so keep the original value */
+       fmt->fmt.pix.priv = priv;
        return 0;
 }