From 997107c6b1a79295fb9a668462ccc45ab41e5aed Mon Sep 17 00:00:00 2001 From: Prakruthi Deepak Heragu Date: Mon, 20 Jul 2020 18:04:55 -0700 Subject: [PATCH] Revert "usb: dwc3: gadget: Properly handle ClearFeature(halt)" This reverts commit 1bfa0914728229f332478a0ba9f60a92f0dca046. This is a preparation change for merging android-5.4-stable.50 into msm-5.4 branch. Device wasn't enumerated in QPST with this change. This was failing ADB check. Change-Id: Id083f5a93faacb3f316f5973103d3e0bf7eb6788 Signed-off-by: Prakruthi Deepak Heragu Signed-off-by: Blagovest Kolenichev --- drivers/usb/dwc3/gadget.c | 36 +++--------------------------------- 1 file changed, 3 insertions(+), 33 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 17340864a540..df6d5096f5b4 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1513,10 +1513,6 @@ static void dwc3_gadget_ep_skip_trbs(struct dwc3_ep *dep, struct dwc3_request *r { int i; - /* If req->trb is not set, then the request has not started */ - if (!req->trb) - return; - /* * If request was already started, this means we had to * stop the transfer. With that we also need to ignore @@ -1607,8 +1603,6 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol) { struct dwc3_gadget_ep_cmd_params params; struct dwc3 *dwc = dep->dwc; - struct dwc3_request *req; - struct dwc3_request *tmp; int ret; if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) { @@ -1645,37 +1639,13 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol) else dep->flags |= DWC3_EP_STALL; } else { - /* - * Don't issue CLEAR_STALL command to control endpoints. The - * controller automatically clears the STALL when it receives - * the SETUP token. - */ - if (dep->number <= 1) { - dep->flags &= ~(DWC3_EP_STALL | DWC3_EP_WEDGE); - return 0; - } ret = dwc3_send_clear_stall_ep_cmd(dep); - if (ret) { + if (ret) dev_err(dwc->dev, "failed to clear STALL on %s\n", dep->name); - return ret; - } - - dep->flags &= ~(DWC3_EP_STALL | DWC3_EP_WEDGE); - - dwc3_stop_active_transfer(dep, true, true); - - list_for_each_entry_safe(req, tmp, &dep->started_list, list) - dwc3_gadget_move_cancelled_request(req); - - list_for_each_entry_safe(req, tmp, &dep->pending_list, list) - dwc3_gadget_move_cancelled_request(req); - - if (!(dep->flags & DWC3_EP_END_TRANSFER_PENDING)) { - dep->flags &= ~DWC3_EP_DELAY_START; - dwc3_gadget_ep_cleanup_cancelled_requests(dep); - } + else + dep->flags &= ~(DWC3_EP_STALL | DWC3_EP_WEDGE); } return ret;