diff mbox series

[RFC,41/57] drivers: net: phy: Use class_find_device_by_of_node helper

Message ID 1559577023-558-42-git-send-email-suzuki.poulose@arm.com
State New
Headers show
Series [RFC,01/57] drivers: s390/cio: Use driver_for_each_device | expand

Commit Message

Suzuki K Poulose June 3, 2019, 3:50 p.m. UTC
Use the generic helper to find a device matching the of_node.

Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Heiner Kallweit <hkallweit1@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>

---
 drivers/net/phy/mdio_bus.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

-- 
2.7.4

Comments

Andrew Lunn June 3, 2019, 4:02 p.m. UTC | #1
On Mon, Jun 03, 2019 at 04:50:07PM +0100, Suzuki K Poulose wrote:
> Use the generic helper to find a device matching the of_node.

> 

> Cc: Andrew Lunn <andrew@lunn.ch>

> Cc: Florian Fainelli <f.fainelli@gmail.com>

> Cc: Heiner Kallweit <hkallweit1@gmail.com>

> Cc: "David S. Miller" <davem@davemloft.net>

> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>


Reviewed-by: Andrew Lunn <andrew@lunn.ch>


    Andrew
diff mbox series

Patch

diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index bd04fe7..c868a40 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -262,11 +262,6 @@  static struct class mdio_bus_class = {
 };
 
 #if IS_ENABLED(CONFIG_OF_MDIO)
-/* Helper function for of_mdio_find_bus */
-static int of_mdio_bus_match(struct device *dev, const void *mdio_bus_np)
-{
-	return dev->of_node == mdio_bus_np;
-}
 /**
  * of_mdio_find_bus - Given an mii_bus node, find the mii_bus.
  * @mdio_bus_np: Pointer to the mii_bus.
@@ -287,9 +282,7 @@  struct mii_bus *of_mdio_find_bus(struct device_node *mdio_bus_np)
 	if (!mdio_bus_np)
 		return NULL;
 
-	d = class_find_device(&mdio_bus_class, NULL,  mdio_bus_np,
-			      of_mdio_bus_match);
-
+	d = class_find_device_by_of_node(&mdio_bus_class, NULL,  mdio_bus_np);
 	return d ? to_mii_bus(d) : NULL;
 }
 EXPORT_SYMBOL(of_mdio_find_bus);