]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: stmmac: use priv->plat->phy_interface directly
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Thu, 1 May 2025 11:45:06 +0000 (12:45 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sat, 3 May 2025 01:25:08 +0000 (18:25 -0700)
Avoid using a local variable for priv->plat->phy_interface as this
may be modified in the .get_interfaces() method added in a future
commit.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/E1uASLi-0021QX-HG@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

index fe7f9e3a92a56f369fcd1df56f56cccbb028ea44..ac6ab121eb330ef5518649709ca2590cc659a3f2 100644 (file)
@@ -1258,7 +1258,6 @@ static int stmmac_init_phy(struct net_device *dev)
 static int stmmac_phy_setup(struct stmmac_priv *priv)
 {
        struct stmmac_mdio_bus_data *mdio_bus_data;
-       int mode = priv->plat->phy_interface;
        struct phylink_config *config;
        struct fwnode_handle *fwnode;
        struct phylink_pcs *pcs;
@@ -1287,7 +1286,7 @@ static int stmmac_phy_setup(struct stmmac_priv *priv)
        /* Set the platform/firmware specified interface mode. Note, phylink
         * deals with the PHY interface mode, not the MAC interface mode.
         */
-       __set_bit(mode, config->supported_interfaces);
+       __set_bit(priv->plat->phy_interface, config->supported_interfaces);
 
        /* If we have an xpcs, it defines which PHY interfaces are supported. */
        if (priv->hw->xpcs)
@@ -1315,7 +1314,8 @@ static int stmmac_phy_setup(struct stmmac_priv *priv)
        if (!fwnode)
                fwnode = dev_fwnode(priv->device);
 
-       phylink = phylink_create(config, fwnode, mode, &stmmac_phylink_mac_ops);
+       phylink = phylink_create(config, fwnode, priv->plat->phy_interface,
+                                &stmmac_phylink_mac_ops);
        if (IS_ERR(phylink))
                return PTR_ERR(phylink);