[media] v4l2: make vidioc_s_jpegcomp const
authorHans Verkuil <hans.verkuil@cisco.com>
Mon, 17 Sep 2012 08:05:25 +0000 (05:05 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 26 Sep 2012 13:43:04 +0000 (10:43 -0300)
Write-only ioctls should have a const argument in the ioctl op.
Do this conversion for vidioc_s_jpegcomp.
Adding const for write-only ioctls was decided during the 2012 Media Workshop.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/pci/zoran/zoran_driver.c
drivers/media/usb/cpia2/cpia2_v4l.c
drivers/media/usb/gspca/gspca.c
drivers/media/usb/gspca/gspca.h
drivers/media/usb/gspca/jeilinj.c
drivers/media/usb/gspca/ov519.c
drivers/media/usb/gspca/topro.c
drivers/media/usb/gspca/zc3xx.c
drivers/media/usb/s2255/s2255drv.c
drivers/staging/media/go7007/go7007-v4l2.c
include/media/v4l2-ioctl.h

index f91b551e6a52bcb41ae0509c97b3a5ee6154ab5c..9ecd7d711f2776a07ccf0b8b78266aa1baaee441 100644 (file)
@@ -2674,7 +2674,7 @@ static int zoran_g_jpegcomp(struct file *file, void *__fh,
 }
 
 static int zoran_s_jpegcomp(struct file *file, void *__fh,
-                                       struct v4l2_jpegcompression *params)
+                                       const struct v4l2_jpegcompression *params)
 {
        struct zoran_fh *fh = __fh;
        struct zoran *zr = fh->zr;
@@ -2701,7 +2701,7 @@ static int zoran_s_jpegcomp(struct file *file, void *__fh,
        if (!fh->buffers.allocated)
                fh->buffers.buffer_size =
                        zoran_v4l2_calc_bufsize(&fh->jpg_settings);
-       fh->jpg_settings.jpg_comp = *params = settings.jpg_comp;
+       fh->jpg_settings.jpg_comp = settings.jpg_comp;
 sjpegc_unlock_and_return:
        mutex_unlock(&zr->resource_lock);
 
index 5ca6f44b4c6327fd2c0edc9b1ee0ed63408b4c6a..aeb9d227572583e077a134e6133d9766793cc215 100644 (file)
@@ -734,7 +734,8 @@ static int cpia2_g_jpegcomp(struct file *file, void *fh, struct v4l2_jpegcompres
  *
  *****************************************************************************/
 
-static int cpia2_s_jpegcomp(struct file *file, void *fh, struct v4l2_jpegcompression *parms)
+static int cpia2_s_jpegcomp(struct file *file, void *fh,
+               const struct v4l2_jpegcompression *parms)
 {
        struct camera_data *cam = video_drvdata(file);
 
@@ -743,8 +744,6 @@ static int cpia2_s_jpegcomp(struct file *file, void *fh, struct v4l2_jpegcompres
 
        cam->params.compression.inhibit_htables =
                !(parms->jpeg_markers & V4L2_JPEG_MARKER_DHT);
-       parms->jpeg_markers &= V4L2_JPEG_MARKER_DQT | V4L2_JPEG_MARKER_DRI |
-                              V4L2_JPEG_MARKER_DHT;
 
        if(parms->APP_len != 0) {
                if(parms->APP_len > 0 &&
index 2abbf52c781a7dd17cb0d1d7ba92c1e433387688..a2b934146ebf9245da1a972b36addc89eb7b026c 100644 (file)
@@ -1686,7 +1686,7 @@ static int vidioc_g_jpegcomp(struct file *file, void *priv,
 }
 
 static int vidioc_s_jpegcomp(struct file *file, void *priv,
-                       struct v4l2_jpegcompression *jpegcomp)
+                       const struct v4l2_jpegcompression *jpegcomp)
 {
        struct gspca_dev *gspca_dev = video_drvdata(file);
 
index dc688c7f5e4811845ce5f8add9de98a3ea2cdeec..e3eab82cd4e5d31097b064e654e18a9079d8ee43 100644 (file)
@@ -83,8 +83,10 @@ struct gspca_frame;
 typedef int (*cam_op) (struct gspca_dev *);
 typedef void (*cam_v_op) (struct gspca_dev *);
 typedef int (*cam_cf_op) (struct gspca_dev *, const struct usb_device_id *);
-typedef int (*cam_jpg_op) (struct gspca_dev *,
+typedef int (*cam_get_jpg_op) (struct gspca_dev *,
                                struct v4l2_jpegcompression *);
+typedef int (*cam_set_jpg_op) (struct gspca_dev *,
+                               const struct v4l2_jpegcompression *);
 typedef int (*cam_reg_op) (struct gspca_dev *,
                                struct v4l2_dbg_register *);
 typedef int (*cam_ident_op) (struct gspca_dev *,
@@ -126,8 +128,8 @@ struct sd_desc {
        cam_v_op stopN;         /* called on stream off - main alt */
        cam_v_op stop0;         /* called on stream off & disconnect - alt 0 */
        cam_v_op dq_callback;   /* called when a frame has been dequeued */
-       cam_jpg_op get_jcomp;
-       cam_jpg_op set_jcomp;
+       cam_get_jpg_op get_jcomp;
+       cam_set_jpg_op set_jcomp;
        cam_qmnu_op querymenu;
        cam_streamparm_op get_streamparm;
        cam_streamparm_op set_streamparm;
index 26b99310d628f50d4be973e317f7a84104d0c449..b897aa86f315665645808efa95be5b11d3ac2171 100644 (file)
@@ -474,7 +474,7 @@ static int sd_init_controls(struct gspca_dev *gspca_dev)
 }
 
 static int sd_set_jcomp(struct gspca_dev *gspca_dev,
-                       struct v4l2_jpegcompression *jcomp)
+                       const struct v4l2_jpegcompression *jcomp)
 {
        struct sd *sd = (struct sd *) gspca_dev;
 
index c1a21bfb4be7be9c9d10f3b6ae2abb86db68b4a8..9aa09f845ce4c2ca05b1d4bf7e34575b19436dc9 100644 (file)
@@ -4762,7 +4762,7 @@ static int sd_get_jcomp(struct gspca_dev *gspca_dev,
 }
 
 static int sd_set_jcomp(struct gspca_dev *gspca_dev,
-                       struct v4l2_jpegcompression *jcomp)
+                       const struct v4l2_jpegcompression *jcomp)
 {
        struct sd *sd = (struct sd *) gspca_dev;
 
index a6055246cb9d720c13dbd880c167a6aec94ba79c..4cb511ccc5f6ecbefadee9ef64de47f9fd75f3e2 100644 (file)
@@ -4806,7 +4806,7 @@ static void sd_set_streamparm(struct gspca_dev *gspca_dev,
 }
 
 static int sd_set_jcomp(struct gspca_dev *gspca_dev,
-                       struct v4l2_jpegcompression *jcomp)
+                       const struct v4l2_jpegcompression *jcomp)
 {
        struct sd *sd = (struct sd *) gspca_dev;
 
index c47ba14c76190ebaa89ff62463e7ad7b2d82388f..77c57755e7b4623a07c81b2324fb20f291ee1dc0 100644 (file)
@@ -6883,16 +6883,11 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
 }
 
 static int sd_set_jcomp(struct gspca_dev *gspca_dev,
-                       struct v4l2_jpegcompression *jcomp)
+                       const struct v4l2_jpegcompression *jcomp)
 {
        struct sd *sd = (struct sd *) gspca_dev;
-       int ret;
 
-       ret = v4l2_ctrl_s_ctrl(sd->jpegqual, jcomp->quality);
-       if (ret)
-               return ret;
-       jcomp->quality = v4l2_ctrl_g_ctrl(sd->jpegqual);
-       return 0;
+       return v4l2_ctrl_s_ctrl(sd->jpegqual, jcomp->quality);
 }
 
 static int sd_get_jcomp(struct gspca_dev *gspca_dev,
index a25513d484f705464c6f5e83152dc385d8796ebd..2191f6ddf9e7536883a6b7e7973ceeba30b0ef61 100644 (file)
@@ -1556,7 +1556,7 @@ static int vidioc_g_jpegcomp(struct file *file, void *priv,
 }
 
 static int vidioc_s_jpegcomp(struct file *file, void *priv,
-                        struct v4l2_jpegcompression *jc)
+                        const struct v4l2_jpegcompression *jc)
 {
        struct s2255_fh *fh = priv;
        struct s2255_channel *channel = fh->channel;
index c184ad30fbd8c6ea9e8cc9f806f582c917c0637c..f1dff3d099572a702667db9bb4e5f7babf0da9f1 100644 (file)
@@ -1392,7 +1392,7 @@ static int vidioc_g_jpegcomp(struct file *file, void *priv,
 }
 
 static int vidioc_s_jpegcomp(struct file *file, void *priv,
-                        struct v4l2_jpegcompression *params)
+                        const struct v4l2_jpegcompression *params)
 {
        if (params->quality != 50 ||
                        params->jpeg_markers != (V4L2_JPEG_MARKER_DHT |
index 73ae24a41cb154be4c33ef5e8a55c324d37a9204..21f624586d56e9bf5e201634e29c45a6b97cc0bc 100644 (file)
@@ -195,7 +195,7 @@ struct v4l2_ioctl_ops {
        int (*vidioc_g_jpegcomp)       (struct file *file, void *fh,
                                        struct v4l2_jpegcompression *a);
        int (*vidioc_s_jpegcomp)       (struct file *file, void *fh,
-                                       struct v4l2_jpegcompression *a);
+                                       const struct v4l2_jpegcompression *a);
        int (*vidioc_g_enc_index)      (struct file *file, void *fh,
                                        struct v4l2_enc_idx *a);
        int (*vidioc_encoder_cmd)      (struct file *file, void *fh,