提交 8b6faacd 编写于 作者: L Lad, Prabhakar 提交者: Mauro Carvalho Chehab

[media] media: davinci: vpfe: fix build error

recent patch with commit id 4f996594
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: NLad, Prabhakar <prabhakar.lad@ti.com>
Signed-off-by: NManjunath Hadli <manjunath.hadli@ti.com>
Acked-by: NHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 2425bb3d
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册