]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: phy: use new iterator mdiobus_for_each_phy in mdiobus_prevent_c45_scan
authorHeiner Kallweit <hkallweit1@gmail.com>
Sat, 25 Oct 2025 18:52:56 +0000 (20:52 +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>
Link: https://patch.msgid.link/6d792b1e-d23d-4b7e-a94f-89c6617b620f@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/phy/mdio_bus_provider.c

index a2391d4b7e5c8fc6293fec46924c11f39b35a9c6..4b0637405740e789d7251f201eef93fe20db1011 100644 (file)
@@ -249,20 +249,15 @@ static int mdiobus_scan_bus_c45(struct mii_bus *bus)
  */
 static bool mdiobus_prevent_c45_scan(struct mii_bus *bus)
 {
-       int i;
+       struct phy_device *phydev;
 
-       for (i = 0; i < PHY_MAX_ADDR; i++) {
-               struct phy_device *phydev;
-               u32 oui;
-
-               phydev = mdiobus_get_phy(bus, i);
-               if (!phydev)
-                       continue;
-               oui = phydev->phy_id >> 10;
+       mdiobus_for_each_phy(bus, phydev) {
+               u32 oui = phydev->phy_id >> 10;
 
                if (oui == MICREL_OUI)
                        return true;
        }
+
        return false;
 }