of: mdio: Refactor of_phy_find_device()
authorCalvin Johnson <calvin.johnson@oss.nxp.com>
Fri, 11 Jun 2021 10:53:50 +0000 (13:53 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 11 Jun 2021 20:08:52 +0000 (13:08 -0700)
Refactor of_phy_find_device() to use fwnode_phy_find_device().

Signed-off-by: Calvin Johnson <calvin.johnson@oss.nxp.com>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Acked-by: Grant Likely <grant.likely@arm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/mdio/of_mdio.c

index 6ef8b6e..0ba1158 100644 (file)
@@ -360,18 +360,7 @@ EXPORT_SYMBOL(of_mdio_find_device);
  */
 struct phy_device *of_phy_find_device(struct device_node *phy_np)
 {
-       struct mdio_device *mdiodev;
-
-       mdiodev = of_mdio_find_device(phy_np);
-       if (!mdiodev)
-               return NULL;
-
-       if (mdiodev->flags & MDIO_DEVICE_FLAG_PHY)
-               return to_phy_device(&mdiodev->dev);
-
-       put_device(&mdiodev->dev);
-
-       return NULL;
+       return fwnode_phy_find_device(of_fwnode_handle(phy_np));
 }
 EXPORT_SYMBOL(of_phy_find_device);