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

Commit 7e2497c8 authored by Rohith Kollalsi's avatar Rohith Kollalsi
Browse files

usb: dwc3: Don't queue the request if gadget is in suspended state



Do not queue the request when gadget is in suspended state
as usb controller cannot process the request queued.

Change-Id: Id83b8461f208c6fc72b27105233e453dd8697528
Signed-off-by: default avatarRohith Kollalsi <rkollals@codeaurora.org>
parent 9e1aed8f
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -1616,6 +1616,14 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
	return __dwc3_gadget_kick_transfer(dep);
}

static bool dwc3_gadget_is_suspended(struct dwc3 *dwc)
{
	if (atomic_read(&dwc->in_lpm) ||
			dwc->link_state == DWC3_LINK_STATE_U3)
		return true;
	return false;
}

static int dwc3_gadget_ep_queue(struct usb_ep *ep, struct usb_request *request,
	gfp_t gfp_flags)
{
@@ -1627,6 +1635,9 @@ static int dwc3_gadget_ep_queue(struct usb_ep *ep, struct usb_request *request,

	int				ret;

	if (dwc3_gadget_is_suspended(dwc))
		return -EAGAIN;

	spin_lock_irqsave(&dwc->lock, flags);
	ret = __dwc3_gadget_ep_queue(dep, req);
	spin_unlock_irqrestore(&dwc->lock, flags);