mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Ricardo Ribalda <ribalda@chromium.org>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.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: Mon, 9 Dec 2024 16:24:50 +0100	[thread overview]
Message-ID: <dfbbb4a1-2575-42a4-a1f9-c279fc17d9c4@redhat.com> (raw)
In-Reply-To: <CANiDSCuPM1qeerMUBFx+RfqBD35CcfhQeO5hYVHh-ZeQ-4t9Sw@mail.gmail.com>

Hi,

On 9-Dec-24 12:31 PM, Ricardo Ribalda wrote:
> Hi Hans
> 
> On Mon, 9 Dec 2024 at 12:03, Hans de Goede <hdegoede@redhat.com> wrote:
>>
>> Hi Ricardo,
>>
>> On 3-Dec-24 10:20 PM, 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>
>>
>> Thank you for your patch.
>>
>> It seems that you have missed Laurent's reply asking to improve the commit message:
>>
>> "Conceptually this change looks fine, but the commit message needs to
>> explain why this is safe to do without protecting ctrl->loaded with a
>> lock."
>>
>> https://lore.kernel.org/linux-media/20241203203748.GD5196@pendragon.ideasonboard.com/
>>
>> Or maybe the posting of this v6 and that reply have crossed each other.
> 
> In this v6 I moved loaded=0 from uvc_ctrl_status_event_async() to
> uvc_ctrl_status_event()

Ah I missed that you moved it, my bad.

> Now setting loaded=0 is just after mutex_lock(&chain->ctrl_mutex);
> 
> Do we need a new version?

Since the setting is now clearly done under the lock the new version seems
good to me as is.

So I have now merged this into:

https://gitlab.freedesktop.org/linux-media/users/uvc/-/commits/next/

Regards,

Hans

> 
>>
>> Either way please post a new version addressing this comment.
>>
>> Thanks & Regards,
>>
>> Hans
>>
>>
>>
>>> ---
>>>  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;
>>> +
>>>       handle = ctrl->handle;
>>>       if (handle)
>>>               uvc_ctrl_set_handle(handle, ctrl, NULL);
>>>
>>
> 
> 


  reply	other threads:[~2024-12-09 15:24 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 [this message]
2024-12-19  0:31   ` Laurent Pinchart
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=dfbbb4a1-2575-42a4-a1f9-c279fc17d9c4@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=guennadi.liakhovetski@intel.com \
    --cc=hverkuil@xs4all.nl \
    --cc=laurent.pinchart@ideasonboard.com \
    --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

all inboxes | Powered by JetHome®