[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>
This commit is contained in:
Hans Verkuil
2012-09-05 05:10:48 -03:00
committed by Mauro Carvalho Chehab
parent 3f70e1f598
commit 4f996594ce
30 changed files with 78 additions and 78 deletions

View File

@@ -171,7 +171,7 @@ static int mt9m001_s_stream(struct v4l2_subdev *sd, int enable)
return 0;
}
static int mt9m001_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
static int mt9m001_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct mt9m001 *mt9m001 = to_mt9m001(client);

View File

@@ -383,7 +383,7 @@ static int mt9m111_reset(struct mt9m111 *mt9m111)
return ret;
}
static int mt9m111_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
static int mt9m111_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a)
{
struct v4l2_rect rect = a->c;
struct mt9m111 *mt9m111 = container_of(sd, struct mt9m111, subdev);

View File

@@ -294,7 +294,7 @@ static int mt9t031_set_params(struct i2c_client *client,
return ret < 0 ? ret : 0;
}
static int mt9t031_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
static int mt9t031_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a)
{
struct v4l2_rect rect = a->c;
struct i2c_client *client = v4l2_get_subdevdata(sd);

View File

@@ -907,11 +907,11 @@ static int mt9t112_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
return 0;
}
static int mt9t112_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
static int mt9t112_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct mt9t112_priv *priv = to_mt9t112(client);
struct v4l2_rect *rect = &a->c;
const struct v4l2_rect *rect = &a->c;
return mt9t112_set_params(priv, rect, priv->format->code);
}

View File

@@ -237,7 +237,7 @@ static int mt9v022_s_stream(struct v4l2_subdev *sd, int enable)
return 0;
}
static int mt9v022_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
static int mt9v022_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct mt9v022 *mt9v022 = to_mt9v022(client);

View File

@@ -865,24 +865,24 @@ static int ov5642_g_chip_ident(struct v4l2_subdev *sd,
return 0;
}
static int ov5642_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
static int ov5642_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct ov5642 *priv = to_ov5642(client);
struct v4l2_rect *rect = &a->c;
struct v4l2_rect rect = a->c;
int ret;
v4l_bound_align_image(&rect->width, 48, OV5642_MAX_WIDTH, 1,
&rect->height, 32, OV5642_MAX_HEIGHT, 1, 0);
v4l_bound_align_image(&rect.width, 48, OV5642_MAX_WIDTH, 1,
&rect.height, 32, OV5642_MAX_HEIGHT, 1, 0);
priv->crop_rect.width = rect->width;
priv->crop_rect.height = rect->height;
priv->total_width = rect->width + BLANKING_EXTRA_WIDTH;
priv->total_height = max_t(int, rect->height +
priv->crop_rect.width = rect.width;
priv->crop_rect.height = rect.height;
priv->total_width = rect.width + BLANKING_EXTRA_WIDTH;
priv->total_height = max_t(int, rect.height +
BLANKING_EXTRA_HEIGHT,
BLANKING_MIN_HEIGHT);
priv->crop_rect.width = rect->width;
priv->crop_rect.height = rect->height;
priv->crop_rect.width = rect.width;
priv->crop_rect.height = rect.height;
ret = ov5642_write_array(client, ov5642_default_regs_init);
if (!ret)

View File

@@ -451,42 +451,42 @@ static int ov6650_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
return 0;
}
static int ov6650_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
static int ov6650_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct ov6650 *priv = to_ov6650(client);
struct v4l2_rect *rect = &a->c;
struct v4l2_rect rect = a->c;
int ret;
if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;
rect->left = ALIGN(rect->left, 2);
rect->width = ALIGN(rect->width, 2);
rect->top = ALIGN(rect->top, 2);
rect->height = ALIGN(rect->height, 2);
soc_camera_limit_side(&rect->left, &rect->width,
rect.left = ALIGN(rect.left, 2);
rect.width = ALIGN(rect.width, 2);
rect.top = ALIGN(rect.top, 2);
rect.height = ALIGN(rect.height, 2);
soc_camera_limit_side(&rect.left, &rect.width,
DEF_HSTRT << 1, 2, W_CIF);
soc_camera_limit_side(&rect->top, &rect->height,
soc_camera_limit_side(&rect.top, &rect.height,
DEF_VSTRT << 1, 2, H_CIF);
ret = ov6650_reg_write(client, REG_HSTRT, rect->left >> 1);
ret = ov6650_reg_write(client, REG_HSTRT, rect.left >> 1);
if (!ret) {
priv->rect.left = rect->left;
priv->rect.left = rect.left;
ret = ov6650_reg_write(client, REG_HSTOP,
(rect->left + rect->width) >> 1);
(rect.left + rect.width) >> 1);
}
if (!ret) {
priv->rect.width = rect->width;
ret = ov6650_reg_write(client, REG_VSTRT, rect->top >> 1);
priv->rect.width = rect.width;
ret = ov6650_reg_write(client, REG_VSTRT, rect.top >> 1);
}
if (!ret) {
priv->rect.top = rect->top;
priv->rect.top = rect.top;
ret = ov6650_reg_write(client, REG_VSTOP,
(rect->top + rect->height) >> 1);
(rect.top + rect.height) >> 1);
}
if (!ret)
priv->rect.height = rect->height;
priv->rect.height = rect.height;
return ret;
}

View File

@@ -536,11 +536,11 @@ static int rj54n1_commit(struct i2c_client *client)
static int rj54n1_sensor_scale(struct v4l2_subdev *sd, s32 *in_w, s32 *in_h,
s32 *out_w, s32 *out_h);
static int rj54n1_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
static int rj54n1_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct rj54n1 *rj54n1 = to_rj54n1(client);
struct v4l2_rect *rect = &a->c;
const struct v4l2_rect *rect = &a->c;
int dummy = 0, output_w, output_h,
input_w = rect->width, input_h = rect->height;
int ret;

View File

@@ -865,7 +865,7 @@ static int tvp5150_mbus_fmt(struct v4l2_subdev *sd,
return 0;
}
static int tvp5150_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
static int tvp5150_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a)
{
struct v4l2_rect rect = a->c;
struct tvp5150 *decoder = to_tvp5150(sd);