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

Commit 68d8a781 authored by Felipe Balbi's avatar Felipe Balbi
Browse files

usb: dwc3: ep0: tidy up Pending Request handling



The way our code was written, we should never have
a DWC3_EP_PENDING_REQUEST flag set out of a Data Phase
and the code in __dwc3_gadget_ep0_queue() did not
reflect that situation properly.

Tidy up that case to avoid any possible mistakes
when starting requests for IRQs which are long
gone.

Cc: stable@vger.kernel.org
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent dcd6c922
Loading
Loading
Loading
Loading
+4 −10
Original line number Original line Diff line number Diff line
@@ -149,20 +149,14 @@ static int __dwc3_gadget_ep0_queue(struct dwc3_ep *dep,


		direction = !!(dep->flags & DWC3_EP0_DIR_IN);
		direction = !!(dep->flags & DWC3_EP0_DIR_IN);


		if (dwc->ep0state == EP0_STATUS_PHASE) {
		if (dwc->ep0state != EP0_DATA_PHASE) {
			type = dwc->three_stage_setup
			dev_WARN(dwc->dev, "Unexpected pending request\n");
				? DWC3_TRBCTL_CONTROL_STATUS3
				: DWC3_TRBCTL_CONTROL_STATUS2;
		} else if (dwc->ep0state == EP0_DATA_PHASE) {
			type = DWC3_TRBCTL_CONTROL_DATA;
		} else {
			/* should never happen */
			WARN_ON(1);
			return 0;
			return 0;
		}
		}


		ret = dwc3_ep0_start_trans(dwc, direction,
		ret = dwc3_ep0_start_trans(dwc, direction,
				req->request.dma, req->request.length, type);
				req->request.dma, req->request.length,
				DWC3_TRBCTL_CONTROL_DATA);
		dep->flags &= ~(DWC3_EP_PENDING_REQUEST |
		dep->flags &= ~(DWC3_EP_PENDING_REQUEST |
				DWC3_EP0_DIR_IN);
				DWC3_EP0_DIR_IN);
	} else if (dwc->delayed_status) {
	} else if (dwc->delayed_status) {