Commit e0fa80bb authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Revert "usb: gadget: uvc: rework pump worker to avoid while loop"

This reverts commit bb00788b.

Based on review comments, it was applied too soon and needs more work.
Reported-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://lore.kernel.org/r/20231005081716.GA13853@pendragon.ideasonboard.com
Cc: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 12c66bf0
...@@ -397,7 +397,7 @@ static void uvcg_video_pump(struct work_struct *work) ...@@ -397,7 +397,7 @@ static void uvcg_video_pump(struct work_struct *work)
bool buf_done; bool buf_done;
int ret; int ret;
if (video->ep->enabled && uvc->state == UVC_STATE_STREAMING) { while (video->ep->enabled && uvc->state == UVC_STATE_STREAMING) {
/* /*
* Retrieve the first available USB request, protected by the * Retrieve the first available USB request, protected by the
* request lock. * request lock.
...@@ -409,11 +409,6 @@ static void uvcg_video_pump(struct work_struct *work) ...@@ -409,11 +409,6 @@ static void uvcg_video_pump(struct work_struct *work)
} }
req = list_first_entry(&video->req_free, struct usb_request, req = list_first_entry(&video->req_free, struct usb_request,
list); list);
if (!req) {
spin_unlock_irqrestore(&video->req_lock, flags);
return;
}
list_del(&req->list); list_del(&req->list);
spin_unlock_irqrestore(&video->req_lock, flags); spin_unlock_irqrestore(&video->req_lock, flags);
...@@ -442,7 +437,7 @@ static void uvcg_video_pump(struct work_struct *work) ...@@ -442,7 +437,7 @@ static void uvcg_video_pump(struct work_struct *work)
* further. * further.
*/ */
spin_unlock_irqrestore(&queue->irqlock, flags); spin_unlock_irqrestore(&queue->irqlock, flags);
goto out; break;
} }
/* /*
...@@ -475,23 +470,20 @@ static void uvcg_video_pump(struct work_struct *work) ...@@ -475,23 +470,20 @@ static void uvcg_video_pump(struct work_struct *work)
/* Queue the USB request */ /* Queue the USB request */
ret = uvcg_video_ep_queue(video, req); ret = uvcg_video_ep_queue(video, req);
spin_unlock_irqrestore(&queue->irqlock, flags); spin_unlock_irqrestore(&queue->irqlock, flags);
if (ret < 0) { if (ret < 0) {
uvcg_queue_cancel(queue, 0); uvcg_queue_cancel(queue, 0);
goto out; break;
} }
/* Endpoint now owns the request */ /* Endpoint now owns the request */
req = NULL; req = NULL;
video->req_int_count++; video->req_int_count++;
} else {
return;
} }
if (uvc->state == UVC_STATE_STREAMING) if (!req)
queue_work(video->async_wq, &video->pump); return;
return;
out:
spin_lock_irqsave(&video->req_lock, flags); spin_lock_irqsave(&video->req_lock, flags);
list_add_tail(&req->list, &video->req_free); list_add_tail(&req->list, &video->req_free);
spin_unlock_irqrestore(&video->req_lock, flags); spin_unlock_irqrestore(&video->req_lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment