[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250630221439.GB15184@pendragon.ideasonboard.com>
Date: Tue, 1 Jul 2025 01:14:39 +0300
From: Laurent Pinchart <laurent.pinchart@...asonboard.com>
To: Ricardo Ribalda <ribalda@...omium.org>
Cc: Mauro Carvalho Chehab <mchehab@...nel.org>,
Hans Verkuil <hverkuil@...all.nl>, Hans de Goede <hansg@...nel.org>,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 6/8] media: uvcvideo: Do not enable camera during
UVCIOC_CTRL_MAP*
Hi Ricardo,
Thank you for the patch.
On Mon, Jun 30, 2025 at 02:20:31PM +0000, Ricardo Ribalda wrote:
> The device does not need to be enabled to do this, it is merely an
> internal data operation.
How about the following code path ?
uvc_ioctl_xu_ctrl_map()
uvc_ctrl_add_mapping()
uvc_ctrl_init_xu_ctrl()
uvc_ctrl_fill_xu_info()
uvc_query_ctrl()
?
> Reviewed-by: Hans de Goede <hansg@...nel.org>
> Signed-off-by: Ricardo Ribalda <ribalda@...omium.org>
> ---
> drivers/media/usb/uvc/uvc_v4l2.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
> index 7ab1bdcfb493fe9f47dbdc86da23cba98d7d10ff..350cd2cc88f872d2e8bd19e2b8fb067894916364 100644
> --- a/drivers/media/usb/uvc/uvc_v4l2.c
> +++ b/drivers/media/usb/uvc/uvc_v4l2.c
> @@ -1178,10 +1178,6 @@ static long uvc_v4l2_compat_ioctl32(struct file *file,
> void __user *up = compat_ptr(arg);
> long ret;
>
> - ret = uvc_pm_get(handle->stream->dev);
> - if (ret)
> - return ret;
> -
> switch (cmd) {
> case UVCIOC_CTRL_MAP32:
> ret = uvc_v4l2_get_xu_mapping(&karg.xmap, up);
> @@ -1197,9 +1193,15 @@ static long uvc_v4l2_compat_ioctl32(struct file *file,
>
> case UVCIOC_CTRL_QUERY32:
> ret = uvc_v4l2_get_xu_query(&karg.xqry, up);
> + if (ret)
> + break;
> +
> + ret = uvc_pm_get(handle->stream->dev);
> if (ret)
> break;
> ret = uvc_xu_ctrl_query(handle->chain, &karg.xqry);
> + uvc_pm_put(handle->stream->dev);
> +
> if (ret)
> break;
> ret = uvc_v4l2_put_xu_query(&karg.xqry, up);
> @@ -1212,8 +1214,6 @@ static long uvc_v4l2_compat_ioctl32(struct file *file,
> break;
> }
>
> - uvc_pm_put(handle->stream->dev);
> -
> return ret;
> }
> #endif
> @@ -1226,6 +1226,7 @@ static long uvc_v4l2_unlocked_ioctl(struct file *file,
>
> /* The following IOCTLs do not need to turn on the camera. */
> switch (cmd) {
> + case UVCIOC_CTRL_MAP:
> case VIDIOC_CREATE_BUFS:
> case VIDIOC_DQBUF:
> case VIDIOC_ENUM_FMT:
--
Regards,
Laurent Pinchart
Powered by blists - more mailing lists