Re: [net-next RFC PATCH 1/6] net: phy: add support for defining multiple PHY IDs in PHY driver

From: Andrew Lunn
Date: Sun Feb 18 2024 - 17:07:39 EST


> With the allocated mdio_devic_id it would result in this snipped
>
> const struct mdio_device_id *driver_dev_id;
> struct mdio_device_id *dev_id;
> int err = 0;
>
> phydev->drv = phydrv;
> /* Fill the mdio_device_id for the PHY istance.
> * If PHY driver provide an array of PHYs, search the right one,
> * in the other case fill it with the phy_driver data.
> */
> if (phy_driver_match(phydrv, phydev, &driver_dev_id) && driver_dev_id) {
> /* If defined, overwrite the PHY driver dev name with a
> * more specific one from the matching dev_id.
> */
> phydev->dev_id = driver_dev_id;
> if (driver_dev_id->name)
> drv->name = driver_dev_id->name;

What is drv here? You should not be changing the name within the
driver structure, since that is shared by a number of devices.

Andrew