From patchwork Thu Jun 27 20:52:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 11020531 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6550176 for ; Thu, 27 Jun 2019 20:52:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C8FA28703 for ; Thu, 27 Jun 2019 20:52:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 510FE2870D; Thu, 27 Jun 2019 20:52:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D38FE28703 for ; Thu, 27 Jun 2019 20:52:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726524AbfF0Uwx (ORCPT ); Thu, 27 Jun 2019 16:52:53 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:43781 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726520AbfF0Uwx (ORCPT ); Thu, 27 Jun 2019 16:52:53 -0400 Received: by mail-pl1-f194.google.com with SMTP id cl9so1913384plb.10 for ; Thu, 27 Jun 2019 13:52:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FFCtQU5sSYcakyL0pYyK6CZbXF6VG4/IPn3EqOoScBQ=; b=i6g7tyjsi0VqwFXI1RCnbQJnRRMBe1r2ij/wCB60zhC2J1rHRwUKJehchm8A5BPQS9 gFrbbdav83VFym+Vm79VqtmTYMfgUYrtNt6vB4uB3cVqx7Q0xtDmg/sXrTofJQ5CwZHu Tph57dgwsQyz83Y5PIifEw+2r7iZOwGf54sGX4fhnXEWnWWGMVegbVsDtkemjZnPlvmN 3CGXg/XC3Atx+8BWCEFxJwN0TS9gxqMlzrelHEcK++Jw4RoHLINYHJADQ6+0cn/hkMTV eHFWB1wTFNeTW9zP5jLqrtjVG5dx8EhPsV9gYhFzzSJC6sicmxZPzD952Ih/9+PPYzkZ IIag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FFCtQU5sSYcakyL0pYyK6CZbXF6VG4/IPn3EqOoScBQ=; b=L+UmqMqIWvju0bmJ6LTsC5PQjfdjXa0ZASEQN2MCVtbQMmrHsS8tcoFLaLoFWzTxvK j3Y44TJirTIsRwNDYTvSIMqSAPKQn6yBVIT9YOC0eoP8pfd6b0YAXL3o91GG10tj/hnm SZrJL79/TR58jVw0DrdoWeCevDrW5zs5EoixFMZ+uD24IFeblvVbakOAfp9LIpBYZ0ci 3ZGTTm4qfs5bDxN76AOjzL4xVlogIxiI6u6bHe9Au8/HraOCR+UhiMO90slt3dTQWEo2 iR7do2fLz+7CvkFy2cS2X+eGnu3WU4is1PuQJraaVMu/sCCMESN2N37LdcFEw9lncGOI ifJA== X-Gm-Message-State: APjAAAXpwF/8svwFeGzfbTZeReP3xkLjGGq+VjMmLQ3zLF0e5FllTEEH Qb7SDvVbZkOO+JdIO1GniU5qdQ== X-Google-Smtp-Source: APXvYqwABklyTTxO1LkkcxWaehjJJvJc92mMugHgTs1JfmaCljr1SVdn3N3uUvR8aUW8F1cG7ujZIQ== X-Received: by 2002:a17:902:f81:: with SMTP id 1mr6893773plz.191.1561668772388; Thu, 27 Jun 2019 13:52:52 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id 2sm3674083pff.174.2019.06.27.13.52.50 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 27 Jun 2019 13:52:51 -0700 (PDT) From: John Stultz To: stable@vger.kernel.org Cc: Felipe Balbi , Fei Yang , Sam Protsenko , Felipe Balbi , linux-usb@vger.kernel.org, John Stultz Subject: [PATCH 4.19.y 5/9] usb: dwc3: gadget: introduce cancelled_list Date: Thu, 27 Jun 2019 20:52:36 +0000 Message-Id: <20190627205240.38366-6-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190627205240.38366-1-john.stultz@linaro.org> References: <20190627205240.38366-1-john.stultz@linaro.org> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Felipe Balbi commit d5443bbf5fc8f8389cce146b1fc2987cdd229d12 upstream This list will host cancelled requests who still have TRBs being processed. Cc: Fei Yang Cc: Sam Protsenko Cc: Felipe Balbi Cc: linux-usb@vger.kernel.org Cc: stable@vger.kernel.org # 4.19.y Signed-off-by: Felipe Balbi (cherry picked from commit d5443bbf5fc8f8389cce146b1fc2987cdd229d12) Signed-off-by: John Stultz --- drivers/usb/dwc3/core.h | 2 ++ drivers/usb/dwc3/gadget.c | 1 + drivers/usb/dwc3/gadget.h | 15 +++++++++++++++ 3 files changed, 18 insertions(+) diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 0de78cb29f2c..24f0b108b7f6 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -636,6 +636,7 @@ struct dwc3_event_buffer { /** * struct dwc3_ep - device side endpoint representation * @endpoint: usb endpoint + * @cancelled_list: list of cancelled requests for this endpoint * @pending_list: list of pending requests for this endpoint * @started_list: list of started requests on this endpoint * @wait_end_transfer: wait_queue_head_t for waiting on End Transfer complete @@ -659,6 +660,7 @@ struct dwc3_event_buffer { */ struct dwc3_ep { struct usb_ep endpoint; + struct list_head cancelled_list; struct list_head pending_list; struct list_head started_list; diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index f0c3b08ff7c6..34331a9fb584 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2146,6 +2146,7 @@ static int dwc3_gadget_init_endpoint(struct dwc3 *dwc, u8 epnum) INIT_LIST_HEAD(&dep->pending_list); INIT_LIST_HEAD(&dep->started_list); + INIT_LIST_HEAD(&dep->cancelled_list); return 0; } diff --git a/drivers/usb/dwc3/gadget.h b/drivers/usb/dwc3/gadget.h index 2aacd1afd9ff..023a473648eb 100644 --- a/drivers/usb/dwc3/gadget.h +++ b/drivers/usb/dwc3/gadget.h @@ -79,6 +79,21 @@ static inline void dwc3_gadget_move_started_request(struct dwc3_request *req) list_move_tail(&req->list, &dep->started_list); } +/** + * dwc3_gadget_move_cancelled_request - move @req to the cancelled_list + * @req: the request to be moved + * + * Caller should take care of locking. This function will move @req from its + * current list to the endpoint's cancelled_list. + */ +static inline void dwc3_gadget_move_cancelled_request(struct dwc3_request *req) +{ + struct dwc3_ep *dep = req->dep; + + req->started = false; + list_move_tail(&req->list, &dep->cancelled_list); +} + void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req, int status);