]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: fec: use new iterator mdiobus_for_each_phy
authorHeiner Kallweit <hkallweit1@gmail.com>
Sat, 25 Oct 2025 18:50:41 +0000 (20:50 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 30 Oct 2025 02:00:34 +0000 (19:00 -0700)
Use new iterator mdiobus_for_each_phy() to simplify the code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Wei Fang <wei.fang@nxp.com>
Link: https://patch.msgid.link/65eb9490-5666-4b4a-8d26-3fca738b1315@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/freescale/fec_main.c

index 4875101c4f3f567838a9bc6be992ed3cce20bf87..024dd443bfbc3686462e5245db9634062a1de9cd 100644 (file)
@@ -2548,7 +2548,6 @@ static int fec_enet_mii_init(struct platform_device *pdev)
        int err = -ENXIO;
        u32 mii_speed, holdtime;
        u32 bus_freq;
-       int addr;
 
        /*
         * The i.MX28 dual fec interfaces are not equal.
@@ -2663,11 +2662,8 @@ static int fec_enet_mii_init(struct platform_device *pdev)
        of_node_put(node);
 
        /* find all the PHY devices on the bus and set mac_managed_pm to true */
-       for (addr = 0; addr < PHY_MAX_ADDR; addr++) {
-               phydev = mdiobus_get_phy(fep->mii_bus, addr);
-               if (phydev)
-                       phydev->mac_managed_pm = true;
-       }
+       mdiobus_for_each_phy(fep->mii_bus, phydev)
+               phydev->mac_managed_pm = true;
 
        mii_cnt++;