> +struct phy_device *find_phy_device(struct fwnode_handle *fwnode)

We should consider the naming convention. All phylib phy functions
start with phy_. We already have phy_find_first(), so maybe
phy_find_by_fwnode() to follow the pattern?

> +{
> +     struct fwnode_handle *fwnode_mdio;
> +     struct platform_device *pdev;
> +     struct mii_bus *mdio;
> +     struct device *dev;
> +     int addr;
> +     int err;
> +
> +     fwnode_mdio = fwnode_find_reference(fwnode, "mdio-handle", 0);
> +     dev = bus_find_device_by_fwnode(&platform_bus_type, fwnode_mdio);
> +     if (IS_ERR_OR_NULL(dev))
> +             return NULL;
> +     pdev =  to_platform_device(dev);
> +     mdio = platform_get_drvdata(pdev);

That is a big assumption to make. Please take a look at the
class_find_device_by_*() functions, as used by of_mdio_find_bus(),
mdio_find_bus(), etc.

        Andrew

Reply via email to