From: Daniel Axtens <dja@axtens.net>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] [media] uvcvideo: Kill video URBs on disconnect
Date: Sun, 23 Apr 2017 10:40:12 +1000 [thread overview]
Message-ID: <87r30k7y8j.fsf@possimpible.ozlabs.ibm.com> (raw)
In-Reply-To: <9757129.ouSjzrobER@avalon>
Hi Laurent,
Apologies for takig so long to get back to you.
> I assume that the error message is caused by a race between disconnection and
> URB handling. When the device is disconnected I believe the USB core will
> cancel all in-progress URBs (I'm not very familiar with that part of the USB
> core anymore, so please don't consider this or any further related statement
> as true without double-checking), resulting in the URB completion handler
> being called with an error status. The completion handler should then avoid
> resubmitting the URB. However, if the completion handler is in progress when
> the device is disconnected, it won't notice that the device got disconnected,
> and will try to resubmit the URB.
>
> I'm not sure to see how this patch will fix the problem. If the URB completion
> handler is in progress when the device is being disconnected, won't it call
> usb_submit_urb() regardless of whether you call usb_kill_urb() in the
> disconnect handler, resulting in an error message being printed ?
You're completely right - I misunderstood the flow of the
function. Fixing this would require a different approach and would be
more invasive. Given that this does not cause anything more annoying
than some log messages, I will leave it for now.
Regards,
Daniel
>
>> ---
>> drivers/media/usb/uvc/uvc_driver.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/media/usb/uvc/uvc_driver.c
>> b/drivers/media/usb/uvc/uvc_driver.c index 2390592f78e0..647e3d8a1256
>> 100644
>> --- a/drivers/media/usb/uvc/uvc_driver.c
>> +++ b/drivers/media/usb/uvc/uvc_driver.c
>> @@ -1877,6 +1877,8 @@ static void uvc_unregister_video(struct uvc_device
>> *dev) if (!video_is_registered(&stream->vdev))
>> continue;
>>
>> + uvc_video_enable(stream, 0);
>> +
>> video_unregister_device(&stream->vdev);
>>
>> uvc_debugfs_cleanup_stream(stream);
>
> --
> Regards,
>
> Laurent Pinchart
next prev parent reply other threads:[~2017-04-23 0:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-17 8:52 [PATCH 1/2] [media] uvcvideo: Refactor teardown of uvc on USB disconnect Daniel Axtens
2017-04-17 8:52 ` [PATCH 2/2] [media] uvcvideo: Kill video URBs on disconnect Daniel Axtens
2017-04-17 12:49 ` Laurent Pinchart
2017-04-23 0:40 ` Daniel Axtens [this message]
2017-04-17 12:23 ` [PATCH 1/2] [media] uvcvideo: Refactor teardown of uvc on USB disconnect Laurent Pinchart
2017-04-23 0:57 ` Daniel Axtens
2017-04-30 16:18 ` Greg KH
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=87r30k7y8j.fsf@possimpible.ozlabs.ibm.com \
--to=dja@axtens.net \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@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 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®