Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5a97f312 authored by Udipto Goswami's avatar Udipto Goswami
Browse files

usb: dwc3: gadget: handle ep_dequeue in LPM properly



Currently, the driver is relying on remove_requests or
ep_dequeue to giveback the requests to function driver,
but when the stop active transfer is called it will
return with error status and will bail out from remove
request without clearing the requests. At this point
we rely on ep_dequeue to clear those requests, but since
usb is disconnected, it will be in LPM which would
drive dequeue to bailout without clearing the requests.

Fix this by removing the LPM check from dequeue to
stop_active_transfer. Now if dequeue process proceeds
will check in stop_active_transfer, if dwc3 is in lpm
bail out from the process. Dequeue will further proceed
& clean up the request from cancelled list.

Change-Id: I13628ab96059fbae14bed64056ff8d7561cd240f
Signed-off-by: default avatarUdipto Goswami <ugoswami@codeaurora.org>
parent 03d27647
Loading
Loading
Loading
Loading
+5 −5
Original line number Original line Diff line number Diff line
@@ -1805,11 +1805,6 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep,
	unsigned long			flags;
	unsigned long			flags;
	int				ret = 0;
	int				ret = 0;


	if (atomic_read(&dwc->in_lpm)) {
		dev_err(dwc->dev, "Unable to dequeue while in LPM\n");
		return -EAGAIN;
	}

	trace_dwc3_ep_dequeue(req);
	trace_dwc3_ep_dequeue(req);
	dbg_ep_dequeue(dep->number, req);
	dbg_ep_dequeue(dep->number, req);


@@ -3533,6 +3528,11 @@ int dwc3_stop_active_transfer(struct dwc3_ep *dep, bool force, bool interrupt)
	u32 cmd;
	u32 cmd;
	int ret;
	int ret;


	if (atomic_read(&dwc->in_lpm)) {
		dev_err(dwc->dev, "cannot stop transfers while in LPM\n");
		return -EINVAL;
	}

	if (!(dep->flags & DWC3_EP_TRANSFER_STARTED) ||
	if (!(dep->flags & DWC3_EP_TRANSFER_STARTED) ||
	    (dep->flags & DWC3_EP_END_TRANSFER_PENDING))
	    (dep->flags & DWC3_EP_END_TRANSFER_PENDING))
		return 0;
		return 0;