Re: [PATCH net-next v3 01/14] net: phy: Helper to read and write through C45 without lock
From: Andrew Lunn
Date: Fri May 29 2026 - 18:12:25 EST
> +/**
> + * genphy_phy_read_mmd - Helper for reading a register without lock
> + * from the given MMD and PHY.
> + * @phydev: The phy_device struct
> + * @devnum: The MMD to read from
> + * @regnum: The register on the MMD to read
> + *
> + * Description: PHYs can have both C22 and C45 registers space. Once PHY
> + * is discovered via C22 bus protocol, it uses C22 indirect access to
> + * access C45 registers. Some PHYs, like 10Base-T1S PHYs defined by OPEN
> + * Alliance 10BASE‑T1x, support only direct access.
> + *
> + * If PHY indicates C45 support through DTS entry, it avoid C22 APIs
> + * entirely and therefore generic MDIO registers are inaccessible.
> + *
> + * MDIO bus isn't locked here because when called through read_mmd
> + * callback of phy_driver, caller is expected to lock the bus as
> + * implemented in phy_read_mmd.
> + */
> +int genphy_phy_read_mmd(struct phy_device *phydev, int devnum,
> + u16 regnum)
> +{
> + struct mii_bus *bus = phydev->mdio.bus;
> + int addr = phydev->mdio.addr;
You could add:
lockdep_assert_held(&bus->mdio_lock);
which is stronger than the documentation.
Otherwise this looks good.
Reviewed-by: Andrew Lunn <andrew@xxxxxxx>
Andrew