Message ID | 20230502162133.148821-2-rogerq@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp749517vqo; Tue, 2 May 2023 09:37:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4fqrUqqfi/24GAuloVxmM+0S2t/+Qc0D9aOJl1Kq3WhNkYujAd9qZXDPyxNYjtWw4TsCUZ X-Received: by 2002:a17:903:298e:b0:1a5:32d7:90f4 with SMTP id lm14-20020a170903298e00b001a532d790f4mr18312026plb.50.1683045426755; Tue, 02 May 2023 09:37:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683045426; cv=none; d=google.com; s=arc-20160816; b=rx0pbaUkGNFlR1zTWK2ffjFUTyC92mwC511GoVWw5of4y9Szml3R6k8jzaj+vEDqcK Q7OVyu8bXuhIWEGVDDHl/xz24a3oe8fTb68LdZKyIZyc8dn//MCo4Q+TiS0/eLZn5IqX sNAFbHTktpf9vDYSU20RqTuqf4bmhmFnjXOADhjNWAQlMSVxEm98iNlsXXDbThOdAaA3 JvPfvB999d35kF3cA5xxFz/HICJtmtUBSRSjV/s2KIIjPZ5azEwZRfv0v17kayIXji9p u+k3Eoq5BkxD8ODfZA3xIrXdbzdMmomG5juvkqMUkTS6Do8syVme3d7K6oGR1YsECUlS zZVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cVARrDtF4BpEt/OSK7GlDcZdW9xqolt0hODq5Y1lfpk=; b=wWmP/irNyOiC3JiNm1PgWbp1unpfZ7XmoFy0NXgRj64cXz//6NZTf9qSrDPuSPaa3a oTWaRIzGnU884YxYKAIgxUzPMJNJWt2zJLlHzrRUQorMQT3/luNIqSAcrgbeut105e9Y Dcmthny+piqTGEJtGe4+RsE6uTg41vyeGEAtx225s6Z4RQp8lzcv0RTcG77AFOqoFiyr q6M6z8eKsKzo4KhewaGTDCrEAUh0rtRFiXyqUVvmcW7UZV880nYMFgxr5th7on2/2y4v 5IdUTW7BsgMn6rLBqlJv3cg39ZOnv142xQfbnBabYXUPjX9QWPwLWYXwCeGdpdcENP7S vD4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sv5UWOKh; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k5-20020a170902ce0500b0019a95ab6b66si27301673plg.33.2023.05.02.09.36.49; Tue, 02 May 2023 09:37:06 -0700 (PDT) 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=sv5UWOKh; 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 S233956AbjEBQVq (ORCPT <rfc822;rbbytesnap@gmail.com> + 99 others); Tue, 2 May 2023 12:21:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233942AbjEBQVo (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 2 May 2023 12:21:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4A5118E; Tue, 2 May 2023 09:21:43 -0700 (PDT) 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 3E34261B76; Tue, 2 May 2023 16:21:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73496C433EF; Tue, 2 May 2023 16:21:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683044502; bh=ZzbkDdtCYNoJrBH/OYvqw4h9vP/Qo32eWG/OQtGFegA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sv5UWOKhfs2uI1mryJUJ5j5EHnzxGcTRC/XkPWTbIV3VF6rb8uLSpjt5vKgXoqrmv S5gFFV23R8wZ2IQXyk0OpMKlLOHjdP/kOlP7GtNiMW/cfMeFx0Gtt6xVqLDkLdn0Ha CXvL52tSQQmq44pQu7H6FmWuYOw2i5Gl6KmQLbDH304kzAuA4dKVpumYNp2oGJh4M5 Hmj6tU4r+x0IVLxObv8mSa8F9xqMlWUADv6pqbiUNUJMa2seMYikqYwwUthV6NtQAE r/ETRgUR/luLQr9iOkxqjDoZX7DsQ/fbys55erHfuB8LIl50Oz7s8PTEqnQIkFaqXk UImpqV1BKTc/w== From: Roger Quadros <rogerq@kernel.org> To: Thinh.Nguyen@synopsys.com Cc: gregkh@linuxfoundation.org, r-gunasekaran@ti.com, srk@ti.com, wcheng@codeaurora.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Roger Quadros <rogerq@kernel.org>, stable@vger.kernel.org Subject: [PATCH v2 1/2] usb: dwc3: gadget: Avoid controller stop in .suspend if !softconnect Date: Tue, 2 May 2023 19:21:32 +0300 Message-Id: <20230502162133.148821-2-rogerq@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230502162133.148821-1-rogerq@kernel.org> References: <20230502162133.148821-1-rogerq@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764801041669268413?= X-GMAIL-MSGID: =?utf-8?q?1764801041669268413?= |
Series |
usb: dwc3: gadget: Improve dwc3_gadget_suspend/resume
|
|
Commit Message
Roger Quadros
May 2, 2023, 4:21 p.m. UTC
If softconnect is not set it means the controller has not started,
so no point in stopping it in dwc3_gadget_suspend()
Cc: stable@vger.kernel.org # 5.16
Fixes: 8217f07a5023 ("usb: dwc3: gadget: Avoid starting DWC3 gadget during UDC unbind")
Signed-off-by: Roger Quadros <rogerq@kernel.org>
---
drivers/usb/dwc3/gadget.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Tue, May 02, 2023, Roger Quadros wrote: > If softconnect is not set it means the controller has not started, > so no point in stopping it in dwc3_gadget_suspend() > > Cc: stable@vger.kernel.org # 5.16 > Fixes: 8217f07a5023 ("usb: dwc3: gadget: Avoid starting DWC3 gadget during UDC unbind") If the reason for this patch is as mentioned in the commit message, then I don't think this is a fix patch that needs to be backported to stable. The reason why we needed to check both dwc->gadget_driver and dwc->softconnect is because of a potential race between resume and unbind. Would there be a similar case in dwc_gadget_suspend where a potential race may occur? If not, I don't think we need this patch. Thanks, Thinh > Signed-off-by: Roger Quadros <rogerq@kernel.org> > --- > drivers/usb/dwc3/gadget.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c > index c0ca4d12f95d..b5170374cd18 100644 > --- a/drivers/usb/dwc3/gadget.c > +++ b/drivers/usb/dwc3/gadget.c > @@ -4656,7 +4656,7 @@ int dwc3_gadget_suspend(struct dwc3 *dwc) > { > unsigned long flags; > > - if (!dwc->gadget_driver) > + if (!dwc->gadget_driver || !dwc->softconnect) > return 0; > > dwc3_gadget_run_stop(dwc, false); > -- > 2.34.1 >
On 03/05/2023 00:17, Thinh Nguyen wrote: > On Tue, May 02, 2023, Roger Quadros wrote: >> If softconnect is not set it means the controller has not started, >> so no point in stopping it in dwc3_gadget_suspend() >> >> Cc: stable@vger.kernel.org # 5.16 >> Fixes: 8217f07a5023 ("usb: dwc3: gadget: Avoid starting DWC3 gadget during UDC unbind") > > If the reason for this patch is as mentioned in the commit message, then > I don't think this is a fix patch that needs to be backported to stable. > The reason why we needed to check both dwc->gadget_driver and > dwc->softconnect is because of a potential race between resume and > unbind. Would there be a similar case in dwc_gadget_suspend where a > potential race may occur? If not, I don't think we need this patch. OK. I agree. > > Thanks, > Thinh > >> Signed-off-by: Roger Quadros <rogerq@kernel.org> >> --- >> drivers/usb/dwc3/gadget.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c >> index c0ca4d12f95d..b5170374cd18 100644 >> --- a/drivers/usb/dwc3/gadget.c >> +++ b/drivers/usb/dwc3/gadget.c >> @@ -4656,7 +4656,7 @@ int dwc3_gadget_suspend(struct dwc3 *dwc) >> { >> unsigned long flags; >> >> - if (!dwc->gadget_driver) >> + if (!dwc->gadget_driver || !dwc->softconnect) >> return 0; >> >> dwc3_gadget_run_stop(dwc, false); >> -- >> 2.34.1 cheers, -roger
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index c0ca4d12f95d..b5170374cd18 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -4656,7 +4656,7 @@ int dwc3_gadget_suspend(struct dwc3 *dwc) { unsigned long flags; - if (!dwc->gadget_driver) + if (!dwc->gadget_driver || !dwc->softconnect) return 0; dwc3_gadget_run_stop(dwc, false);