From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Paul Elder <paul.elder@ideasonboard.com>
Cc: linux-usb@vger.kernel.org, balbi@kernel.org,
gregkh@linuxfoundation.org, rogerq@ti.com
Subject: [v2,3/3] usb: gadget: uvc: disable stream when disconnected
Date: Mon, 21 May 2018 11:10:11 +0300 [thread overview]
Message-ID: <1661250.8mprDtplys@avalon> (raw)
Hi Paul,
Thank you for the patch.
On Tuesday, 24 April 2018 23:59:36 EEST Paul Elder wrote:
> Down the call stack from the ioctl handler for VIDIOC_STREAMON,
> uvc_video_alloc_requests contains a BUG_ON, which in the high level,
> triggers when VIDIOC_STREAMON ioctl is issued without VIDIOC_STREAMOFF
> being issued previously.
>
> This can also be triggered by starting the stream and then physically
> disconnecting usb. To fix this, do the streamoff procedures on usb
> disconnect.
>
> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> ---
> Changes in v2: Nothing
>
> drivers/usb/gadget/function/f_uvc.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/usb/gadget/function/f_uvc.c
> b/drivers/usb/gadget/function/f_uvc.c index fa34dcbe1197..5bb79888e3f7
> 100644
> --- a/drivers/usb/gadget/function/f_uvc.c
> +++ b/drivers/usb/gadget/function/f_uvc.c
> @@ -374,9 +374,12 @@ uvc_function_disable(struct usb_function *f)
> {
> struct uvc_device *uvc = to_uvc(f);
> struct v4l2_event v4l2_event;
> + struct uvc_video *video = &uvc->video;
>
> INFO(f->config->cdev, "uvc_function_disable\n");
>
> + uvcg_video_enable(video, 0);
> +
As commented in my reply to patch 2/3, you will need to protect this with
proper locking. You now have at least four events dealing with states and
buffers allocation (VIDIOC_STREAMON, VIDIOC_STREAMOFF, uvc_function_set_alt
and uvc_function_disable).
> memset(&v4l2_event, 0, sizeof(v4l2_event));
> v4l2_event.type = UVC_EVENT_DISCONNECT;
> v4l2_event_queue(&uvc->vdev, &v4l2_event);
next reply other threads:[~2018-05-21 8:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-21 8:10 Laurent Pinchart [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-04-24 20:59 [v2,3/3] usb: gadget: uvc: disable stream when disconnected Paul Elder
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=1661250.8mprDtplys@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=balbi@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.org \
--cc=paul.elder@ideasonboard.com \
--cc=rogerq@ti.com \
/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.