From patchwork Sun Mar 14 05:14:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1452626 X-Patchwork-Delegate: priyanka.jain@nxp.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: 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=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=mxChgCvi; dkim-atps=neutral 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DynqQ0cW7z9sRR for ; Sun, 14 Mar 2021 16:17:22 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0D97C828BD; Sun, 14 Mar 2021 06:15:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com 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=gmail.com header.i=@gmail.com header.b="mxChgCvi"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C4443828B3; Sun, 14 Mar 2021 06:15:52 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) (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 0FD3482879 for ; Sun, 14 Mar 2021 06:15:50 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pg1-x52b.google.com with SMTP id v14so11570285pgq.2 for ; Sat, 13 Mar 2021 21:15:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0ZXmt8jKZwxm6+L+pJ/nWf2tEGdFFmwV9barsES5KKo=; b=mxChgCvigaBZf1nc08LOy3Zwjt1nlaJBB0iYP/f88AbBun25EfLMOJ3sb7Z742qFHM zii03M5+IK54tH/L/GPupMdPmx7P6DPcv2Dq6M+zIV8k99jso22/kT8V63TKSnll57Mb QHWi6w4FqMdAfVVdXp8ocq4ivuhOctZtMZd26LhhyrR8jstcLJQVkz+kq2o72Jpm6HNS SM7ASeub2cz/phvj0DSf00nyR8C0xwyMlO8JqavABByB4cP7LoeASgTiwbIzsBqIA0xz BK1NplwH2p5G0Uf6lKI4QeqDKPG2zVZHCc04jkXPvuqKUY54pQOggDQmBWyArRA+JOWT R0Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0ZXmt8jKZwxm6+L+pJ/nWf2tEGdFFmwV9barsES5KKo=; b=D3cCw14r3YyqKSBX9t5rKIwWIMQFNZ7pLvUmtiityuAOkOFiou8OZIlQX4yJXEYoFh G+jd0F8HRNQ8rK4fTBXO0oTSB4zzbikFNCFLSGdX/2VH1RD/HJiXKxuWyBJ68WIio58Q Itu6isLq2UtZfJZ02Pr3RFJIe2F4yDA9ub4Gj4s4JBJ8v81QcJQo7RzwEU9265psAVnh UZ6Qv4wQ4l9GfFjThIxo6qezcflwqCVqt3khdtqVp04eLXtsprH6TkCToIJPewuqVAlz 4tMu/fg0XqCy2a1ZBQlaS2zDKQ84CyahPaR86HuSIHcclkc+XhnhM0kj7CoAaIxheKpz OpiA== X-Gm-Message-State: AOAM5301w3AqI7wMsE62mKx7biwt2BccBeSGldch896ZpTsSwPwUf9ST +aLJWTGxAXilwT7mqnaAdSo= X-Google-Smtp-Source: ABdhPJyvLNLDO+BH5kIeIDRIWnB3L5u5aMNun2BIlPUXnzhJHOzWdypph1pVO7p3FGeL/sw3w6V0Sg== X-Received: by 2002:a62:7f45:0:b029:205:9617:a819 with SMTP id a66-20020a627f450000b02902059617a819mr2664057pfd.17.1615698948694; Sat, 13 Mar 2021 21:15:48 -0800 (PST) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id 186sm10497309pfb.143.2021.03.13.21.15.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Mar 2021 21:15:48 -0800 (PST) From: Bin Meng To: Priyanka Jain , Ramon Fried , Simon Glass , u-boot@lists.denx.de Cc: Tom Rini , Vladimir Oltean , Bin Meng Subject: [PATCH v3 08/22] net: phy: Simplify the logic of phy_connect_fixed() Date: Sun, 14 Mar 2021 13:14:56 +0800 Message-Id: <20210314051510.26628-9-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210314051510.26628-1-bmeng.cn@gmail.com> References: <20210314051510.26628-1-bmeng.cn@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.4 at phobos.denx.de X-Virus-Status: Clean Simplify the logic of phy_connect_fixed() by using the new API ofnode_phy_is_fixed_link(), which brings additional bonus of supporting the old DT bindings. Signed-off-by: Bin Meng Reviewed-by: Ramon Fried Reviewed-by: Vladimir Oltean --- (no changes since v1) drivers/net/phy/phy.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index c7cdf64a0a..dcdef9e661 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -1008,15 +1009,14 @@ static struct phy_device *phy_connect_fixed(struct mii_dev *bus, phy_interface_t interface) { ofnode node = dev_ofnode(dev), subnode; - struct phy_device *phydev; - - subnode = ofnode_find_subnode(node, "fixed-link"); - if (!ofnode_valid(subnode)) - return NULL; + struct phy_device *phydev = NULL; - phydev = phy_device_create(bus, 0, PHY_FIXED_ID, false, interface); - if (phydev) - phydev->node = subnode; + if (ofnode_phy_is_fixed_link(node, &subnode)) { + phydev = phy_device_create(bus, 0, PHY_FIXED_ID, + false, interface); + if (phydev) + phydev->node = subnode; + } return phydev; }