diff mbox series

v4l2-ioctl: call v4l_pix_format_touch() for TRY_FMT

Message ID 95437142-2935-0d3f-073e-333dab4e17c0@xs4all.nl (mailing list archive)
State New, archived
Headers show
Series v4l2-ioctl: call v4l_pix_format_touch() for TRY_FMT | expand

Commit Message

Hans Verkuil June 26, 2019, 9:48 a.m. UTC
The function v4l_pix_format_touch() is called for S_FMT to set
v4l2_pix_format fields to default values for a v4l-touch device,
but it wasn't called for TRY_FMT. Add this.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---

Comments

Philipp Zabel June 26, 2019, 3:07 p.m. UTC | #1
On Wed, 2019-06-26 at 11:48 +0200, Hans Verkuil wrote:
> The function v4l_pix_format_touch() is called for S_FMT to set
> v4l2_pix_format fields to default values for a v4l-touch device,
> but it wasn't called for TRY_FMT. Add this.
> 
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> ---
> diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
> index b1f4b991dba6..c5c8c8ab7cf6 100644
> --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> @@ -1661,6 +1661,8 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops,
>  		ret = ops->vidioc_try_fmt_vid_cap(file, fh, arg);
>  		/* just in case the driver zeroed it again */
>  		p->fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC;
> +		if (vfd->vfl_type == VFL_TYPE_TOUCH)
> +			v4l_pix_format_touch(&p->fmt.pix);

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>

regards
Philipp
diff mbox series

Patch

diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index b1f4b991dba6..c5c8c8ab7cf6 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1661,6 +1661,8 @@  static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops,
 		ret = ops->vidioc_try_fmt_vid_cap(file, fh, arg);
 		/* just in case the driver zeroed it again */
 		p->fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC;
+		if (vfd->vfl_type == VFL_TYPE_TOUCH)
+			v4l_pix_format_touch(&p->fmt.pix);
 		return ret;
 	case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
 		if (unlikely(!ops->vidioc_try_fmt_vid_cap_mplane))