Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp239544lqr; Wed, 5 Jun 2024 04:56:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUsmdRmZV+IE4aO5ctZswPPJtRTAzGN7APTXq1ptMRgchYkqAKkoeyIK3roQymkl1ETTL7Q4d2tKRPGx5ofdHxEWIp8Cpg0VvL2T/1fVg== X-Google-Smtp-Source: AGHT+IGshF3apKiJlfVfAdZi66cdrmkRUQLvU1oxrVl9tqnRL0QWeCa+UarCeXFFEH8DV0SabvJZ X-Received: by 2002:a05:6512:39c4:b0:51b:aa42:67c5 with SMTP id 2adb3069b0e04-52bab509c77mr1891750e87.60.1717588592033; Wed, 05 Jun 2024 04:56:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717588592; cv=pass; d=google.com; s=arc-20160816; b=yXfdp6ByKJqMo6wA6TjhHAzbsqbMtkwSAMZnQ86SDCj6yo0VUbhdkDX3t8RPHqsWea LL1K4IRN9fZ7L34rpuKF/PhfmZE8e/rsi/TApblA+VQzmqO30/Af4KtSW1nN/Xual90m WTu4o85ybnbnbTQAcmopuwPvlKCZNMCEO2EfOh50IIl/dxxhuMPtxHprHSTIE1zKIfmS joyRj3fqm5PzkPrlr2YuQYpY98eHt3ZCvVr4m8n0/5C3PGjlO0mFlzs3qraOqkQE1Yk1 IOlbPVz4SdCfKiQ1zJrX99c1Mfmog0K7T8yfHlmb/R57R+wfypyqQkeqfcV6NviiAbQW KE0Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=HdR26h/fCNFa3bG7h6kWyD6yoFeHOoH6eDBudOqzmnM=; fh=XxRt3en5exlL8TXxCHVw3wT31uoYNpguUvolRe0krbs=; b=tiMwKSWxZy6OqwApQ0BObXdMeeT6oYjlU+EDTqHTUZtxnS/dy7U7za/juSBUFR6pgx dpaEWpVWflzs+hZIFRfvRtyRfgoVYlaUVWFyVsxfNlo7/cuqo/dzXTncKrWJaRkB7ilA GVYxqqDE0TJyMuyD4VZBsYQckB/j0Ezwj392H3xZktH40FOK/gubhuHQWaVXUxRLh+qY 0enOwmhiawpEZSZOgJblUNC7TQW/bTklDahM3lgysMzhpH9yMMEpkqFrR/twlhlSZNm7 wfrEbGRIeQHkmdn2bHUcrcpfh/AiW9qCz+2K+HHJdwKNsLySS5PnhS4W8FHsVZDBeRHR vDWA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=srSLjOHJ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202325-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202325-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a36e06b4esi6121747a12.597.2024.06.05.04.56.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 04:56:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202325-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=srSLjOHJ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202325-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202325-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B8EE21F24372 for ; Wed, 5 Jun 2024 11:56:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7824319AD9E; Wed, 5 Jun 2024 11:50:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="srSLjOHJ" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8865919885B; Wed, 5 Jun 2024 11:50:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717588226; cv=none; b=OWLvvORgEX5eYV+fmZZG8IpwfzxVVwtqofGDuBKQwFYR0E6OGPcXknNMRd2+zpx7tOzpXGtCtvXGDp6ve7/UgLcPk1ZP30t00MO7J+dizY+uq5mk8D41uUbSRxkpjJ2ErvlZFhab+1wWtrit/y8rhiqSDOUpsuA3YJaNc2arvrk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717588226; c=relaxed/simple; bh=k9wMZie2g8zido3r8l4XxgOwAvQm8nitQZP1EAGITQo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MrUImC5OpCr8CX9WRbOoj/IhAwRdXjx/sMvIBqVK471xZzmi+U3/vYPjvcOiAJPpecz4obEmPNCix5vmmEQ9dTH5iTgpsmASemjWwFM+ab46ZBVtdHAF+0ZvQ88cjMCtLlIkRKTWfPsOqN5nIpWuL/1F8+TNFLXsFoHZIxZdsH0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=srSLjOHJ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6686C32781; Wed, 5 Jun 2024 11:50:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717588226; bh=k9wMZie2g8zido3r8l4XxgOwAvQm8nitQZP1EAGITQo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=srSLjOHJPV5k+Ehbe7IXYhch/SaoMiisFIobMaX3hHfYkqH8syKfSI390h2AeFDVV 2Lvb+4sqSgaLC4vGoSWUHvPy7A4cperkpQtbTJCBRsRYh6vwuqg6+3Za24tCewtH6l aj01P70pxm25gAqCiuzKxt48wB1VhDk8lx2Dis9UsX/PeBxMWSTqMUGz5AxxJ2naZz 09Gf+U3pFrduu/Lp55vUXz1D+rehjevzHgrf3V9lfJ4giA+C9LW8kMImmxFuschxyq XLpvkoHFKT7WXHZzEAFdV35kYsx8vH0mE+OoKPoP9QK9aY6mHETLQyZbHmlb3pfqfW ZO7geDPqlin/Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Dmitry Baryshkov , Caleb Connolly , Bryan O'Donoghue , Heikki Krogerus , Johan Hovold , Greg Kroah-Hartman , Sasha Levin , linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org Subject: [PATCH AUTOSEL 6.9 24/28] usb: typec: qcom-pmic-typec: split HPD bridge alloc and registration Date: Wed, 5 Jun 2024 07:48:53 -0400 Message-ID: <20240605114927.2961639-24-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240605114927.2961639-1-sashal@kernel.org> References: <20240605114927.2961639-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.9.3 Content-Transfer-Encoding: 8bit From: Dmitry Baryshkov [ Upstream commit 718b36a7b49acbba36546371db2d235271ceb06c ] If a probe function returns -EPROBE_DEFER after creating another device there is a change of ending up in a probe deferral loop, (see commit fbc35b45f9f6 ("Add documentation on meaning of -EPROBE_DEFER"). In case of the qcom-pmic-typec driver the tcpm_register_port() function looks up external resources (USB role switch and inherently via called typec_register_port() USB-C muxes, switches and retimers). In order to prevent such probe-defer loops caused by qcom-pmic-typec driver, use the API added by Johan Hovold and move HPD bridge registration to the end of the probe function. The devm_drm_dp_hpd_bridge_add() is called at the end of the probe function after all TCPM start functions. This is done as a way to overcome a different problem, the DRM subsystem can not properly cope with the DRM bridges being destroyed once the bridge is attached. Having this function call at the end of the probe function prevents possible DRM bridge device creation followed by destruction in case one of the TCPM start functions returns an error. Reported-by: Caleb Connolly Acked-by: Bryan O'Donoghue Signed-off-by: Dmitry Baryshkov Reviewed-by: Heikki Krogerus Reviewed-by: Johan Hovold Link: https://lore.kernel.org/r/20240424-qc-pmic-typec-hpd-split-v4-1-f7e10d147443@linaro.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c index d3958c061a972..501eddb294e43 100644 --- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c @@ -41,7 +41,7 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev) struct device_node *np = dev->of_node; const struct pmic_typec_resources *res; struct regmap *regmap; - struct device *bridge_dev; + struct auxiliary_device *bridge_dev; u32 base; int ret; @@ -92,7 +92,7 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev) if (!tcpm->tcpc.fwnode) return -EINVAL; - bridge_dev = drm_dp_hpd_bridge_register(tcpm->dev, to_of_node(tcpm->tcpc.fwnode)); + bridge_dev = devm_drm_dp_hpd_bridge_alloc(tcpm->dev, to_of_node(tcpm->tcpc.fwnode)); if (IS_ERR(bridge_dev)) return PTR_ERR(bridge_dev); @@ -110,8 +110,14 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev) if (ret) goto port_stop; + ret = devm_drm_dp_hpd_bridge_add(tcpm->dev, bridge_dev); + if (ret) + goto pdphy_stop; + return 0; +pdphy_stop: + tcpm->pdphy_stop(tcpm); port_stop: tcpm->port_stop(tcpm); port_unregister: -- 2.43.0