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: Rohith Kollalsi <rkollals@codeaurora.org>
This commit is contained in:
Rohith Kollalsi 2020-09-14 11:52:57 +05:30
commit 7e2497c8e0

View file

@ -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);