Re: [PATCH v2 9/9] media: uvcvideo: Support granular power saving for compat syscalls

From: Hans de Goede
Date: Mon Jun 16 2025 - 10:17:18 EST


Hi Ricardo,

On 2-Jun-25 15:06, Ricardo Ribalda wrote:
> Right now we cannot support granular power saving on compat syscalls
> because the VIDIOC_*32 NRs defines are not accessible to drivers.
>
> Use the v4l2_compat_translate_cmd helper to convert the compat syscall
> NRs into syscall NRs.
>
> Signed-off-by: Ricardo Ribalda <ribalda@xxxxxxxxxxxx>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <hansg@xxxxxxxxxx>

Regards,

Hans


> ---
> drivers/media/usb/uvc/uvc_v4l2.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
> index 13388879091c46ff74582226146521b5b5eb3d10..8358ca54b248dd1cf7c984b206b8e550cd883e54 100644
> --- a/drivers/media/usb/uvc/uvc_v4l2.c
> +++ b/drivers/media/usb/uvc/uvc_v4l2.c
> @@ -1237,15 +1237,13 @@ static long uvc_v4l2_pm_ioctl(struct file *file,
> static long uvc_v4l2_unlocked_ioctl(struct file *file,
> unsigned int cmd, unsigned long arg)
> {
> - /*
> - * For now, we do not support granular power saving for compat
> - * syscalls.
> - */
> + unsigned int converted_cmd = cmd;
> +
> if (in_compat_syscall())
> - return uvc_v4l2_pm_ioctl(file, cmd, arg);
> + converted_cmd = v4l2_compat_translate_cmd(cmd);
>
> /* The following IOCTLs do need to turn on the camera. */
> - switch (cmd) {
> + switch (converted_cmd) {
> case UVCIOC_CTRL_QUERY:
> case VIDIOC_G_CTRL:
> case VIDIOC_G_EXT_CTRLS:
>