From: Bin Meng Date: Sun, 14 Mar 2021 12:14:52 +0000 (+0800) Subject: net: phy: Simplify the logic of phy_connect_fixed() X-Git-Tag: v2025.01-rc5-pxa1908~1920^2~32 X-Git-Url: http://git.dujemihanovic.xyz/login.html?a=commitdiff_plain;h=676fbd3dbf6b74b1369e0fe4baa63d37bb1d8684;p=u-boot.git net: phy: Simplify the logic of phy_connect_fixed() 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 Reviewed-by: Priyanka Jain --- 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; }