Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752124AbdLYDlt convert rfc822-to-8bit (ORCPT ); Sun, 24 Dec 2017 22:41:49 -0500 Received: from szxga01-in.huawei.com ([45.249.212.187]:2432 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751297AbdLYDlq (ORCPT ); Sun, 24 Dec 2017 22:41:46 -0500 From: Lipengcheng To: "balbi@kernel.org" CC: "gregkh@linuxfoundation.org" , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Lipengcheng Subject: [PATCH] usb: dwc3: gadget: decrease the queued_requests in removal Thread-Topic: [PATCH] usb: dwc3: gadget: decrease the queued_requests in removal Thread-Index: AdN9LeKV5GA6bfi9THiSbIyGl48CBg== Date: Mon, 25 Dec 2017 03:41:28 +0000 Message-ID: <637796ED17F7774FB27D6AAE3C6951584B38CE36@dggeml508-mbx.china.huawei.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.67.222.17] Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1769 Lines: 52 In removal requests, it is necessary to make the corresponding trb disable state (HWO = 1) and dep->queued_requests a corresponding reduction. It is better to use a alone funtion to disable trb (HWO = 0). Signed-off-by: Pengcheng Li --- drivers/usb/dwc3/gadget.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 1e6c42e..273b51d 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -707,6 +707,36 @@ static void dwc3_remove_requests(struct dwc3 *dwc, struct dwc3_ep *dep) ??? while (!list_empty(&dep->started_list)) { ??????? req = next_request(&dep->started_list); +?????? if (req->trb) { +?????????? if (req->num_pending_sgs) { +?????????????? struct dwc3_trb *trb; +?????????????? int i = 0; + +?????????????? for (i = 0; i < req->num_pending_sgs; i++) { +?????????????????? trb = req->trb + i; +?????????????????? trb->ctrl &= ~DWC3_TRB_CTRL_HWO; +?????????????????? dwc3_ep_inc_deq(dep); +?????????????? } + +?????????????? if (req->unaligned || req->zero) { +?????????????????? trb = req->trb + req->num_pending_sgs + 1; +?????????????????? trb->ctrl &= ~DWC3_TRB_CTRL_HWO; +?????????????????? dwc3_ep_inc_deq(dep); +?????????????? } +?????????? } else { +?????????????? struct dwc3_trb *trb = req->trb; + +?????????????? trb->ctrl &= ~DWC3_TRB_CTRL_HWO; +?????????????? dwc3_ep_inc_deq(dep); + +?????????????? if (req->unaligned || req->zero) { +????????? ?????????trb = req->trb + 1; +?????????????????? trb->ctrl &= ~DWC3_TRB_CTRL_HWO; +?????????????????? dwc3_ep_inc_deq(dep); +?????????????? } +?????????? } +?????? } +?????? dep->queued_requests--; ??????? dwc3_gadget_giveback(dep, req, -ESHUTDOWN); ??? } -- 2.7.4