From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Ricardo Ribalda <ribalda@chromium.org>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
pmenzel@molgen.mpg.de, stable@vger.kernel.org
Subject: Re: [PATCH] media: uvcvideo: Fix custom control mapping probing
Date: Mon, 22 Jul 2024 14:38:36 +0300 [thread overview]
Message-ID: <20240722113836.GE13497@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20240722-fix-filter-mapping-v1-1-07cc9c6bf4e3@chromium.org>
Hi Ricardo,
Thank you for the patch.
On Mon, Jul 22, 2024 at 07:59:43AM +0000, Ricardo Ribalda wrote:
> Custom control mapping introduced a bug, where the filter function was
> applied to every single control.
>
> Fix it so it is only applied to the matching controls.
>
> Reported-by: Paul Menzen <pmenzel@molgen.mpg.de>
> Closes: https://lore.kernel.org/linux-media/518cd6b4-68a8-4895-b8fc-97d4dae1ddc4@molgen.mpg.de/T/#t
> Cc: stable@vger.kernel.org
> Fixes: 8f4362a8d42b ("media: uvcvideo: Allow custom control mapping")
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
> Paul, could you check if this fixes your issue, thanks!
> ---
> drivers/media/usb/uvc/uvc_ctrl.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
> index 0136df5732ba..06fede57bf36 100644
> --- a/drivers/media/usb/uvc/uvc_ctrl.c
> +++ b/drivers/media/usb/uvc/uvc_ctrl.c
> @@ -2680,6 +2680,10 @@ static void uvc_ctrl_init_ctrl(struct uvc_video_chain *chain,
> for (i = 0; i < ARRAY_SIZE(uvc_ctrl_mappings); ++i) {
> const struct uvc_control_mapping *mapping = &uvc_ctrl_mappings[i];
>
> + if (!(uvc_entity_match_guid(ctrl->entity, mapping->entity) &&
> + ctrl->info.selector == mapping->selector))
> + continue;
I have a slight preference for
if (!uvc_entity_match_guid(ctrl->entity, mapping->entity) ||
ctrl->info.selector != mapping->selector)
continue;
If that's fine with you, I can handle that when applying the patch.
This change means that the entity and selector test will use the
original mapping, not the mapping returned by the filtering function. I
think that's fine, both mappings should have the same entity and
selector, only the menu mask is meant to change.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> +
> /* Let the device provide a custom mapping. */
> if (mapping->filter_mapping) {
> mapping = mapping->filter_mapping(chain, ctrl);
> @@ -2687,9 +2691,7 @@ static void uvc_ctrl_init_ctrl(struct uvc_video_chain *chain,
> continue;
> }
>
> - if (uvc_entity_match_guid(ctrl->entity, mapping->entity) &&
> - ctrl->info.selector == mapping->selector)
> - __uvc_ctrl_add_mapping(chain, ctrl, mapping);
> + __uvc_ctrl_add_mapping(chain, ctrl, mapping);
> }
> }
>
>
> ---
> base-commit: 68a72104cbcf38ad16500216e213fa4eb21c4be2
> change-id: 20240722-fix-filter-mapping-18477dc69048
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2024-07-22 11:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-22 7:59 [PATCH] media: uvcvideo: Fix custom control mapping probing Ricardo Ribalda
2024-07-22 9:35 ` Paul Menzel
2024-07-22 11:38 ` Laurent Pinchart [this message]
2024-07-22 11:41 ` Ricardo Ribalda
2024-07-22 11:43 ` Laurent Pinchart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240722113836.GE13497@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=pmenzel@molgen.mpg.de \
--cc=ribalda@chromium.org \
--cc=senozhatsky@chromium.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.