Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2383537iob; Fri, 6 May 2022 01:12:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJziRcUF8H1u1CvfSOgnqvL5kNoiBb5DkDGCmUezc59GXDbCfbOD/Zq7DOieD9sgWfcq/1e0 X-Received: by 2002:a17:90b:1c04:b0:1dc:32dd:3212 with SMTP id oc4-20020a17090b1c0400b001dc32dd3212mr11128358pjb.35.1651824736230; Fri, 06 May 2022 01:12:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651824736; cv=none; d=google.com; s=arc-20160816; b=V/ksm2zYvMqm8js9mrQj7KxzP8iDyMCCuxj9B4UqHbFFehOEhlXx2uPgFO35xRTQwt BYRsot7Sd1NUuwCdVsTMIM8WYDdrL8a/XN0Nac+tS76q8O3divr+xb2bJWmvE6TpYEIo SnYGUxNdfwcauSRRo7aeMLJnlKjDHQPO6JQE8Q71U1RFgtmHbOveShx5QbT/74CXSxY1 L2OqK7FTevpSryQw6q/P+ua57CUXWPwfg9KSoYwXmyOMbWrAp4s3TzyJXOLacby+8PaR UQqsllNaSF3qPEvNHgWuGP0aU+zQt//pKuP+J7XEy2HxhQv9yUygnR7+8utyhozpSAjO jizA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=o5sT1g62fIFBnL3DLzs+uCYLKFxIKtRaSGIWsYq0R2E=; b=cE1hzBe4rfJr0PuUbov6gb2Cfd7TwHjSvNJsRGU7YSjx4nxj7rerdchtOCvPpE8zf6 WrQOuxyWyGg+11O5Fdxvc8yL1n0INaWbhke1Sfv33fEIxkEBaVT5T+SQEcc4JBRJ5ocf blR+MpSuD+v4zAPnu1Ixw1x9t4Cqv7CkjGiAt3rqnunzC+vgPL3KagGsXcpnTVMYIiVn nHLHy18qExx6f2LCKqkozsyie51wig+T51Jbc/M/QLJtCCNTY42PLpvjA6rZ7NYjA0LL NdcyNrGAdxGqfvYOtvYBiHXZfCwA6jNHw0xQO5BSkUo/hA/K1ctnptTLbztswHmj+vhN G+Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H54ctx2y; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u36-20020a056a0009a400b0050ddae37a02si5375652pfg.253.2022.05.06.01.12.02; Fri, 06 May 2022 01:12:16 -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=@linuxfoundation.org header.s=korg header.b=H54ctx2y; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354949AbiEDRDU (ORCPT + 99 others); Wed, 4 May 2022 13:03:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354577AbiEDQ6x (ORCPT ); Wed, 4 May 2022 12:58:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00D2C18B34; Wed, 4 May 2022 09:50:33 -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 ams.source.kernel.org (Postfix) with ESMTPS id AC34CB82752; Wed, 4 May 2022 16:50:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 632FBC385A4; Wed, 4 May 2022 16:50:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683031; bh=tYbbtFWE1gBnzqfxTsWUCnZsm02ZdWEOGyvLnKVQE5o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H54ctx2y5Uek03VWs27OuCHN+rjuQ+nb0F7kIllExRNJGUfyw0L9E7xpuIsw8sOnL E06Gp7wzwjKPLAj9s0ZzXjFQwipmlCOswlxUwISuGFo63QsXWumNaJiLLcHIoxxUON Lf41N10g9fIAq6mOaU0hDAPTQBW23rnPv2G0SUBo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , Sven Peter Subject: [PATCH 5.10 022/129] usb: dwc3: Try usb-role-switch first in dwc3_drd_init Date: Wed, 4 May 2022 18:43:34 +0200 Message-Id: <20220504153023.018906145@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153021.299025455@linuxfoundation.org> References: <20220504153021.299025455@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 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,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: X-Mailing-List: linux-kernel@vger.kernel.org From: Sven Peter commit ab7aa2866d295438dc60522f85c5421c6b4f1507 upstream. If the PHY controller node has a "port" dwc3 tries to find an extcon device even when "usb-role-switch" is present. This happens because dwc3_get_extcon() sees that "port" node and then calls extcon_find_edev_by_node() which will always return EPROBE_DEFER in that case. On the other hand, even if an extcon was present and dwc3_get_extcon() was successful it would still be ignored in favor of "usb-role-switch". Let's just first check if "usb-role-switch" is configured in the device tree and directly use it instead and only try to look for an extcon device otherwise. Fixes: 8a0a13799744 ("usb: dwc3: Registering a role switch in the DRD code.") Cc: stable Signed-off-by: Sven Peter Link: https://lore.kernel.org/r/20220411155300.9766-1-sven@svenpeter.dev Signed-off-by: Greg Kroah-Hartman --- drivers/usb/dwc3/drd.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) --- a/drivers/usb/dwc3/drd.c +++ b/drivers/usb/dwc3/drd.c @@ -568,16 +568,15 @@ int dwc3_drd_init(struct dwc3 *dwc) { int ret, irq; + if (ROLE_SWITCH && + device_property_read_bool(dwc->dev, "usb-role-switch")) + return dwc3_setup_role_switch(dwc); + dwc->edev = dwc3_get_extcon(dwc); if (IS_ERR(dwc->edev)) return PTR_ERR(dwc->edev); - if (ROLE_SWITCH && - device_property_read_bool(dwc->dev, "usb-role-switch")) { - ret = dwc3_setup_role_switch(dwc); - if (ret < 0) - return ret; - } else if (dwc->edev) { + if (dwc->edev) { dwc->edev_nb.notifier_call = dwc3_drd_notifier; ret = extcon_register_notifier(dwc->edev, EXTCON_USB_HOST, &dwc->edev_nb);