Received: by 2002:a05:6358:16cd:b0:dc:6189:e246 with SMTP id r13csp3588596rwl; Sun, 6 Nov 2022 01:24:31 -0800 (PST) X-Google-Smtp-Source: AMsMyM4d4+zDK4VYpZUBTWULfwb7NAvLHHaLtAKbaq/7WH5EdH8TtIWxQk8YrYRNMRW5xrXLlebi X-Received: by 2002:a05:6a00:1485:b0:56d:642b:5861 with SMTP id v5-20020a056a00148500b0056d642b5861mr36778583pfu.84.1667726671508; Sun, 06 Nov 2022 01:24:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667726671; cv=none; d=google.com; s=arc-20160816; b=RK5odTSDt7ITeyjJ/3abdomqUXopY2dmVOwkNdfao316yMlEqXin60bQB4wy9oYyM6 HL/UYQCfMXCxuCYSPW7Y2rGnpW1tO58vvjrhyNzSTZx0f91YckZlQtBrhLAhj+k1jKiG yqOxw3LsPFkQa6UmmKHNjeGEKIJkBHAEngyohzdWNAYU/9tzM89DkkEipXWNThQmItAW 5yXZ0J16w0vctwBcU+J8i2XymhXwvXDrEPpHTqkC7qUrbzhdxnYFft3G7ylLCDdPvgHm uG9dxIO/Twh+l6tvAgYel8w97m4Ej1mefNoa/Hj8ZxTobVPgz8M4oGk13TdLQ//oez41 lOAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=CGuJP3y2RESoVWgi8H9gtuCWOAkCiv/5+Aci1t8ne74=; b=ingePlpzcGD7sjWZrVRZjifL1pF125KnGHvJGDZbHYNGJhl0kB4TxnyInYVPjrmshY 7NK7QK0cSd000ZE87J2mBmVqnzfH5M2SdREqW3E/03FeuBZ4acDI6M4W0flsYJeC5HJt F++3iS2IUr2vfRxLHdK7tpT85lWTVzeGTH0Vjp7UsLXE66tmfvcNxkdWqGjQkMw+WmtM HTNcB6l/x3exBpLk55icLbpkSK2u3k6jE+/IeoQG6iLGcYCn00O+mFYaMLyu1gkbuWEN 5u4WHHFvbtCIjApel/5zVHTLNk4S710Vj4Xn5uW9bfIxd595Mu4uQdqr59xtgconW/U/ +j+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="k/pv7fMc"; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c10-20020a170902aa4a00b0017f7fffb591si5360232plr.374.2022.11.06.01.24.14; Sun, 06 Nov 2022 01:24:31 -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=@kernel.org header.s=k20201202 header.b="k/pv7fMc"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229758AbiKFJIZ (ORCPT + 97 others); Sun, 6 Nov 2022 04:08:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229609AbiKFJIX (ORCPT ); Sun, 6 Nov 2022 04:08:23 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 257F7A9; Sun, 6 Nov 2022 01:08:22 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 920DB60C07; Sun, 6 Nov 2022 09:08:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B5EEC433C1; Sun, 6 Nov 2022 09:08:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667725700; bh=oSY2pB7T1Vm2y2VVy5D70U7pf0RgTlyiyzQ20GmbmMg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=k/pv7fMcaOv+eL7kiY75jtJZgr2H4SeF6Wk4jqIvV8QYy9yomZ9Ak2moOfhC9wcT+ Cpjc3CIIwZQ7Gv0G1lwRWVS/iBYDKvmF8u7H8UQ7hIAMGwJdSSqhqIBVlC8e+go2/2 aWV8wtBjgIrNkTmWMaNFQQ/MQxp/0nt5ABOx/T7xUXCoQzYa+FYJZxOH2YI3yiJLV9 w/lqvMZ5i3tWqEPFrUZYgrkgz/jMoQ2byJbh00w/zsXjFZzPCm6ombAcSqs4nP/l9j Vp94ooQLvcQ+NBEeyapRt6JTbaw0RmY8GY10pgptlDJB8etr/xAJ0nK4vCHqTmQ4ug hcdEQvCGBzvTw== Date: Sun, 6 Nov 2022 17:08:15 +0800 From: Peter Chen To: Pawel Laszczak Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] usb: cdnsp: Fix issue with Clear Feature Halt Endpoint Message-ID: <20221106090815.GB152143@nchen-desktop> References: <20221026093710.449809-1-pawell@cadence.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221026093710.449809-1-pawell@cadence.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 On 22-10-26 05:37:10, Pawel Laszczak wrote: > During handling Clear Halt Endpoint Feature request driver invokes > Reset Endpoint command. Because this command has some issue with What are issues? Would you please explain more? > transition endpoint from Running to Idle state the driver must > stop the endpoint by using Stop Endpoint command. > > cc: > Fixes: 3d82904559f4 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver") > Signed-off-by: Pawel Laszczak > --- > drivers/usb/cdns3/cdnsp-gadget.c | 12 ++++-------- > drivers/usb/cdns3/cdnsp-ring.c | 3 ++- > 2 files changed, 6 insertions(+), 9 deletions(-) > > diff --git a/drivers/usb/cdns3/cdnsp-gadget.c b/drivers/usb/cdns3/cdnsp-gadget.c > index e2e7d16f43f4..0576f9b0e4aa 100644 > --- a/drivers/usb/cdns3/cdnsp-gadget.c > +++ b/drivers/usb/cdns3/cdnsp-gadget.c > @@ -600,11 +600,11 @@ int cdnsp_halt_endpoint(struct cdnsp_device *pdev, > > trace_cdnsp_ep_halt(value ? "Set" : "Clear"); > > - if (value) { > - ret = cdnsp_cmd_stop_ep(pdev, pep); > - if (ret) > - return ret; > + ret = cdnsp_cmd_stop_ep(pdev, pep); > + if (ret) > + return ret; > In your change ,it call cdnsp_cmd_stop_ep unconditionally, no matter set or clear halt? Is it your expectation? If it is, why? > + if (value) { > if (GET_EP_CTX_STATE(pep->out_ctx) == EP_STATE_STOPPED) { > cdnsp_queue_halt_endpoint(pdev, pep->idx); > cdnsp_ring_cmd_db(pdev); > @@ -613,10 +613,6 @@ int cdnsp_halt_endpoint(struct cdnsp_device *pdev, > > pep->ep_state |= EP_HALTED; > } else { > - /* > - * In device mode driver can call reset endpoint command > - * from any endpoint state. > - */ > cdnsp_queue_reset_ep(pdev, pep->idx); > cdnsp_ring_cmd_db(pdev); > ret = cdnsp_wait_for_cmd_compl(pdev); > diff --git a/drivers/usb/cdns3/cdnsp-ring.c b/drivers/usb/cdns3/cdnsp-ring.c > index 25e5e51cf5a2..aa79bce89d8a 100644 > --- a/drivers/usb/cdns3/cdnsp-ring.c > +++ b/drivers/usb/cdns3/cdnsp-ring.c > @@ -2081,7 +2081,8 @@ int cdnsp_cmd_stop_ep(struct cdnsp_device *pdev, struct cdnsp_ep *pep) > u32 ep_state = GET_EP_CTX_STATE(pep->out_ctx); > int ret = 0; > > - if (ep_state == EP_STATE_STOPPED || ep_state == EP_STATE_DISABLED) { > + if (ep_state == EP_STATE_STOPPED || ep_state == EP_STATE_DISABLED || > + ep_state == EP_STATE_HALTED) { > trace_cdnsp_ep_stopped_or_disabled(pep->out_ctx); > goto ep_stopped; > } > -- > 2.25.1 > -- Thanks, Peter Chen