From patchwork Fri Jun 28 18:24:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 168126 Delivered-To: patches@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp4020723ilk; Fri, 28 Jun 2019 11:24:28 -0700 (PDT) X-Received: by 2002:a65:4945:: with SMTP id q5mr10797259pgs.9.1561746268140; Fri, 28 Jun 2019 11:24:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561746268; cv=none; d=google.com; s=arc-20160816; b=oAY8NinZyU70b3yHBIPU1JuQPJ5HRpkKOmOsiirgVxCXiqs1n5OJPMx+QLX6EKnnDG b+iUXDkVAUxlNZ5mU2vYIQxHmjr7Yy4F7nVh5pwmNTjaJ2YndrfX9N4bHeDwwk7kptj4 H2KJqfWVwSqi38Eu068F+QKvMMSxTWE3ZXt3zs4+0JAZtXxersuPfprNYesufioY+1bZ IG91iZ2JL/SAZa/mR/ZHyhyGhlPEo5nhM9mJhVlnr6qAuxC8uNCAqraOgP4JiM59vsvP rCS07/+kKm1na0Q+SrBpbhPTaY2kBbAx5OpHm+Eq+db5u7LjJ0+Ux6IWg9MLy5iXavmr n/+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DDZGKZ3w7wUwrEm8FX1ASPwXOimJmyPEnuezYoXx+I8=; b=qGjfyfLdsiakzNbJiUBfkKFQUN6wPMLkhQnw1qkfMdIo8XgPB1OdxqU8om8rmlzG/T tnlcmn6lBEhtygtrgpP39o/lwsg2V4/5+gIsEBaw3ZX4MwxjsEatEwZSpxYD3H6ybjb4 OnWcGecl9LCJvrs3FKciaZxoX2oQo7YbwTni0fGJ/Ufq1nhjC57PFye4G6/HOjyESb3t Bify+B6eTSHXMO31qvVrEEMH4ThIGEqJ4Q1AbwbEHrEl0pe150CqRqfeGfC5c1RVj7xc 9gCAMYB/dh3fClO1ltaUbp8WFRAxHSQOvBOr0PwmzSTZ1Xu6wjslXa5yOcg+KmImUtel BIMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CFr4YuFA; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id v75sor3423924pjb.26.2019.06.28.11.24.28 for (Google Transport Security); Fri, 28 Jun 2019 11:24:28 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CFr4YuFA; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=DDZGKZ3w7wUwrEm8FX1ASPwXOimJmyPEnuezYoXx+I8=; b=CFr4YuFAJ4CxD6EpGmjrwbV8ZIDMplHe16uLlYTmXLMT/n8sVa1kkkDZspxOIo7N4Y iwHYu38lElMkN+RfwzTsUxMoed7bGFFRCOZGWXlCB22crZeKZ+8FrV9hwzyiI9vZTLlI rzzeHEMdgj3VQckfWLa+a88HPnC5E1Suwv7H0SKFUfLxw7hyUO97PHn2tyCcGUrK8Q0u d6erI+z85f3CcHZQyLYs6YsF459KLnDFEP7hTdtKgvJY9j1tsTd7H2VXnDkM3OAd9Vag ht6sy4mXJpGFRKIZ3tT9/SL+r9gEmXwS7lu8bPw2ue7+O6uSPxX9PGa5ttRXn6kQbX4e qSIg== 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=DDZGKZ3w7wUwrEm8FX1ASPwXOimJmyPEnuezYoXx+I8=; b=QFM38SN3HmfAITivCt4Kpvgtz80BjFkQwooGNGadXQ7jPJMPtwml8WngSoqlMwfaiM POq9jYBfS6y6E73KVqHlVJ5BKnnbpopYhkAtuoqsdggFUNS546gkTLUHpIVn3JqKpKVM 6j8LkkgRs5eh+7h+Q/Tc98ThyrrKEuUYK/ZL0GH3PokGv4EnbfYGMuJ199hLrTpUEGvb TFyjXhNQNkDgnWYHBTlgUhdRzOimOnqrzaPEMbhkZpMl/6whF0e1Yjdwjw2jvP77ws40 W0InMD5ZrrDDsWZJ8IiiS0zgq1PU0MLnOjRuzgMnkTXDtnS2W3A0NmfSG/H3WLOMmO5R +E5w== X-Gm-Message-State: APjAAAV2TcTS52Xb74ISDFxK/krCBguSxDu9Md2HB7Od1Sso5NmtrDj4 UE+S/zvMCjl6rjmZ8u883t8Cv8wH X-Google-Smtp-Source: APXvYqx3g7h5vvxkXrT1Ioc3tfWK+hwMhoc+6Gew5Hk0v0/fv3t0WaflZUIIz+aQTaGKOOsB4v7dRQ== X-Received: by 2002:a17:90a:a489:: with SMTP id z9mr4530868pjp.24.1561746267725; Fri, 28 Jun 2019 11:24:27 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id s15sm2916223pfd.183.2019.06.28.11.24.25 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 28 Jun 2019 11:24:26 -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 v2 6/9] usb: dwc3: gadget: introduce cancelled_list Date: Fri, 28 Jun 2019 18:24:10 +0000 Message-Id: <20190628182413.33225-7-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190628182413.33225-1-john.stultz@linaro.org> References: <20190628182413.33225-1-john.stultz@linaro.org> 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(+) -- 2.17.1 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 46aa20b376cd..c2169bc626c8 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2144,6 +2144,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);