]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: phylink: use phylink_expects_phy() in phylink_fwnode_phy_connect()
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Tue, 24 Mar 2026 10:46:52 +0000 (10:46 +0000)
committerJakub Kicinski <kuba@kernel.org>
Fri, 27 Mar 2026 01:24:56 +0000 (18:24 -0700)
The tests in phylink_expects_phy() and phylink_fwnode_phy_connect() are
identical (by intention). Use phylink_expects_phy() to decide whether
to ignore a call to phylink_fwnode_phy_connect().

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Link: https://patch.msgid.link/E1w4zHg-0000000DmC4-2oyb@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/phy/phylink.c

index f80cd13c8e3287026a0064747b36311378227c9c..087ac63f9193d790d20bf5739965669a7adf654c 100644 (file)
@@ -2295,14 +2295,12 @@ int phylink_fwnode_phy_connect(struct phylink *pl,
        struct phy_device *phy_dev;
        int ret;
 
-       /* Fixed links and 802.3z are handled without needing a PHY */
-       if (pl->cfg_link_an_mode == MLO_AN_FIXED ||
-           (pl->cfg_link_an_mode == MLO_AN_INBAND &&
-            phy_interface_mode_is_8023z(pl->link_interface)))
+       if (!phylink_expects_phy(pl))
                return 0;
 
        phy_fwnode = fwnode_get_phy_node(fwnode);
        if (IS_ERR(phy_fwnode)) {
+               /* PHY mode requires a PHY to be specified. */
                if (pl->cfg_link_an_mode == MLO_AN_PHY)
                        return -ENODEV;
                return 0;