Skip to content

Commit

Permalink
Revert "usb: gadget: uvc: rework pump worker to avoid while loop"
Browse files Browse the repository at this point in the history
This reverts commit bb00788.

Based on review comments, it was applied too soon and needs more work.

Reported-by: Laurent 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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Greg Kroah-Hartman committed Oct 5, 2023
1 parent 12c66bf commit e0fa80b
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions drivers/usb/gadget/function/uvc_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ static void uvcg_video_pump(struct work_struct *work)
bool buf_done;
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
* request lock.
Expand All @@ -409,11 +409,6 @@ static void uvcg_video_pump(struct work_struct *work)
}
req = list_first_entry(&video->req_free, struct usb_request,
list);
if (!req) {
spin_unlock_irqrestore(&video->req_lock, flags);
return;
}

list_del(&req->list);
spin_unlock_irqrestore(&video->req_lock, flags);

Expand Down Expand Up @@ -442,7 +437,7 @@ static void uvcg_video_pump(struct work_struct *work)
* further.
*/
spin_unlock_irqrestore(&queue->irqlock, flags);
goto out;
break;
}

/*
Expand Down Expand Up @@ -475,23 +470,20 @@ static void uvcg_video_pump(struct work_struct *work)
/* Queue the USB request */
ret = uvcg_video_ep_queue(video, req);
spin_unlock_irqrestore(&queue->irqlock, flags);

if (ret < 0) {
uvcg_queue_cancel(queue, 0);
goto out;
break;
}

/* Endpoint now owns the request */
req = NULL;
video->req_int_count++;
} else {
return;
}

if (uvc->state == UVC_STATE_STREAMING)
queue_work(video->async_wq, &video->pump);
if (!req)
return;

return;
out:
spin_lock_irqsave(&video->req_lock, flags);
list_add_tail(&req->list, &video->req_free);
spin_unlock_irqrestore(&video->req_lock, flags);
Expand Down

0 comments on commit e0fa80b

Please sign in to comment.