[PATCH net-next] net: stmmac: mdio: use phy_find_first to simplify stmmac_mdio_register
Andrew Lunn
andrew at lunn.ch
Fri Oct 17 13:39:04 PDT 2025
> - int addr, found, max_addr;
> + struct phy_device *phydev;
> + int addr, max_addr;
>
> if (!mdio_bus_data)
> return 0;
> @@ -668,41 +669,31 @@ int stmmac_mdio_register(struct net_device *ndev)
> if (priv->plat->phy_node || mdio_node)
> goto bus_register_done;
>
> - found = 0;
> - for (addr = 0; addr < max_addr; addr++) {
With this loop gone...
> + phydev = phy_find_first(new_bus);
> + if (!phydev || phydev->mdio.addr >= max_addr) {
> dev_warn(dev, "No PHY found\n");
> err = -ENODEV;
> goto no_phy_found;
> }
>
> + /*
> + * If an IRQ was provided to be assigned after
> + * the bus probe, do it here.
> + */
> + if (!mdio_bus_data->irqs && mdio_bus_data->probed_phy_irq > 0) {
> + new_bus->irq[addr] = mdio_bus_data->probed_phy_irq;
... what is setting addr to a value?
Andrew
More information about the linux-arm-kernel
mailing list