Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5663545pxb; Mon, 14 Feb 2022 04:49:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJyyXMS8ckpwfSqF+8bhjzCvI5UBS28YCHgPXw5bqVZhKSf25lL/svu9SX8j/IXn3mySjJun X-Received: by 2002:a05:6402:35ca:: with SMTP id z10mr15799405edc.43.1644842990247; Mon, 14 Feb 2022 04:49:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644842990; cv=none; d=google.com; s=arc-20160816; b=Xm2TUhuaCKt3i8HCsxtGU8jSrIn9aqlwh6fItC8eEzpUX9DDzkAABxXt1alUYgYgFx Xa4K3MvGRWiVphfqmEUAMORwEogeU5/zoVCjlcxqsa3WQ4QvmIBOOPwNpk46wdUvgVXd 00bHLHskTpf6+ADwUT+a7KDeQxAVlWqMwoQZ12gxTdoBSek/5fA1QzRKu75BHhU3hbos wPWhxEIvthFsGVrwAama0vCi/mU2QkpJcgq8JQ3QbkZsBa9KAV/mx8PS30piNeQnpqbl K9K8mroZgFs0NrrNJBM37mzzgt43EHRCMrXGFByIurdlXTa9SqkAFiY+lVTz78TEM6M/ X32w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=4Xbhnx9uNz2JBzthPzEn/bH0Hr1fueiRHSuJySip1XI=; b=d7MXCdZ7eCzBd0UE3n/m3+tXPyRQRKst2QFvPrwuBvw0YghQxRmqmYR6vUYJsPcUxb Yc0fFHy5kyUFtKkz1PY7/BJXB8ryb2kB8UEApnmMKayn7a0ofG+w1ulVxufcQOYly2X0 6abgR0qmI1HyoHSagUBLpL93SjeQcoPxx4Y4cVFMh42reeAFHxx93kOOusEDUWmewGNi 0PxLkvr+I719ikLDjS8Y9ycA7TumMk7BbEv4IccTZahKEVxTRnYu/hYUU59WQhmS1c46 6EfIvp9xiGFRzoX1TdDSSyk09rIBHqLz0/O0uWuhzY0Yhm2z6PjOC/IB2+4JF/xgkfRA 5GhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=cmcgtXPM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id he38si3090704ejc.63.2022.02.14.04.49.26; Mon, 14 Feb 2022 04:49:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=cmcgtXPM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240257AbiBNJwu (ORCPT + 99 others); Mon, 14 Feb 2022 04:52:50 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245572AbiBNJti (ORCPT ); Mon, 14 Feb 2022 04:49:38 -0500 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04EDF1ADB0 for ; Mon, 14 Feb 2022 01:41:02 -0800 (PST) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20220214094046epoutp01a9a9677883ff426ca6ee82de2247a8c2~Tnarp5s5A0762107621epoutp01T for ; Mon, 14 Feb 2022 09:40:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20220214094046epoutp01a9a9677883ff426ca6ee82de2247a8c2~Tnarp5s5A0762107621epoutp01T DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1644831646; bh=4Xbhnx9uNz2JBzthPzEn/bH0Hr1fueiRHSuJySip1XI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cmcgtXPM6HvMsm8KW62JOvHXi+U2HcJEdEfJdI0SZYCbf+Ou2P6SIxUUIsi19lUer YQGwNe8wmuOBq38OjwlLXHMgs7/gvrrU2Ohx0Nq+d91wWCl44lfi94Wi5nT73KMMk6 FmG8kMIWF52hvuvVThuFqHNsd1r6/cZYwlm40rLc= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20220214094045epcas2p18e0e821c5236e8ab61f01dacd790b957~TnarKScNJ2905329053epcas2p14; Mon, 14 Feb 2022 09:40:45 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.36.92]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4Jxzjl6hJvz4x9QK; Mon, 14 Feb 2022 09:40:43 +0000 (GMT) Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id B5.DA.10014.8C12A026; Mon, 14 Feb 2022 18:32:56 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p2.samsung.com (KnoxPortal) with ESMTPA id 20220214094041epcas2p2ec37c252dd5f9508454e9449c95e6c7a~Tnam8rKG51973219732epcas2p24; Mon, 14 Feb 2022 09:40:41 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220214094041epsmtrp130f8c9a1cd381b11e8e5d9564332e1cd~Tnam786tO2649526495epsmtrp1i; Mon, 14 Feb 2022 09:40:41 +0000 (GMT) X-AuditID: b6c32a47-489ff7000000271e-76-620a21c8a84b Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id DE.B1.08738.9932A026; Mon, 14 Feb 2022 18:40:41 +0900 (KST) Received: from ubuntu.dsn.sec.samsung.com (unknown [12.36.155.120]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220214094041epsmtip16bbeab070593c1ac6b2d8efe43af3ef0~TnamySefG0561905619epsmtip19; Mon, 14 Feb 2022 09:40:41 +0000 (GMT) From: Daehwan Jung To: Felipe Balbi , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org (open list), Daehwan Jung , quic_wcheng@quicinc.com, quic_jackp@quicinc.com, Thinh.Nguyen@synopsys.com Subject: [PATCH v1 1/2] usb: dwc3: Not set DWC3_EP_END_TRANSFER_PENDING in ep cmd fails Date: Mon, 14 Feb 2022 18:37:17 +0900 Message-Id: <1644831438-125403-2-git-send-email-dh10.jung@samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1644831438-125403-1-git-send-email-dh10.jung@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMKsWRmVeSWpSXmKPExsWy7bCmue4JRa4kgw/3jSyOtT1ht7izYBqT RfPi9WwWl3fNYbNYtKyV2WLXv0VMFpt297FarFpwgN2Bw2PTqk42j/1z17B7TNxT59G3ZRWj x5b9nxk9Pm+SC2CLyrbJSE1MSS1SSM1Lzk/JzEu3VfIOjneONzUzMNQ1tLQwV1LIS8xNtVVy 8QnQdcvMAbpHSaEsMacUKBSQWFyspG9nU5RfWpKqkJFfXGKrlFqQklNgXqBXnJhbXJqXrpeX WmJlaGBgZApUmJCdse1URsE27oqL224xNjAe5Oxi5OSQEDCR+Danm72LkYtDSGAHo0TTlV4m kISQwCdGiWfXpCESnxklPvYtYobpeNB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VttxgbGA9ydjFyckgImEg8aLvN 1MXIxSEksINRYvWyLcwQCUmJpXNvsEPYwhL3W46wQhR9Y5RYc3wrkMPBwSagJfF9ISNIjYhA mMS/RxdZQGqYBQ4zSrS83cUGkhAWCJc4fus7K4jNIqAq0XXpPVgDr4CbxJuJ66CWyUncPNcJ ZnMKuEvc2X8cbLEQUE3Pg+XMExj5FjAyrGKUTC0ozk3PLTYsMMpLLdcrTswtLs1L10vOz93E CA5DLa0djHtWfdA7xMjEwXiIUYKDWUmEN+4sZ5IQb0piZVVqUX58UWlOavEhRmkOFiVx3gtd J+OFBNITS1KzU1MLUotgskwcnFINTJ5z94e6vA85Gv6s95fUysSpzee/yxvXucqnXsjn1Ob6 Z6evoXtrxR5j1o/3bvLOOvF/8+sbOz+KH/MM6HzX09K0hvNTVfSqhrsMJoZF5kklzSv+eRq7 zqnh87iruj7obfaGOS3L8j+0sXqHTHRtzKicvlnz+Q4T1XMv+bSLxa8yHJkfr8ZrMKv2wN0i AfUJ9ZMnPA7eeXTymd8W7BFcE04v/ZLs+Xg28/lFd/N8JindC6tqfsuhFad5XnlLT8pB95a5 W+0UXjgKfm7pYT6c8+lST4Bwk7aNq/ONeVbB/Y+LS1dcDX1hGFxy5/K6pXq6HU0bjFUMnu5N SH0tYcHSwCInslnqdL0TE/+djg1lSizFGYmGWsxFxYkAakU/xbICAAA= X-CMS-MailID: 20220214094041epcas2p2ec37c252dd5f9508454e9449c95e6c7a X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220214094041epcas2p2ec37c252dd5f9508454e9449c95e6c7a References: <1644831438-125403-1-git-send-email-dh10.jung@samsung.com> X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It always sets DWC3_EP_END_TRANSFER_PENDING in dwc3_stop_active_transfer even if dwc3_send_gadget_ep_cmd fails. It can cause some problems like skipping clear stall commmand or giveback from dequeue. We fix to set it only when ep cmd success. Additionally, We clear DWC3_EP_TRANSFER_STARTED for next trb to start transfer not update transfer. Change-Id: I2e6b58acc99f385e467e8b639a3792a5e5f4d2bb Signed-off-by: Daehwan Jung --- drivers/usb/dwc3/gadget.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 183b90923f51..3ad3bc5813ca 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2044,6 +2044,12 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep, dwc3_gadget_move_cancelled_request(r, DWC3_REQUEST_STATUS_DEQUEUED); + /* If ep cmd fails, then force to giveback cancelled requests here */ + if (!(dep->flags & DWC3_EP_END_TRANSFER_PENDING)) { + dep->flags &= ~DWC3_EP_TRANSFER_STARTED; + dwc3_gadget_ep_cleanup_cancelled_requests(dep); + } + dep->flags &= ~DWC3_EP_WAIT_TRANSFER_COMPLETE; goto out; @@ -3645,7 +3651,7 @@ static void dwc3_stop_active_transfer(struct dwc3_ep *dep, bool force, if (!interrupt) dep->flags &= ~DWC3_EP_TRANSFER_STARTED; - else + else if (!ret) dep->flags |= DWC3_EP_END_TRANSFER_PENDING; } -- 2.31.1