[media] media: davinci: vpfe: fix build error
recent patch with commit id 4f996594ce
which makes vidioc_s_crop const, was causing a following build error.
vpfe_capture.c: In function 'vpfe_s_crop':
vpfe_capture.c:1695: error: assignment of read-only location '*crop'
vpfe_capture.c:1706: warning: passing argument 1 of
'ccdc_dev->hw_ops.set_image_window' discards qualifiers from pointer target type
vpfe_capture.c:1706: note: expected 'struct v4l2_rect *' but argument is of
type 'const struct v4l2_rect *'
make[4]: *** [drivers/media/platform/davinci/vpfe_capture.o] Error 1
Signed-off-by: Lad, Prabhakar <prabhakar.lad@ti.com>
Signed-off-by: Manjunath Hadli <manjunath.hadli@ti.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
2425bb3d40
commit
8b6faacd75
|
@ -1669,6 +1669,7 @@ static int vpfe_s_crop(struct file *file, void *priv,
|
|||
const struct v4l2_crop *crop)
|
||||
{
|
||||
struct vpfe_device *vpfe_dev = video_drvdata(file);
|
||||
struct v4l2_rect rect = crop->c;
|
||||
int ret = 0;
|
||||
|
||||
v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_s_crop\n");
|
||||
|
@ -1684,7 +1685,7 @@ static int vpfe_s_crop(struct file *file, void *priv,
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (crop->c.top < 0 || crop->c.left < 0) {
|
||||
if (rect.top < 0 || rect.left < 0) {
|
||||
v4l2_err(&vpfe_dev->v4l2_dev,
|
||||
"doesn't support negative values for top & left\n");
|
||||
ret = -EINVAL;
|
||||
|
@ -1692,26 +1693,26 @@ static int vpfe_s_crop(struct file *file, void *priv,
|
|||
}
|
||||
|
||||
/* adjust the width to 16 pixel boundary */
|
||||
crop->c.width = ((crop->c.width + 15) & ~0xf);
|
||||
rect.width = ((rect.width + 15) & ~0xf);
|
||||
|
||||
/* make sure parameters are valid */
|
||||
if ((crop->c.left + crop->c.width >
|
||||
if ((rect.left + rect.width >
|
||||
vpfe_dev->std_info.active_pixels) ||
|
||||
(crop->c.top + crop->c.height >
|
||||
(rect.top + rect.height >
|
||||
vpfe_dev->std_info.active_lines)) {
|
||||
v4l2_err(&vpfe_dev->v4l2_dev, "Error in S_CROP params\n");
|
||||
ret = -EINVAL;
|
||||
goto unlock_out;
|
||||
}
|
||||
ccdc_dev->hw_ops.set_image_window(&crop->c);
|
||||
vpfe_dev->fmt.fmt.pix.width = crop->c.width;
|
||||
vpfe_dev->fmt.fmt.pix.height = crop->c.height;
|
||||
ccdc_dev->hw_ops.set_image_window(&rect);
|
||||
vpfe_dev->fmt.fmt.pix.width = rect.width;
|
||||
vpfe_dev->fmt.fmt.pix.height = rect.height;
|
||||
vpfe_dev->fmt.fmt.pix.bytesperline =
|
||||
ccdc_dev->hw_ops.get_line_length();
|
||||
vpfe_dev->fmt.fmt.pix.sizeimage =
|
||||
vpfe_dev->fmt.fmt.pix.bytesperline *
|
||||
vpfe_dev->fmt.fmt.pix.height;
|
||||
vpfe_dev->crop = crop->c;
|
||||
vpfe_dev->crop = rect;
|
||||
unlock_out:
|
||||
mutex_unlock(&vpfe_dev->lock);
|
||||
return ret;
|
||||
|
|
Loading…
Reference in a new issue