From: Heiner Kallweit Date: Sat, 25 Oct 2025 18:52:56 +0000 (+0200) Subject: net: phy: use new iterator mdiobus_for_each_phy in mdiobus_prevent_c45_scan X-Git-Tag: v6.19-rc1~170^2~274^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d4780abb8cce3692f24ea2f1cf162092075e91e8;p=thirdparty%2Flinux.git net: phy: use new iterator mdiobus_for_each_phy in mdiobus_prevent_c45_scan Use new iterator mdiobus_for_each_phy() to simplify the code. Signed-off-by: Heiner Kallweit Link: https://patch.msgid.link/6d792b1e-d23d-4b7e-a94f-89c6617b620f@gmail.com Signed-off-by: Jakub Kicinski --- diff --git a/drivers/net/phy/mdio_bus_provider.c b/drivers/net/phy/mdio_bus_provider.c index a2391d4b7e5c8..4b0637405740e 100644 --- a/drivers/net/phy/mdio_bus_provider.c +++ b/drivers/net/phy/mdio_bus_provider.c @@ -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; }