From patchwork Thu Aug 31 22:16:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 1828519 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kwiboo.se header.i=@kwiboo.se header.a=rsa-sha256 header.s=s1 header.b=AzBtQQ7X; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RcFrT5qSsz1yfm for ; Fri, 1 Sep 2023 08:16:57 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 048CD865B0; Fri, 1 Sep 2023 00:16:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kwiboo.se Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kwiboo.se header.i=@kwiboo.se header.b="AzBtQQ7X"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EB7EC865B0; Fri, 1 Sep 2023 00:16:38 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.2 Received: from s.wrqvwxzv.outbound-mail.sendgrid.net (s.wrqvwxzv.outbound-mail.sendgrid.net [149.72.154.232]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1BE8386680 for ; Fri, 1 Sep 2023 00:16:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kwiboo.se Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bounces+31435339-7456-u-boot=lists.denx.de@em2124.kwiboo.se DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type:cc:content-type:from:subject:to; s=s1; bh=JTr2huGOS180dVS+xOXUF7qaAk7Zmb3w7RDsA6d8hMg=; b=AzBtQQ7XlNf/77l4i3tCcNef1L4zPB7hu4npTdeHAyOBGeMHmtjuC2qb9RXwFiWqcid7 MuoHguSsy4yMBFlXg31EEtYVgi3AUfH2Hc1JKW0BcatIHU/9mYGzZTOnwzXmfVEMJzF3XV KJmIBayXRGOHdTqHflh88iG3Zer7JnmfEg43kNNxKROr+VkiGdqRzId4RqCCMptlXMczUy ss0jTl7cC6vhzNzSDN2Y3D8t4NGELkBtPNSgSuoVp7HchFRuiL3hqFOvMjlPMJXCadOEfK y2OGEb8U/S4DAaCUTEL/XSxw7Xx27DN2EQsMn+vKMXsNM9B1uM4P6ZC6GFNHL93A== Received: by filterdrecv-77869f68cc-5c259 with SMTP id filterdrecv-77869f68cc-5c259-1-64F11141-C 2023-08-31 22:16:33.341182531 +0000 UTC m=+9758416.620526600 Received: from bionic.localdomain (unknown) by geopod-ismtpd-5 (SG) with ESMTP id bnMrL5ChSTezd0Ww2sJCtg Thu, 31 Aug 2023 22:16:33.124 +0000 (UTC) From: Jonas Karlman Subject: [PATCH 1/6] phy: Set phy->dev to NULL when generic_phy_get_by_name() fails Date: Thu, 31 Aug 2023 22:16:33 +0000 (UTC) Message-ID: <20230831221629.1027552-2-jonas@kwiboo.se> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230831221629.1027552-1-jonas@kwiboo.se> References: <20230831221629.1027552-1-jonas@kwiboo.se> MIME-Version: 1.0 X-SG-EID: TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxAfZekEeQsTe+RrMu3cja6a0h2mt7nYyOzndSrIKmEAX6xOM8+rL+4VUlfGlPc/OosyfRFXPrm1w3G5mCtD2EGk4cKFuLkEl7QmB5xG/x44vFs73gmQBcDBpz8cF7HLkI0zXFMdGna87qWJmnHSm8vhFru6ko5IDEKLfmknj0Jv79AW3f70uyw3anG78rVdTLSiu To: Simon Glass , Marek Vasut , Patrice Chotard , Jan Kiszka Cc: u-boot@lists.denx.de, Jonas Karlman X-Entity-ID: P7KYpSJvGCELWjBME/J5tg== X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean generic_phy_get_by_name() does not initialize phy->dev to NULL before returning when dev_read_stringlist_search() fails. This can lead to an uninitialized or reused struct phy erroneously be report as valid by generic_phy_valid(). Fix this issue by initializing phy->dev to NULL, also extend the dm_test_phy_base test with calls to generic_phy_valid(). Fixes: b9688df3cbf4 ("drivers: phy: Set phy->dev to NULL when generic_phy_get_by_index() fails") Fixes: 868d58f69c7c ("usb: dwc3: Fix non-usb3 configurations") Signed-off-by: Jonas Karlman --- drivers/phy/phy-uclass.c | 3 +++ test/dm/phy.c | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/drivers/phy/phy-uclass.c b/drivers/phy/phy-uclass.c index 629ef3aa3de5..0baf314a3471 100644 --- a/drivers/phy/phy-uclass.c +++ b/drivers/phy/phy-uclass.c @@ -211,6 +211,9 @@ int generic_phy_get_by_name(struct udevice *dev, const char *phy_name, debug("%s(dev=%p, name=%s, phy=%p)\n", __func__, dev, phy_name, phy); + assert(phy); + phy->dev = NULL; + index = dev_read_stringlist_search(dev, "phy-names", phy_name); if (index < 0) { debug("dev_read_stringlist_search() failed: %d\n", index); diff --git a/test/dm/phy.c b/test/dm/phy.c index 4d4a083dd0fd..09329b9f71f6 100644 --- a/test/dm/phy.c +++ b/test/dm/phy.c @@ -29,7 +29,9 @@ static int dm_test_phy_base(struct unit_test_state *uts) * Get the same phy port in 2 different ways and compare. */ ut_assertok(generic_phy_get_by_name(parent, "phy1", &phy1_method1)); + ut_assert(generic_phy_valid(&phy1_method1)); ut_assertok(generic_phy_get_by_index(parent, 0, &phy1_method2)); + ut_assert(generic_phy_valid(&phy1_method2)); ut_asserteq(phy1_method1.id, phy1_method2.id); /* @@ -50,6 +52,10 @@ static int dm_test_phy_base(struct unit_test_state *uts) ut_asserteq(-ENODEV, uclass_get_device(UCLASS_PHY, 4, &dev)); ut_asserteq(-ENODATA, generic_phy_get_by_name(parent, "phy_not_existing", &phy1_method1)); + ut_assert(!generic_phy_valid(&phy1_method1)); + ut_asserteq(-ENOENT, generic_phy_get_by_index(parent, 3, + &phy1_method2)); + ut_assert(!generic_phy_valid(&phy1_method2)); return 0; } From patchwork Thu Aug 31 22:16:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 1828520 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kwiboo.se header.i=@kwiboo.se header.a=rsa-sha256 header.s=s1 header.b=dDBfZvDM; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RcFrb6mxgz1yfm for ; Fri, 1 Sep 2023 08:17:03 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 470AE86763; Fri, 1 Sep 2023 00:16:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kwiboo.se Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kwiboo.se header.i=@kwiboo.se header.b="dDBfZvDM"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 37E65865B0; Fri, 1 Sep 2023 00:16:39 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 Received: from s.wfbtzhsv.outbound-mail.sendgrid.net (s.wfbtzhsv.outbound-mail.sendgrid.net [159.183.224.104]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 55DA68659F for ; Fri, 1 Sep 2023 00:16:36 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kwiboo.se Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bounces+31435339-7456-u-boot=lists.denx.de@em2124.kwiboo.se DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type:cc:content-type:from:subject:to; s=s1; bh=/y8jN5PN+FHjc9rjFKOb/YS3RfO/kOROs6xa/HHGpOo=; b=dDBfZvDMO6zN+lT3MOOyu9vNuVfGcCbRQA70XjcGE6xkUuhuLuIODNSryZR3GpgiSd9Z 6ucvwgJ/UYc2ED25pic4NNFYnWiVP1JZ+hehAk06mPoT+WV/V8u14f6zle5Vcm0kcoGhgf GKt/pfC7XT4yD9m3VCb8Sp5TQDmbq/GYy2mmnzS09VmG243ZjBMnsCXNiFFgiNvSC0SOOo sJP1ey/ZOmFa6wa8v+FvqhZ0WPljufSbC4XkBUFhZ8jrRGQhOcPiazTTSlc7qIkU0xNTAD RdEftLIb2+aV05qlfNKRh+1xIP0JH8sknvCx7E36TUVUbdEPKSF+UDpG1uVZznOw== Received: by filterdrecv-7765c6879f-sjjbz with SMTP id filterdrecv-7765c6879f-sjjbz-1-64F11142-28 2023-08-31 22:16:34.824854964 +0000 UTC m=+1839260.597120902 Received: from bionic.localdomain (unknown) by geopod-ismtpd-5 (SG) with ESMTP id 6TwLGVw0TJ-4AqfOSWbtnA Thu, 31 Aug 2023 22:16:34.592 +0000 (UTC) From: Jonas Karlman Subject: [PATCH 2/6] phy: Set phy->dev to NULL when generic_phy_get_by_index_nodev() fails Date: Thu, 31 Aug 2023 22:16:35 +0000 (UTC) Message-ID: <20230831221629.1027552-3-jonas@kwiboo.se> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230831221629.1027552-1-jonas@kwiboo.se> References: <20230831221629.1027552-1-jonas@kwiboo.se> MIME-Version: 1.0 X-SG-EID: TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxAfZekEeQsTe+RrMu3cja6a0h50tdBjTBCRbgetR8nBFMjVUCL1wzQWsRY2MTx2YEcUWEFJEEnKrjfNlgKJllBf6QAxlMyIR95jBd32gwNbM/kUdNHWxTsGJhbTVCI0mB7igYWsCqG+qvQnpOrF43R8XkuoIr9KUgWl/2UXK645Kgpf6Z0+G+RuVRTnCN3xW0eGs To: Simon Glass , Marek Vasut , Patrice Chotard , Jean-Jacques Hiblot Cc: u-boot@lists.denx.de, Jonas Karlman X-Entity-ID: P7KYpSJvGCELWjBME/J5tg== X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Generic phy helpers typically use generic_phy_valid() to determine if the helper should perform its function on a passed struct phy. generic_phy_valid() treat any struct phy having phy->dev set as valid. With generic_phy_get_by_index_nodev() setting phy->dev to a valid struct udevice early, there can be situations where the struct phy is returned as valid when initialization in fact failed and returned an error. Fix this by setting phy->dev back to NULL when any of the calls to of_xlate ops, device_get_supply_regulator or phy_alloc_counts fail. Also extend the dm_test_phy_base test with a test where of_xlate ops fail. Fixes: 72e5016f878d ("drivers: phy: add generic PHY framework") Fixes: b9688df3cbf4 ("drivers: phy: Set phy->dev to NULL when generic_phy_get_by_index() fails") Signed-off-by: Jonas Karlman --- arch/sandbox/dts/test.dts | 11 +++++++++++ drivers/phy/phy-uclass.c | 1 + test/dm/phy.c | 12 +++++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index f351d5cb84b0..6be212403473 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -431,6 +431,11 @@ #phy-cells = <0>; }; + phy_provider3: gen_phy@3 { + compatible = "sandbox,phy"; + #phy-cells = <2>; + }; + gen_phy_user: gen_phy_user { compatible = "simple-bus"; phys = <&phy_provider0 0>, <&phy_provider0 1>, <&phy_provider1>; @@ -443,6 +448,12 @@ phy-names = "phy1", "phy2"; }; + gen_phy_user2: gen_phy_user2 { + compatible = "simple-bus"; + phys = <&phy_provider3 0 0>; + phy-names = "phy1"; + }; + some-bus { #address-cells = <1>; #size-cells = <0>; diff --git a/drivers/phy/phy-uclass.c b/drivers/phy/phy-uclass.c index 0baf314a3471..7d707c022934 100644 --- a/drivers/phy/phy-uclass.c +++ b/drivers/phy/phy-uclass.c @@ -195,6 +195,7 @@ int generic_phy_get_by_index_nodev(ofnode node, int index, struct phy *phy) return 0; err: + phy->dev = NULL; return ret; } diff --git a/test/dm/phy.c b/test/dm/phy.c index 09329b9f71f6..2abd27b22d6d 100644 --- a/test/dm/phy.c +++ b/test/dm/phy.c @@ -49,7 +49,7 @@ static int dm_test_phy_base(struct unit_test_state *uts) ut_assert(phy2.dev != phy3.dev); /* Try to get a non-existing phy */ - ut_asserteq(-ENODEV, uclass_get_device(UCLASS_PHY, 4, &dev)); + ut_asserteq(-ENODEV, uclass_get_device(UCLASS_PHY, 5, &dev)); ut_asserteq(-ENODATA, generic_phy_get_by_name(parent, "phy_not_existing", &phy1_method1)); ut_assert(!generic_phy_valid(&phy1_method1)); @@ -57,6 +57,16 @@ static int dm_test_phy_base(struct unit_test_state *uts) &phy1_method2)); ut_assert(!generic_phy_valid(&phy1_method2)); + /* Try to get a phy where of_xlate fail */ + ut_assertok(uclass_get_device_by_name(UCLASS_SIMPLE_BUS, + "gen_phy_user2", &parent)); + ut_asserteq(-EINVAL, generic_phy_get_by_name(parent, "phy1", + &phy1_method1)); + ut_assert(!generic_phy_valid(&phy1_method1)); + ut_asserteq(-EINVAL, generic_phy_get_by_index(parent, 0, + &phy1_method2)); + ut_assert(!generic_phy_valid(&phy1_method2)); + return 0; } DM_TEST(dm_test_phy_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); From patchwork Thu Aug 31 22:16:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 1828521 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kwiboo.se header.i=@kwiboo.se header.a=rsa-sha256 header.s=s1 header.b=MZHMONRg; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RcFrq09FVz1yfm for ; Fri, 1 Sep 2023 08:17:15 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9135C86680; Fri, 1 Sep 2023 00:16:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kwiboo.se Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kwiboo.se header.i=@kwiboo.se header.b="MZHMONRg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7F2CF867B6; Fri, 1 Sep 2023 00:16:41 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 Received: from s.wfbtzhsv.outbound-mail.sendgrid.net (s.wfbtzhsv.outbound-mail.sendgrid.net [159.183.224.104]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4EA87866D4 for ; Fri, 1 Sep 2023 00:16:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kwiboo.se Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bounces+31435339-7456-u-boot=lists.denx.de@em2124.kwiboo.se DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type:cc:content-type:from:subject:to; s=s1; bh=6BHmK/W9pUdXGeyJS/palVX5ectVQQz0hJaBSnRbj48=; b=MZHMONRgnyfOr42aSeSJcjdnrfxjTPIDMVZyKrXLRWRGGQQW3kjGz6VJuz+tpVUfx6sZ vDEkaZPxraidSsT/G3NwyW0v3fFwEFljryM06cc2i2+L45ujJGCvSfU8MSMbDa0ACJF4mR ITrOhsOwjcWAxB0Y9YLBjuj2x3kvgKsyY9xlbvtF52m0L/9VMyk6m1RNRH4xRZYAg9ZwIK auoOT26jlTgnIJrlq1qtbTcWz/Xps3G0n80dvzFP6gPn5+Xl12WS+BUuZFX/v5Us690pHK iNH0MU1z8qYQpkCkiZdhP2dqHMeM5SzkGcPK2v6gV3ZBjVyyzi4C0iueVo8XayfA== Received: by filterdrecv-7765c6879f-kx8nr with SMTP id filterdrecv-7765c6879f-kx8nr-1-64F11143-2C 2023-08-31 22:16:36.011821799 +0000 UTC m=+1839260.555387837 Received: from bionic.localdomain (unknown) by geopod-ismtpd-5 (SG) with ESMTP id CwQmS9dNRKOgkCDQuYlFag Thu, 31 Aug 2023 22:16:35.781 +0000 (UTC) From: Jonas Karlman Subject: [PATCH 3/6] usb: dwc3: Use generic_phy_valid() helper Date: Thu, 31 Aug 2023 22:16:36 +0000 (UTC) Message-ID: <20230831221629.1027552-4-jonas@kwiboo.se> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230831221629.1027552-1-jonas@kwiboo.se> References: <20230831221629.1027552-1-jonas@kwiboo.se> MIME-Version: 1.0 X-SG-EID: TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxAfZekEeQsTe+RrMu3cja6a0h16m/e1lcIXrFZuo1HlFbXffLtJbfcIrAr5VA5aD3rM4uEwr0oBOU+u5HpqcFO9e8EPNtozlfL47VoQmcIyGFITtSZBPIAxIMbmQPvk4RGwiBZ+RsAaPjnLGoVfqYzzg+I4FyLhwFx+pd6h2Jb6bef/hlMKK5qZTd+ODb8XPhbVS To: Simon Glass , Marek Vasut , Patrice Chotard , Michal Simek Cc: u-boot@lists.denx.de, Jonas Karlman X-Entity-ID: P7KYpSJvGCELWjBME/J5tg== X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The documentation for struct phy state that "The content of the structure is managed solely by the PHY API and PHY drivers". Change to use the generic_phy_valid() helper to check if phy is valid. Also remove setting phy->dev to NULL now that generic_phy_get_by_name() properly initialize phy->dev to NULL. Fixes: 142d50fbce7c ("usb: dwc3: Add support for usb3-phy PHY configuration") Signed-off-by: Jonas Karlman --- drivers/usb/dwc3/dwc3-generic.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c index 7f0af05855ab..3997b9dbff43 100644 --- a/drivers/usb/dwc3/dwc3-generic.c +++ b/drivers/usb/dwc3/dwc3-generic.c @@ -541,8 +541,6 @@ int dwc3_glue_probe(struct udevice *dev) } else if (ret != -ENOENT && ret != -ENODATA) { debug("could not get phy (err %d)\n", ret); return ret; - } else { - phy.dev = NULL; } glue->regs = dev_read_addr_size_index(dev, 0, &glue->size); @@ -555,7 +553,7 @@ int dwc3_glue_probe(struct udevice *dev) if (ret) return ret; - if (phy.dev) { + if (generic_phy_valid(&phy)) { ret = generic_phy_power_on(&phy); if (ret) return ret; From patchwork Thu Aug 31 22:16:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 1828522 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kwiboo.se header.i=@kwiboo.se header.a=rsa-sha256 header.s=s1 header.b=XYBgCNHa; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RcFs22FnJz1yfm for ; Fri, 1 Sep 2023 08:17:26 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D8A8D867C3; Fri, 1 Sep 2023 00:16:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kwiboo.se Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kwiboo.se header.i=@kwiboo.se header.b="XYBgCNHa"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CC788866DA; Fri, 1 Sep 2023 00:16:41 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.2 Received: from s.wrqvwxzv.outbound-mail.sendgrid.net (s.wrqvwxzv.outbound-mail.sendgrid.net [149.72.154.232]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 08B4786680 for ; Fri, 1 Sep 2023 00:16:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kwiboo.se Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bounces+31435339-7456-u-boot=lists.denx.de@em2124.kwiboo.se DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type:cc:content-type:from:subject:to; s=s1; bh=f8iSGl9Mq/SMKQJywosgipuAmjLKo1uP1b1FIxQ+p/c=; b=XYBgCNHaBouvXAGOE7JfIFVOIkce+AV3V9qhtMXYmOesIeFKOmQR9jaqF5skFtnQHQ7c M1acpuf8GHP+XJ16tFDQPhBfmVpMg5pUeRbOsFnR/+DIl/LHaj6eEc6KFgsHlmeBtBXDVj 0mhvpufg2QqMGGxtOOG2qFC83S46khlch6yOIHs3XX/ZSW0czqeJRafJSbSEYxy5FITX0M 17HvW7bftpazXWbhTm9wTCKZsQkXUens4OoIOgvvITLWDJXI/c/iipUkzPRXMuXJj8G3c5 c5JB4mwnpo5LxN6TKYPONpUE26kcJ3dCUf8MR8K4+JC3Q9dBch2OXMz3+hJQ4+xA== Received: by filterdrecv-77869f68cc-4fn5s with SMTP id filterdrecv-77869f68cc-4fn5s-1-64F11145-C 2023-08-31 22:16:37.271762182 +0000 UTC m=+7172154.699490775 Received: from bionic.localdomain (unknown) by geopod-ismtpd-5 (SG) with ESMTP id Ff4zoASMSXeGuwAzZMdOKw Thu, 31 Aug 2023 22:16:37.025 +0000 (UTC) From: Jonas Karlman Subject: [PATCH 4/6] scsi: ceva: Use generic_phy_valid() helper Date: Thu, 31 Aug 2023 22:16:37 +0000 (UTC) Message-ID: <20230831221629.1027552-5-jonas@kwiboo.se> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230831221629.1027552-1-jonas@kwiboo.se> References: <20230831221629.1027552-1-jonas@kwiboo.se> MIME-Version: 1.0 X-SG-EID: TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxAfZekEeQsTe+RrMu3cja6a0h/jQ2gfkz8xq60x+4GV1YjaO3Xl0e0ivUmPIF7zSw3XLCXtGffTvDlafVcNPTBZa9kIuojdQiYu7gDWjMijKSPOxv/UtNBlrDHjxgZtyuV6EYekYAha3qgm3d8wqLtNWwBGOhyTYjy+MAmwB8XbePMi8DcwhakBtMTnQhIzy3ld9 To: Simon Glass , Marek Vasut , Patrice Chotard , Vladimir Oltean , Michal Simek Cc: u-boot@lists.denx.de, Jonas Karlman X-Entity-ID: P7KYpSJvGCELWjBME/J5tg== X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The documentation for struct phy state that "The content of the structure is managed solely by the PHY API and PHY drivers". Change to use the generic_phy_valid() helper to check if phy is valid. Fixes: f6f5451d469b ("scsi: ceva: Enable PHY and reset support") Signed-off-by: Jonas Karlman --- drivers/ata/sata_ceva.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ata/sata_ceva.c b/drivers/ata/sata_ceva.c index 47366438fdfd..7769d4f99efd 100644 --- a/drivers/ata/sata_ceva.c +++ b/drivers/ata/sata_ceva.c @@ -217,7 +217,7 @@ static int sata_ceva_probe(struct udevice *dev) } } - if (phy.dev) { + if (generic_phy_valid(&phy)) { dev_dbg(dev, "Perform PHY power on\n"); ret = generic_phy_power_on(&phy); if (ret) { From patchwork Thu Aug 31 22:16:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 1828523 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kwiboo.se header.i=@kwiboo.se header.a=rsa-sha256 header.s=s1 header.b=EGa66oBv; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RcFsD6Bryz1yfm for ; Fri, 1 Sep 2023 08:17:36 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2B12F8669D; Fri, 1 Sep 2023 00:16:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kwiboo.se Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kwiboo.se header.i=@kwiboo.se header.b="EGa66oBv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 223A58675B; Fri, 1 Sep 2023 00:16:44 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_MSPIKE_BL,RCVD_IN_MSPIKE_L3,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.2 Received: from s.wrqvtzvf.outbound-mail.sendgrid.net (s.wrqvtzvf.outbound-mail.sendgrid.net [149.72.126.143]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2D22886758 for ; Fri, 1 Sep 2023 00:16:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kwiboo.se Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bounces+31435339-7456-u-boot=lists.denx.de@em2124.kwiboo.se DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type:cc:content-type:from:subject:to; s=s1; bh=iaqCMqOq1485ooTpT6XocQpEbGEuOVIQy333gC53MGY=; b=EGa66oBvf2dywk+vQzqhXUN6RC088GPAgi5E1MwzI8GJcNNpO6KJ2AkpFMaGxkHUv+QJ D4ATn35w62Xuyk1VLJbMRN69eAIw3G61KQdCNVlNcCFJEDTprWtC9tfozunwqfPfRctnUg mpkOGH8DZ8Hr7eudJ5dzXb+8CfnhAuYWhoQrwTnlvZIBcmXrQpamBHRjMPTVekJGsrVRC8 I/5w8HSylf0KxlRvom+qR9m3Bk1ziORl7UfSVond7dvVpANq37pulu8BpYpW3RsoVQa9ba GZnDM3gmzzdNDONEdYf0JmgTkkc2oHHjGgrRhMz64zaB5bcEC3E3aFwUQidymVzQ== Received: by filterdrecv-66949dbc98-rr4mv with SMTP id filterdrecv-66949dbc98-rr4mv-1-64F11146-1B 2023-08-31 22:16:38.617859166 +0000 UTC m=+5859654.382621936 Received: from bionic.localdomain (unknown) by geopod-ismtpd-5 (SG) with ESMTP id I9WOAx_tSb-MBerf8zRz2w Thu, 31 Aug 2023 22:16:38.351 +0000 (UTC) From: Jonas Karlman Subject: [PATCH 5/6] net: zynq: Use generic_phy_valid() helper Date: Thu, 31 Aug 2023 22:16:38 +0000 (UTC) Message-ID: <20230831221629.1027552-6-jonas@kwiboo.se> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230831221629.1027552-1-jonas@kwiboo.se> References: <20230831221629.1027552-1-jonas@kwiboo.se> MIME-Version: 1.0 X-SG-EID: TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxAfZekEeQsTe+RrMu3cja6a0h5YK+TTeRxfOugVvPeCP9HAgXzXxIuABJ7necMXLFbKm16XZLsLRL+R4vnj6N+wFTbkTkNZEKNPDT1B8il6v0mYST0tw+FdJuDutb+dBFQptkVUOBmYwHPCT9P6lH0wjCwR5RWx+rVR/3vPvJ8aMXoH45y+XN6LrO0PEBRSJ7jTo To: Simon Glass , Marek Vasut , Patrice Chotard , Michal Simek , Joe Hershberger , Ramon Fried , Sean Anderson Cc: u-boot@lists.denx.de, Jonas Karlman X-Entity-ID: P7KYpSJvGCELWjBME/J5tg== X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The documentation for struct phy state that "The content of the structure is managed solely by the PHY API and PHY drivers". Change to use the generic_phy_valid() helper to check if phy is valid. Fixes: 10c50b1facbf ("net: zynq: Add support for PHY configuration in SGMII mode") Signed-off-by: Jonas Karlman --- drivers/net/zynq_gem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c index f3cdfb0275d0..3377e669f2f6 100644 --- a/drivers/net/zynq_gem.c +++ b/drivers/net/zynq_gem.c @@ -890,7 +890,8 @@ static int zynq_gem_probe(struct udevice *dev) if (ret) goto err3; - if (priv->interface == PHY_INTERFACE_MODE_SGMII && phy.dev) { + if (priv->interface == PHY_INTERFACE_MODE_SGMII && + generic_phy_valid(&phy)) { if (IS_ENABLED(CONFIG_DM_ETH_PHY)) { if (device_is_compatible(dev, "cdns,zynqmp-gem") || device_is_compatible(dev, "xlnx,zynqmp-gem")) { From patchwork Thu Aug 31 22:16:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 1828524 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kwiboo.se header.i=@kwiboo.se header.a=rsa-sha256 header.s=s1 header.b=IAFBy3Y0; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RcFsR4gHfz1yfm for ; Fri, 1 Sep 2023 08:17:47 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 705778678A; Fri, 1 Sep 2023 00:16:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kwiboo.se Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kwiboo.se header.i=@kwiboo.se header.b="IAFBy3Y0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3BF128675B; Fri, 1 Sep 2023 00:16:45 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.2 Received: from s.wfbtzhsv.outbound-mail.sendgrid.net (s.wfbtzhsv.outbound-mail.sendgrid.net [159.183.224.104]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 638148679F for ; Fri, 1 Sep 2023 00:16:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kwiboo.se Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bounces+31435339-7456-u-boot=lists.denx.de@em2124.kwiboo.se DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type:cc:content-type:from:subject:to; s=s1; bh=PomkGehBG5LFH9ffwETRMlm0emNiF++0IEZik0tu4lc=; b=IAFBy3Y08CnCgolMfFUxGbYK9Uim+4ba71HKK3neCwXZCCCDdf/6WZZZN6nw5Vv2TTlW akVDYiMNkVsQ+PlSQxKYPiRrSXfj+QR1SBwB4UITAATy6r/VKm5+wN50IABLJvN+d7/0GC 6V0yt9M9SfcN3E3BONg9lbRHDjQSVujizw95Q06ZAnyG5KaNhQeorFWWAxN9rXWUGDdsGq VmUw4rs8nt7vzqfnz19QsAaxQH4Ey9n9gfe582sSaBs/nK2g3K9YL+wwUoTyYnFOoCJq/M bKbNd3LduWRuFk6nP5CYyfmAD4atGbVFk17WeEwgWqdLYtoo+JXkvWFXt3c/rUIA== Received: by filterdrecv-66949dbc98-rr4mv with SMTP id filterdrecv-66949dbc98-rr4mv-1-64F11147-30 2023-08-31 22:16:39.972610236 +0000 UTC m=+5859655.737372949 Received: from bionic.localdomain (unknown) by geopod-ismtpd-5 (SG) with ESMTP id IADmaorORHiY7AGtLHe-IQ Thu, 31 Aug 2023 22:16:39.779 +0000 (UTC) From: Jonas Karlman Subject: [PATCH 6/6] video: rockchip: dw_mipi_dsi: Use generic_phy_valid() helper Date: Thu, 31 Aug 2023 22:16:40 +0000 (UTC) Message-ID: <20230831221629.1027552-7-jonas@kwiboo.se> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230831221629.1027552-1-jonas@kwiboo.se> References: <20230831221629.1027552-1-jonas@kwiboo.se> MIME-Version: 1.0 X-SG-EID: TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxAfZekEeQsTe+RrMu3cja6a0hxlTWx0iFLJM6wghoCM4D9qIihyM+88l2hWDN85acQa6I1g1eH/ZbWmrdBg1YYy/RSf1PL4asM8RaDiu1RJk2GQHz5TQqhEu9TmEMulTNW/7bMmpwcqbPzzIFU1p0MsKp2kSzbWXvdRocCBEqxDBxKEGREQ/75+eusz+ewXSwOOU To: Simon Glass , Marek Vasut , Patrice Chotard , Anatolij Gustschin , Philipp Tomsich , Kever Yang , Ondrej Jirman Cc: u-boot@lists.denx.de, Jonas Karlman X-Entity-ID: P7KYpSJvGCELWjBME/J5tg== X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The documentation for struct phy state that "The content of the structure is managed solely by the PHY API and PHY drivers". Change to use the generic_phy_valid() helper to check if phy is valid. Fixes: b7d8d40346f2 ("video: rockchip: dw_mipi_dsi: Fix external phy existence check") Signed-off-by: Jonas Karlman Reviewed-by: Kever Yang --- drivers/video/rockchip/dw_mipi_dsi_rockchip.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/video/rockchip/dw_mipi_dsi_rockchip.c b/drivers/video/rockchip/dw_mipi_dsi_rockchip.c index 0852b53ebed5..1a5ab781e3f1 100644 --- a/drivers/video/rockchip/dw_mipi_dsi_rockchip.c +++ b/drivers/video/rockchip/dw_mipi_dsi_rockchip.c @@ -377,7 +377,7 @@ static int dsi_phy_init(void *priv_data) struct dw_rockchip_dsi_priv *dsi = dev_get_priv(dev); int ret, i, vco; - if (dsi->phy.dev) { + if (generic_phy_valid(&dsi->phy)) { ret = generic_phy_configure(&dsi->phy, &dsi->phy_opts); if (ret) { dev_err(dsi->dsi_host, @@ -559,7 +559,7 @@ dw_mipi_dsi_get_lane_mbps(void *priv_data, struct display_timing *timings, } /* for external phy only the mipi_dphy_config is necessary */ - if (dsi->phy.dev) { + if (generic_phy_valid(&dsi->phy)) { phy_mipi_dphy_get_default_config(timings->pixelclock.typ * 10 / 8, bpp, lanes, &dsi->phy_opts); @@ -859,7 +859,7 @@ static int dw_mipi_dsi_rockchip_probe(struct udevice *dev) } /* Get a ref clock only if not using an external phy. */ - if (priv->phy.dev) { + if (generic_phy_valid(&priv->phy)) { dev_dbg(dev, "setting priv->ref to NULL\n"); priv->ref = NULL;