diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2012-09-05 04:10:48 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-09-26 10:02:25 -0400 |
commit | 4f996594ceaf6c3f9bc42b40c40b0f7f87b79c86 (patch) | |
tree | f2ba0120024627256917dc05a2d7c509ac056011 /drivers/media | |
parent | 3f70e1f598a6be4277e71516a98457fd3bddfbd0 (diff) |
[media] v4l2: make vidioc_s_crop const
Write-only ioctls should have a const argument in the ioctl op.
Do this conversion for vidioc_s_crop.
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>
Diffstat (limited to 'drivers/media')
26 files changed, 74 insertions, 74 deletions
diff --git a/drivers/media/i2c/soc_camera/mt9m001.c b/drivers/media/i2c/soc_camera/mt9m001.c index d85be41ffa1d..19f8a07764f9 100644 --- a/drivers/media/i2c/soc_camera/mt9m001.c +++ b/drivers/media/i2c/soc_camera/mt9m001.c | |||
@@ -171,7 +171,7 @@ static int mt9m001_s_stream(struct v4l2_subdev *sd, int enable) | |||
171 | return 0; | 171 | return 0; |
172 | } | 172 | } |
173 | 173 | ||
174 | static int mt9m001_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) | 174 | static int mt9m001_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) |
175 | { | 175 | { |
176 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 176 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
177 | struct mt9m001 *mt9m001 = to_mt9m001(client); | 177 | struct mt9m001 *mt9m001 = to_mt9m001(client); |
diff --git a/drivers/media/i2c/soc_camera/mt9m111.c b/drivers/media/i2c/soc_camera/mt9m111.c index 938c5c390eec..62fd94af599b 100644 --- a/drivers/media/i2c/soc_camera/mt9m111.c +++ b/drivers/media/i2c/soc_camera/mt9m111.c | |||
@@ -383,7 +383,7 @@ static int mt9m111_reset(struct mt9m111 *mt9m111) | |||
383 | return ret; | 383 | return ret; |
384 | } | 384 | } |
385 | 385 | ||
386 | static int mt9m111_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) | 386 | static int mt9m111_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) |
387 | { | 387 | { |
388 | struct v4l2_rect rect = a->c; | 388 | struct v4l2_rect rect = a->c; |
389 | struct mt9m111 *mt9m111 = container_of(sd, struct mt9m111, subdev); | 389 | struct mt9m111 *mt9m111 = container_of(sd, struct mt9m111, subdev); |
diff --git a/drivers/media/i2c/soc_camera/mt9t031.c b/drivers/media/i2c/soc_camera/mt9t031.c index d74607adc585..40800b10a080 100644 --- a/drivers/media/i2c/soc_camera/mt9t031.c +++ b/drivers/media/i2c/soc_camera/mt9t031.c | |||
@@ -294,7 +294,7 @@ static int mt9t031_set_params(struct i2c_client *client, | |||
294 | return ret < 0 ? ret : 0; | 294 | return ret < 0 ? ret : 0; |
295 | } | 295 | } |
296 | 296 | ||
297 | static int mt9t031_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) | 297 | static int mt9t031_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) |
298 | { | 298 | { |
299 | struct v4l2_rect rect = a->c; | 299 | struct v4l2_rect rect = a->c; |
300 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 300 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
diff --git a/drivers/media/i2c/soc_camera/mt9t112.c b/drivers/media/i2c/soc_camera/mt9t112.c index 9ba428ede516..de7cd836b0a2 100644 --- a/drivers/media/i2c/soc_camera/mt9t112.c +++ b/drivers/media/i2c/soc_camera/mt9t112.c | |||
@@ -907,11 +907,11 @@ static int mt9t112_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) | |||
907 | return 0; | 907 | return 0; |
908 | } | 908 | } |
909 | 909 | ||
910 | static int mt9t112_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) | 910 | static int mt9t112_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) |
911 | { | 911 | { |
912 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 912 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
913 | struct mt9t112_priv *priv = to_mt9t112(client); | 913 | struct mt9t112_priv *priv = to_mt9t112(client); |
914 | struct v4l2_rect *rect = &a->c; | 914 | const struct v4l2_rect *rect = &a->c; |
915 | 915 | ||
916 | return mt9t112_set_params(priv, rect, priv->format->code); | 916 | return mt9t112_set_params(priv, rect, priv->format->code); |
917 | } | 917 | } |
diff --git a/drivers/media/i2c/soc_camera/mt9v022.c b/drivers/media/i2c/soc_camera/mt9v022.c index 350d0d854447..13057b966ee9 100644 --- a/drivers/media/i2c/soc_camera/mt9v022.c +++ b/drivers/media/i2c/soc_camera/mt9v022.c | |||
@@ -237,7 +237,7 @@ static int mt9v022_s_stream(struct v4l2_subdev *sd, int enable) | |||
237 | return 0; | 237 | return 0; |
238 | } | 238 | } |
239 | 239 | ||
240 | static int mt9v022_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) | 240 | static int mt9v022_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) |
241 | { | 241 | { |
242 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 242 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
243 | struct mt9v022 *mt9v022 = to_mt9v022(client); | 243 | struct mt9v022 *mt9v022 = to_mt9v022(client); |
diff --git a/drivers/media/i2c/soc_camera/ov5642.c b/drivers/media/i2c/soc_camera/ov5642.c index d886c0b9ce44..8577e0cfb7fe 100644 --- a/drivers/media/i2c/soc_camera/ov5642.c +++ b/drivers/media/i2c/soc_camera/ov5642.c | |||
@@ -865,24 +865,24 @@ static int ov5642_g_chip_ident(struct v4l2_subdev *sd, | |||
865 | return 0; | 865 | return 0; |
866 | } | 866 | } |
867 | 867 | ||
868 | static int ov5642_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) | 868 | static int ov5642_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) |
869 | { | 869 | { |
870 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 870 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
871 | struct ov5642 *priv = to_ov5642(client); | 871 | struct ov5642 *priv = to_ov5642(client); |
872 | struct v4l2_rect *rect = &a->c; | 872 | struct v4l2_rect rect = a->c; |
873 | int ret; | 873 | int ret; |
874 | 874 | ||
875 | v4l_bound_align_image(&rect->width, 48, OV5642_MAX_WIDTH, 1, | 875 | v4l_bound_align_image(&rect.width, 48, OV5642_MAX_WIDTH, 1, |
876 | &rect->height, 32, OV5642_MAX_HEIGHT, 1, 0); | 876 | &rect.height, 32, OV5642_MAX_HEIGHT, 1, 0); |
877 | 877 | ||
878 | priv->crop_rect.width = rect->width; | 878 | priv->crop_rect.width = rect.width; |
879 | priv->crop_rect.height = rect->height; | 879 | priv->crop_rect.height = rect.height; |
880 | priv->total_width = rect->width + BLANKING_EXTRA_WIDTH; | 880 | priv->total_width = rect.width + BLANKING_EXTRA_WIDTH; |
881 | priv->total_height = max_t(int, rect->height + | 881 | priv->total_height = max_t(int, rect.height + |
882 | BLANKING_EXTRA_HEIGHT, | 882 | BLANKING_EXTRA_HEIGHT, |
883 | BLANKING_MIN_HEIGHT); | 883 | BLANKING_MIN_HEIGHT); |
884 | priv->crop_rect.width = rect->width; | 884 | priv->crop_rect.width = rect.width; |
885 | priv->crop_rect.height = rect->height; | 885 | priv->crop_rect.height = rect.height; |
886 | 886 | ||
887 | ret = ov5642_write_array(client, ov5642_default_regs_init); | 887 | ret = ov5642_write_array(client, ov5642_default_regs_init); |
888 | if (!ret) | 888 | if (!ret) |
diff --git a/drivers/media/i2c/soc_camera/ov6650.c b/drivers/media/i2c/soc_camera/ov6650.c index 65b031f333b7..e87feb0881e3 100644 --- a/drivers/media/i2c/soc_camera/ov6650.c +++ b/drivers/media/i2c/soc_camera/ov6650.c | |||
@@ -451,42 +451,42 @@ static int ov6650_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) | |||
451 | return 0; | 451 | return 0; |
452 | } | 452 | } |
453 | 453 | ||
454 | static int ov6650_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) | 454 | static int ov6650_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) |
455 | { | 455 | { |
456 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 456 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
457 | struct ov6650 *priv = to_ov6650(client); | 457 | struct ov6650 *priv = to_ov6650(client); |
458 | struct v4l2_rect *rect = &a->c; | 458 | struct v4l2_rect rect = a->c; |
459 | int ret; | 459 | int ret; |
460 | 460 | ||
461 | if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 461 | if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
462 | return -EINVAL; | 462 | return -EINVAL; |
463 | 463 | ||
464 | rect->left = ALIGN(rect->left, 2); | 464 | rect.left = ALIGN(rect.left, 2); |
465 | rect->width = ALIGN(rect->width, 2); | 465 | rect.width = ALIGN(rect.width, 2); |
466 | rect->top = ALIGN(rect->top, 2); | 466 | rect.top = ALIGN(rect.top, 2); |
467 | rect->height = ALIGN(rect->height, 2); | 467 | rect.height = ALIGN(rect.height, 2); |
468 | soc_camera_limit_side(&rect->left, &rect->width, | 468 | soc_camera_limit_side(&rect.left, &rect.width, |
469 | DEF_HSTRT << 1, 2, W_CIF); | 469 | DEF_HSTRT << 1, 2, W_CIF); |
470 | soc_camera_limit_side(&rect->top, &rect->height, | 470 | soc_camera_limit_side(&rect.top, &rect.height, |
471 | DEF_VSTRT << 1, 2, H_CIF); | 471 | DEF_VSTRT << 1, 2, H_CIF); |
472 | 472 | ||
473 | ret = ov6650_reg_write(client, REG_HSTRT, rect->left >> 1); | 473 | ret = ov6650_reg_write(client, REG_HSTRT, rect.left >> 1); |
474 | if (!ret) { | 474 | if (!ret) { |
475 | priv->rect.left = rect->left; | 475 | priv->rect.left = rect.left; |
476 | ret = ov6650_reg_write(client, REG_HSTOP, | 476 | ret = ov6650_reg_write(client, REG_HSTOP, |
477 | (rect->left + rect->width) >> 1); | 477 | (rect.left + rect.width) >> 1); |
478 | } | 478 | } |
479 | if (!ret) { | 479 | if (!ret) { |
480 | priv->rect.width = rect->width; | 480 | priv->rect.width = rect.width; |
481 | ret = ov6650_reg_write(client, REG_VSTRT, rect->top >> 1); | 481 | ret = ov6650_reg_write(client, REG_VSTRT, rect.top >> 1); |
482 | } | 482 | } |
483 | if (!ret) { | 483 | if (!ret) { |
484 | priv->rect.top = rect->top; | 484 | priv->rect.top = rect.top; |
485 | ret = ov6650_reg_write(client, REG_VSTOP, | 485 | ret = ov6650_reg_write(client, REG_VSTOP, |
486 | (rect->top + rect->height) >> 1); | 486 | (rect.top + rect.height) >> 1); |
487 | } | 487 | } |
488 | if (!ret) | 488 | if (!ret) |
489 | priv->rect.height = rect->height; | 489 | priv->rect.height = rect.height; |
490 | 490 | ||
491 | return ret; | 491 | return ret; |
492 | } | 492 | } |
diff --git a/drivers/media/i2c/soc_camera/rj54n1cb0c.c b/drivers/media/i2c/soc_camera/rj54n1cb0c.c index 32226c9024f9..02f0400051d9 100644 --- a/drivers/media/i2c/soc_camera/rj54n1cb0c.c +++ b/drivers/media/i2c/soc_camera/rj54n1cb0c.c | |||
@@ -536,11 +536,11 @@ static int rj54n1_commit(struct i2c_client *client) | |||
536 | static int rj54n1_sensor_scale(struct v4l2_subdev *sd, s32 *in_w, s32 *in_h, | 536 | static int rj54n1_sensor_scale(struct v4l2_subdev *sd, s32 *in_w, s32 *in_h, |
537 | s32 *out_w, s32 *out_h); | 537 | s32 *out_w, s32 *out_h); |
538 | 538 | ||
539 | static int rj54n1_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) | 539 | static int rj54n1_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) |
540 | { | 540 | { |
541 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 541 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
542 | struct rj54n1 *rj54n1 = to_rj54n1(client); | 542 | struct rj54n1 *rj54n1 = to_rj54n1(client); |
543 | struct v4l2_rect *rect = &a->c; | 543 | const struct v4l2_rect *rect = &a->c; |
544 | int dummy = 0, output_w, output_h, | 544 | int dummy = 0, output_w, output_h, |
545 | input_w = rect->width, input_h = rect->height; | 545 | input_w = rect->width, input_h = rect->height; |
546 | int ret; | 546 | int ret; |
diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c index a751b6c146fd..b5b1792479d0 100644 --- a/drivers/media/i2c/tvp5150.c +++ b/drivers/media/i2c/tvp5150.c | |||
@@ -865,7 +865,7 @@ static int tvp5150_mbus_fmt(struct v4l2_subdev *sd, | |||
865 | return 0; | 865 | return 0; |
866 | } | 866 | } |
867 | 867 | ||
868 | static int tvp5150_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) | 868 | static int tvp5150_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a) |
869 | { | 869 | { |
870 | struct v4l2_rect rect = a->c; | 870 | struct v4l2_rect rect = a->c; |
871 | struct tvp5150 *decoder = to_tvp5150(sd); | 871 | struct tvp5150 *decoder = to_tvp5150(sd); |
diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c index 31b282667463..16f5ca23698c 100644 --- a/drivers/media/pci/bt8xx/bttv-driver.c +++ b/drivers/media/pci/bt8xx/bttv-driver.c | |||
@@ -2986,7 +2986,7 @@ static int bttv_g_crop(struct file *file, void *f, struct v4l2_crop *crop) | |||
2986 | return 0; | 2986 | return 0; |
2987 | } | 2987 | } |
2988 | 2988 | ||
2989 | static int bttv_s_crop(struct file *file, void *f, struct v4l2_crop *crop) | 2989 | static int bttv_s_crop(struct file *file, void *f, const struct v4l2_crop *crop) |
2990 | { | 2990 | { |
2991 | struct bttv_fh *fh = f; | 2991 | struct bttv_fh *fh = f; |
2992 | struct bttv *btv = fh->btv; | 2992 | struct bttv *btv = fh->btv; |
@@ -3028,17 +3028,17 @@ static int bttv_s_crop(struct file *file, void *f, struct v4l2_crop *crop) | |||
3028 | } | 3028 | } |
3029 | 3029 | ||
3030 | /* Min. scaled size 48 x 32. */ | 3030 | /* Min. scaled size 48 x 32. */ |
3031 | c.rect.left = clamp(crop->c.left, b_left, b_right - 48); | 3031 | c.rect.left = clamp_t(s32, crop->c.left, b_left, b_right - 48); |
3032 | c.rect.left = min(c.rect.left, (__s32) MAX_HDELAY); | 3032 | c.rect.left = min(c.rect.left, (__s32) MAX_HDELAY); |
3033 | 3033 | ||
3034 | c.rect.width = clamp(crop->c.width, | 3034 | c.rect.width = clamp_t(s32, crop->c.width, |
3035 | 48, b_right - c.rect.left); | 3035 | 48, b_right - c.rect.left); |
3036 | 3036 | ||
3037 | c.rect.top = clamp(crop->c.top, b_top, b_bottom - 32); | 3037 | c.rect.top = clamp_t(s32, crop->c.top, b_top, b_bottom - 32); |
3038 | /* Top and height must be a multiple of two. */ | 3038 | /* Top and height must be a multiple of two. */ |
3039 | c.rect.top = (c.rect.top + 1) & ~1; | 3039 | c.rect.top = (c.rect.top + 1) & ~1; |
3040 | 3040 | ||
3041 | c.rect.height = clamp(crop->c.height, | 3041 | c.rect.height = clamp_t(s32, crop->c.height, |
3042 | 32, b_bottom - c.rect.top); | 3042 | 32, b_bottom - c.rect.top); |
3043 | c.rect.height = (c.rect.height + 1) & ~1; | 3043 | c.rect.height = (c.rect.height + 1) & ~1; |
3044 | 3044 | ||
diff --git a/drivers/media/pci/cx18/cx18-ioctl.c b/drivers/media/pci/cx18/cx18-ioctl.c index ff315446d4ad..bb5073f72c42 100644 --- a/drivers/media/pci/cx18/cx18-ioctl.c +++ b/drivers/media/pci/cx18/cx18-ioctl.c | |||
@@ -527,7 +527,7 @@ static int cx18_cropcap(struct file *file, void *fh, | |||
527 | return 0; | 527 | return 0; |
528 | } | 528 | } |
529 | 529 | ||
530 | static int cx18_s_crop(struct file *file, void *fh, struct v4l2_crop *crop) | 530 | static int cx18_s_crop(struct file *file, void *fh, const struct v4l2_crop *crop) |
531 | { | 531 | { |
532 | struct cx18_open_id *id = fh2id(fh); | 532 | struct cx18_open_id *id = fh2id(fh); |
533 | struct cx18 *cx = id->cx; | 533 | struct cx18 *cx = id->cx; |
diff --git a/drivers/media/pci/cx25821/cx25821-video.c b/drivers/media/pci/cx25821/cx25821-video.c index b38d4379cc36..0a80245165d0 100644 --- a/drivers/media/pci/cx25821/cx25821-video.c +++ b/drivers/media/pci/cx25821/cx25821-video.c | |||
@@ -1610,7 +1610,7 @@ int cx25821_vidioc_cropcap(struct file *file, void *priv, | |||
1610 | return 0; | 1610 | return 0; |
1611 | } | 1611 | } |
1612 | 1612 | ||
1613 | int cx25821_vidioc_s_crop(struct file *file, void *priv, struct v4l2_crop *crop) | 1613 | int cx25821_vidioc_s_crop(struct file *file, void *priv, const struct v4l2_crop *crop) |
1614 | { | 1614 | { |
1615 | struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; | 1615 | struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; |
1616 | struct cx25821_fh *fh = priv; | 1616 | struct cx25821_fh *fh = priv; |
diff --git a/drivers/media/pci/cx25821/cx25821-video.h b/drivers/media/pci/cx25821/cx25821-video.h index 9652a5e35ba2..c265e35b37c3 100644 --- a/drivers/media/pci/cx25821/cx25821-video.h +++ b/drivers/media/pci/cx25821/cx25821-video.h | |||
@@ -177,7 +177,7 @@ extern int cx25821_set_control(struct cx25821_dev *dev, | |||
177 | extern int cx25821_vidioc_cropcap(struct file *file, void *fh, | 177 | extern int cx25821_vidioc_cropcap(struct file *file, void *fh, |
178 | struct v4l2_cropcap *cropcap); | 178 | struct v4l2_cropcap *cropcap); |
179 | extern int cx25821_vidioc_s_crop(struct file *file, void *priv, | 179 | extern int cx25821_vidioc_s_crop(struct file *file, void *priv, |
180 | struct v4l2_crop *crop); | 180 | const struct v4l2_crop *crop); |
181 | extern int cx25821_vidioc_g_crop(struct file *file, void *priv, | 181 | extern int cx25821_vidioc_g_crop(struct file *file, void *priv, |
182 | struct v4l2_crop *crop); | 182 | struct v4l2_crop *crop); |
183 | 183 | ||
diff --git a/drivers/media/pci/ivtv/ivtv-ioctl.c b/drivers/media/pci/ivtv/ivtv-ioctl.c index d5cbb6177754..ed6dcc7e61bc 100644 --- a/drivers/media/pci/ivtv/ivtv-ioctl.c +++ b/drivers/media/pci/ivtv/ivtv-ioctl.c | |||
@@ -874,7 +874,7 @@ static int ivtv_cropcap(struct file *file, void *fh, struct v4l2_cropcap *cropca | |||
874 | return 0; | 874 | return 0; |
875 | } | 875 | } |
876 | 876 | ||
877 | static int ivtv_s_crop(struct file *file, void *fh, struct v4l2_crop *crop) | 877 | static int ivtv_s_crop(struct file *file, void *fh, const struct v4l2_crop *crop) |
878 | { | 878 | { |
879 | struct ivtv_open_id *id = fh2id(fh); | 879 | struct ivtv_open_id *id = fh2id(fh); |
880 | struct ivtv *itv = id->itv; | 880 | struct ivtv *itv = id->itv; |
diff --git a/drivers/media/pci/saa7134/saa7134-video.c b/drivers/media/pci/saa7134/saa7134-video.c index 135bfd8c28ad..22f8758d047f 100644 --- a/drivers/media/pci/saa7134/saa7134-video.c +++ b/drivers/media/pci/saa7134/saa7134-video.c | |||
@@ -1953,11 +1953,12 @@ static int saa7134_g_crop(struct file *file, void *f, struct v4l2_crop *crop) | |||
1953 | return 0; | 1953 | return 0; |
1954 | } | 1954 | } |
1955 | 1955 | ||
1956 | static int saa7134_s_crop(struct file *file, void *f, struct v4l2_crop *crop) | 1956 | static int saa7134_s_crop(struct file *file, void *f, const struct v4l2_crop *crop) |
1957 | { | 1957 | { |
1958 | struct saa7134_fh *fh = f; | 1958 | struct saa7134_fh *fh = f; |
1959 | struct saa7134_dev *dev = fh->dev; | 1959 | struct saa7134_dev *dev = fh->dev; |
1960 | struct v4l2_rect *b = &dev->crop_bounds; | 1960 | struct v4l2_rect *b = &dev->crop_bounds; |
1961 | struct v4l2_rect *c = &dev->crop_current; | ||
1961 | 1962 | ||
1962 | if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && | 1963 | if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && |
1963 | crop->type != V4L2_BUF_TYPE_VIDEO_OVERLAY) | 1964 | crop->type != V4L2_BUF_TYPE_VIDEO_OVERLAY) |
@@ -1972,21 +1973,20 @@ static int saa7134_s_crop(struct file *file, void *f, struct v4l2_crop *crop) | |||
1972 | if (res_locked(fh->dev, RESOURCE_VIDEO)) | 1973 | if (res_locked(fh->dev, RESOURCE_VIDEO)) |
1973 | return -EBUSY; | 1974 | return -EBUSY; |
1974 | 1975 | ||
1975 | if (crop->c.top < b->top) | 1976 | *c = crop->c; |
1976 | crop->c.top = b->top; | 1977 | if (c->top < b->top) |
1977 | if (crop->c.top > b->top + b->height) | 1978 | c->top = b->top; |
1978 | crop->c.top = b->top + b->height; | 1979 | if (c->top > b->top + b->height) |
1979 | if (crop->c.height > b->top - crop->c.top + b->height) | 1980 | c->top = b->top + b->height; |
1980 | crop->c.height = b->top - crop->c.top + b->height; | 1981 | if (c->height > b->top - c->top + b->height) |
1981 | 1982 | c->height = b->top - c->top + b->height; | |
1982 | if (crop->c.left < b->left) | 1983 | |
1983 | crop->c.left = b->left; | 1984 | if (c->left < b->left) |
1984 | if (crop->c.left > b->left + b->width) | 1985 | c->left = b->left; |
1985 | crop->c.left = b->left + b->width; | 1986 | if (c->left > b->left + b->width) |
1986 | if (crop->c.width > b->left - crop->c.left + b->width) | 1987 | c->left = b->left + b->width; |
1987 | crop->c.width = b->left - crop->c.left + b->width; | 1988 | if (c->width > b->left - c->left + b->width) |
1988 | 1989 | c->width = b->left - c->left + b->width; | |
1989 | dev->crop_current = crop->c; | ||
1990 | return 0; | 1990 | return 0; |
1991 | } | 1991 | } |
1992 | 1992 | ||
diff --git a/drivers/media/pci/zoran/zoran_driver.c b/drivers/media/pci/zoran/zoran_driver.c index 9ecd7d711f27..53f12c7466b0 100644 --- a/drivers/media/pci/zoran/zoran_driver.c +++ b/drivers/media/pci/zoran/zoran_driver.c | |||
@@ -2598,7 +2598,7 @@ gcrop_unlock_and_return: | |||
2598 | return res; | 2598 | return res; |
2599 | } | 2599 | } |
2600 | 2600 | ||
2601 | static int zoran_s_crop(struct file *file, void *__fh, struct v4l2_crop *crop) | 2601 | static int zoran_s_crop(struct file *file, void *__fh, const struct v4l2_crop *crop) |
2602 | { | 2602 | { |
2603 | struct zoran_fh *fh = __fh; | 2603 | struct zoran_fh *fh = __fh; |
2604 | struct zoran *zr = fh->zr; | 2604 | struct zoran *zr = fh->zr; |
diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c index 9a05c817462c..e712d6734ac8 100644 --- a/drivers/media/platform/davinci/vpbe_display.c +++ b/drivers/media/platform/davinci/vpbe_display.c | |||
@@ -629,7 +629,7 @@ static int vpbe_display_querycap(struct file *file, void *priv, | |||
629 | } | 629 | } |
630 | 630 | ||
631 | static int vpbe_display_s_crop(struct file *file, void *priv, | 631 | static int vpbe_display_s_crop(struct file *file, void *priv, |
632 | struct v4l2_crop *crop) | 632 | const struct v4l2_crop *crop) |
633 | { | 633 | { |
634 | struct vpbe_fh *fh = file->private_data; | 634 | struct vpbe_fh *fh = file->private_data; |
635 | struct vpbe_layer *layer = fh->layer; | 635 | struct vpbe_layer *layer = fh->layer; |
diff --git a/drivers/media/platform/davinci/vpfe_capture.c b/drivers/media/platform/davinci/vpfe_capture.c index f99198cebd35..48052cbffc2b 100644 --- a/drivers/media/platform/davinci/vpfe_capture.c +++ b/drivers/media/platform/davinci/vpfe_capture.c | |||
@@ -1666,7 +1666,7 @@ static int vpfe_g_crop(struct file *file, void *priv, | |||
1666 | } | 1666 | } |
1667 | 1667 | ||
1668 | static int vpfe_s_crop(struct file *file, void *priv, | 1668 | static int vpfe_s_crop(struct file *file, void *priv, |
1669 | struct v4l2_crop *crop) | 1669 | const struct v4l2_crop *crop) |
1670 | { | 1670 | { |
1671 | struct vpfe_device *vpfe_dev = video_drvdata(file); | 1671 | struct vpfe_device *vpfe_dev = video_drvdata(file); |
1672 | int ret = 0; | 1672 | int ret = 0; |
diff --git a/drivers/media/platform/omap/omap_vout.c b/drivers/media/platform/omap/omap_vout.c index 92845f835607..36c3be85649d 100644 --- a/drivers/media/platform/omap/omap_vout.c +++ b/drivers/media/platform/omap/omap_vout.c | |||
@@ -1291,7 +1291,7 @@ static int vidioc_g_crop(struct file *file, void *fh, struct v4l2_crop *crop) | |||
1291 | return 0; | 1291 | return 0; |
1292 | } | 1292 | } |
1293 | 1293 | ||
1294 | static int vidioc_s_crop(struct file *file, void *fh, struct v4l2_crop *crop) | 1294 | static int vidioc_s_crop(struct file *file, void *fh, const struct v4l2_crop *crop) |
1295 | { | 1295 | { |
1296 | int ret = -EINVAL; | 1296 | int ret = -EINVAL; |
1297 | struct omap_vout_device *vout = fh; | 1297 | struct omap_vout_device *vout = fh; |
diff --git a/drivers/media/platform/s5p-fimc/fimc-m2m.c b/drivers/media/platform/s5p-fimc/fimc-m2m.c index ab4c15acdc4c..c67e53bfa43a 100644 --- a/drivers/media/platform/s5p-fimc/fimc-m2m.c +++ b/drivers/media/platform/s5p-fimc/fimc-m2m.c | |||
@@ -551,7 +551,7 @@ static int fimc_m2m_try_crop(struct fimc_ctx *ctx, struct v4l2_crop *cr) | |||
551 | return 0; | 551 | return 0; |
552 | } | 552 | } |
553 | 553 | ||
554 | static int fimc_m2m_s_crop(struct file *file, void *fh, struct v4l2_crop *cr) | 554 | static int fimc_m2m_s_crop(struct file *file, void *fh, const struct v4l2_crop *cr) |
555 | { | 555 | { |
556 | struct fimc_ctx *ctx = fh_to_ctx(fh); | 556 | struct fimc_ctx *ctx = fh_to_ctx(fh); |
557 | struct fimc_dev *fimc = ctx->fimc_dev; | 557 | struct fimc_dev *fimc = ctx->fimc_dev; |
diff --git a/drivers/media/platform/s5p-g2d/g2d.c b/drivers/media/platform/s5p-g2d/g2d.c index 30195ef5a803..69c9f22ee52a 100644 --- a/drivers/media/platform/s5p-g2d/g2d.c +++ b/drivers/media/platform/s5p-g2d/g2d.c | |||
@@ -526,7 +526,7 @@ static int vidioc_try_crop(struct file *file, void *prv, struct v4l2_crop *cr) | |||
526 | return 0; | 526 | return 0; |
527 | } | 527 | } |
528 | 528 | ||
529 | static int vidioc_s_crop(struct file *file, void *prv, struct v4l2_crop *cr) | 529 | static int vidioc_s_crop(struct file *file, void *prv, const struct v4l2_crop *cr) |
530 | { | 530 | { |
531 | struct g2d_ctx *ctx = prv; | 531 | struct g2d_ctx *ctx = prv; |
532 | struct g2d_frame *f; | 532 | struct g2d_frame *f; |
diff --git a/drivers/media/platform/sh_vou.c b/drivers/media/platform/sh_vou.c index 9f62fd89ab57..00cd52c61fe0 100644 --- a/drivers/media/platform/sh_vou.c +++ b/drivers/media/platform/sh_vou.c | |||
@@ -933,7 +933,7 @@ static int sh_vou_g_crop(struct file *file, void *fh, struct v4l2_crop *a) | |||
933 | } | 933 | } |
934 | 934 | ||
935 | /* Assume a dull encoder, do all the work ourselves. */ | 935 | /* Assume a dull encoder, do all the work ourselves. */ |
936 | static int sh_vou_s_crop(struct file *file, void *fh, struct v4l2_crop *a) | 936 | static int sh_vou_s_crop(struct file *file, void *fh, const struct v4l2_crop *a) |
937 | { | 937 | { |
938 | struct video_device *vdev = video_devdata(file); | 938 | struct video_device *vdev = video_devdata(file); |
939 | struct sh_vou_device *vou_dev = video_get_drvdata(vdev); | 939 | struct sh_vou_device *vou_dev = video_get_drvdata(vdev); |
diff --git a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c index 0baaf94db7e0..0a24253dcda2 100644 --- a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c +++ b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c | |||
@@ -1263,7 +1263,7 @@ static void update_subrect(struct sh_mobile_ceu_cam *cam) | |||
1263 | * 3. if (2) failed, try to request the maximum image | 1263 | * 3. if (2) failed, try to request the maximum image |
1264 | */ | 1264 | */ |
1265 | static int client_s_crop(struct soc_camera_device *icd, struct v4l2_crop *crop, | 1265 | static int client_s_crop(struct soc_camera_device *icd, struct v4l2_crop *crop, |
1266 | struct v4l2_crop *cam_crop) | 1266 | const struct v4l2_crop *cam_crop) |
1267 | { | 1267 | { |
1268 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 1268 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
1269 | struct v4l2_rect *rect = &crop->c, *cam_rect = &cam_crop->c; | 1269 | struct v4l2_rect *rect = &crop->c, *cam_rect = &cam_crop->c; |
@@ -1517,7 +1517,7 @@ static int client_scale(struct soc_camera_device *icd, | |||
1517 | * scaling and cropping algorithms and for the meaning of referenced here steps. | 1517 | * scaling and cropping algorithms and for the meaning of referenced here steps. |
1518 | */ | 1518 | */ |
1519 | static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd, | 1519 | static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd, |
1520 | struct v4l2_crop *a) | 1520 | const struct v4l2_crop *a) |
1521 | { | 1521 | { |
1522 | struct v4l2_rect *rect = &a->c; | 1522 | struct v4l2_rect *rect = &a->c; |
1523 | struct device *dev = icd->parent; | 1523 | struct device *dev = icd->parent; |
diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index 10b57f8e7ec8..f6b1c1f87761 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c | |||
@@ -888,11 +888,11 @@ static int soc_camera_g_crop(struct file *file, void *fh, | |||
888 | * retrieve it. | 888 | * retrieve it. |
889 | */ | 889 | */ |
890 | static int soc_camera_s_crop(struct file *file, void *fh, | 890 | static int soc_camera_s_crop(struct file *file, void *fh, |
891 | struct v4l2_crop *a) | 891 | const struct v4l2_crop *a) |
892 | { | 892 | { |
893 | struct soc_camera_device *icd = file->private_data; | 893 | struct soc_camera_device *icd = file->private_data; |
894 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); | 894 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
895 | struct v4l2_rect *rect = &a->c; | 895 | const struct v4l2_rect *rect = &a->c; |
896 | struct v4l2_crop current_crop; | 896 | struct v4l2_crop current_crop; |
897 | int ret; | 897 | int ret; |
898 | 898 | ||
@@ -1289,7 +1289,7 @@ static int default_g_crop(struct soc_camera_device *icd, struct v4l2_crop *a) | |||
1289 | return v4l2_subdev_call(sd, video, g_crop, a); | 1289 | return v4l2_subdev_call(sd, video, g_crop, a); |
1290 | } | 1290 | } |
1291 | 1291 | ||
1292 | static int default_s_crop(struct soc_camera_device *icd, struct v4l2_crop *a) | 1292 | static int default_s_crop(struct soc_camera_device *icd, const struct v4l2_crop *a) |
1293 | { | 1293 | { |
1294 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 1294 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
1295 | return v4l2_subdev_call(sd, video, s_crop, a); | 1295 | return v4l2_subdev_call(sd, video, s_crop, a); |
diff --git a/drivers/media/platform/vino.c b/drivers/media/platform/vino.c index aae1720b2f2d..790d96cffeea 100644 --- a/drivers/media/platform/vino.c +++ b/drivers/media/platform/vino.c | |||
@@ -3284,7 +3284,7 @@ static int vino_g_crop(struct file *file, void *__fh, | |||
3284 | } | 3284 | } |
3285 | 3285 | ||
3286 | static int vino_s_crop(struct file *file, void *__fh, | 3286 | static int vino_s_crop(struct file *file, void *__fh, |
3287 | struct v4l2_crop *c) | 3287 | const struct v4l2_crop *c) |
3288 | { | 3288 | { |
3289 | struct vino_channel_settings *vcs = video_drvdata(file); | 3289 | struct vino_channel_settings *vcs = video_drvdata(file); |
3290 | unsigned long flags; | 3290 | unsigned long flags; |
diff --git a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c index 7a445b0e725e..db249cad3cd9 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | |||
@@ -760,7 +760,7 @@ static int pvr2_g_crop(struct file *file, void *priv, struct v4l2_crop *crop) | |||
760 | return 0; | 760 | return 0; |
761 | } | 761 | } |
762 | 762 | ||
763 | static int pvr2_s_crop(struct file *file, void *priv, struct v4l2_crop *crop) | 763 | static int pvr2_s_crop(struct file *file, void *priv, const struct v4l2_crop *crop) |
764 | { | 764 | { |
765 | struct pvr2_v4l2_fh *fh = file->private_data; | 765 | struct pvr2_v4l2_fh *fh = file->private_data; |
766 | struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; | 766 | struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; |