usb: dwc3: gadget: Give back staled requests
authorThinh Nguyen <Thinh.Nguyen@synopsys.com>
Thu, 5 Mar 2020 21:24:08 +0000 (13:24 -0800)
committerFelipe Balbi <balbi@kernel.org>
Tue, 5 May 2020 07:58:52 +0000 (10:58 +0300)
commita7027ca69d82ae10d9e5899b74e809e32d04d48b
tree3d6415cfc1fa4386765940e30161ff97d7eda906
parentcb11ea56f37a36288cdd0a4799a983ee3aa437dd
usb: dwc3: gadget: Give back staled requests

If a request is dequeued, the transfer is cancelled. Give back all
the started requests.

In most scenarios, the function driver dequeues all requests of a
transfer when there's a failure. If the function driver follows this,
then it's fine. If not, then we'd be skipping TRBs at different points
within the dequeue and enqueue pointers, making dequeue/enqueue pointers
useless. To enforce and make sure that we're properly skipping TRBs,
cancel all the started requests and give back all the cancelled requests
to the function drivers.

Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
drivers/usb/dwc3/gadget.c