From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Ricardo Ribalda <ribalda@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Guennadi Liakhovetski <guennadi.liakhovetski@intel.com>,
Hans Verkuil <hverkuil@xs4all.nl>,
Mauro Carvalho Chehab <mchehab+samsung@kernel.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 5/5] media: uvcvideo: Flush the control cache when we get an event
Date: Thu, 19 Dec 2024 02:31:30 +0200 [thread overview]
Message-ID: <20241219003130.GJ5518@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20241203-uvc-fix-async-v6-5-26c867231118@chromium.org>
Hi Ricardo,
Thank you for the patch.
On Tue, Dec 03, 2024 at 09:20:12PM +0000, Ricardo Ribalda wrote:
> Asynchronous controls trigger an event when they have completed their
> operation.
>
> This can make that the control cached value does not match the value in
> the device.
>
> Let's flush the cache to be on the safe side.
>
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
> drivers/media/usb/uvc/uvc_ctrl.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
> index 3dc9b7a49f64..db29e0e8bfd4 100644
> --- a/drivers/media/usb/uvc/uvc_ctrl.c
> +++ b/drivers/media/usb/uvc/uvc_ctrl.c
> @@ -1622,6 +1622,9 @@ void uvc_ctrl_status_event(struct uvc_video_chain *chain,
>
> mutex_lock(&chain->ctrl_mutex);
>
> + /* Flush the control cache, the data might have changed. */
> + ctrl->loaded = 0;
> +
That's better, covered by ctrl_mutex. There are however quite a few code
paths through which ctrl->loaded is accessed without holding the mutex
:-( Not a candidate for this series, but this should eventually be
fixed.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> handle = ctrl->handle;
> if (handle)
> uvc_ctrl_set_handle(handle, ctrl, NULL);
>
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2024-12-19 0:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-03 21:20 [PATCH v6 0/5] media: uvcvideo: Two +1 fixes for async controls Ricardo Ribalda
2024-12-03 21:20 ` [PATCH v6 1/5] media: uvcvideo: Only save async fh if success Ricardo Ribalda
2024-12-03 21:20 ` [PATCH v6 2/5] media: uvcvideo: Remove redundant NULL assignment Ricardo Ribalda
2024-12-03 21:20 ` [PATCH v6 3/5] media: uvcvideo: Remove dangling pointers Ricardo Ribalda
2024-12-04 0:10 ` Ricardo Ribalda
2024-12-19 0:19 ` Laurent Pinchart
2024-12-03 21:20 ` [PATCH v6 4/5] media: uvcvideo: Annotate lock requirements for uvc_ctrl_set Ricardo Ribalda
2024-12-03 21:20 ` [PATCH v6 5/5] media: uvcvideo: Flush the control cache when we get an event Ricardo Ribalda
2024-12-09 11:03 ` Hans de Goede
2024-12-09 11:31 ` Ricardo Ribalda
2024-12-09 15:24 ` Hans de Goede
2024-12-19 0:31 ` Laurent Pinchart [this message]
2024-12-09 11:01 ` [PATCH v6 0/5] media: uvcvideo: Two +1 fixes for async controls Hans de Goede
2024-12-19 0:37 ` Laurent Pinchart
2024-12-19 9:27 ` Hans de Goede
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=20241219003130.GJ5518@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=guennadi.liakhovetski@intel.com \
--cc=hdegoede@redhat.com \
--cc=hverkuil@xs4all.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab+samsung@kernel.org \
--cc=mchehab@kernel.org \
--cc=ribalda@chromium.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox