]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
usb: gadget: uvc: queue pump work in uvcg_video_enable()
authorXu Yang <xu.yang_2@nxp.com>
Wed, 14 Aug 2024 11:25:37 +0000 (19:25 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Aug 2024 09:28:39 +0000 (17:28 +0800)
Since commit "6acba0345b68 usb:gadget:uvc Do not use worker thread to pump
isoc usb requests", pump work could only be queued in uvc_video_complete()
and uvc_v4l2_qbuf(). If VIDIOC_QBUF is executed before VIDIOC_STREAMON,
we can only depend on uvc_video_complete() to queue pump work. However,
this requires some free requests in req_ready list. If req_ready list is
empty all the time, pump work will never be queued and video datas will
never be pumped to usb controller. Actually, this situation could happen
when run uvc-gadget with static image:

$ ./uvc-gadget -i 1080p.jpg uvc.0

When capture image from this device, the user app will always block there.

The issue is uvc driver has queued video buffer before streamon, but the
req_ready list is empty all the time after streamon. This will queue pump
work in uvcg_video_enable() to fill some request to req_ready list so the
uvc device could work properly.

Fixes: 6acba0345b68 ("usb:gadget:uvc Do not use worker thread to pump isoc usb requests")
Cc: stable@vger.kernel.org
Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
Link: https://lore.kernel.org/r/20240814112537.2608949-1-xu.yang_2@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/uvc_video.c

index d41f5f31dadd583e44a7823a7a89e5b4dafcb78f..a9edd60fbbf779706f72bd6ff3f48cd66b9bedcf 100644 (file)
@@ -753,6 +753,7 @@ int uvcg_video_enable(struct uvc_video *video)
        video->req_int_count = 0;
 
        uvc_video_ep_queue_initial_requests(video);
+       queue_work(video->async_wq, &video->pump);
 
        return ret;
 }