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

Commit f2874311 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

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

parents 116b7811 7e2497c8
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -1638,6 +1638,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)
{
@@ -1649,6 +1657,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);