aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/of/of_mdio.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
index bacaa536fd51..4b22ba568b19 100644
--- a/drivers/of/of_mdio.c
+++ b/drivers/of/of_mdio.c
@@ -97,6 +97,12 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
97} 97}
98EXPORT_SYMBOL(of_mdiobus_register); 98EXPORT_SYMBOL(of_mdiobus_register);
99 99
100/* Helper function for of_phy_find_device */
101static int of_phy_match(struct device *dev, void *phy_np)
102{
103 return dev_archdata_get_node(&dev->archdata) == phy_np;
104}
105
100/** 106/**
101 * of_phy_find_device - Give a PHY node, find the phy_device 107 * of_phy_find_device - Give a PHY node, find the phy_device
102 * @phy_np: Pointer to the phy's device tree node 108 * @phy_np: Pointer to the phy's device tree node
@@ -106,15 +112,10 @@ EXPORT_SYMBOL(of_mdiobus_register);
106struct phy_device *of_phy_find_device(struct device_node *phy_np) 112struct phy_device *of_phy_find_device(struct device_node *phy_np)
107{ 113{
108 struct device *d; 114 struct device *d;
109 int match(struct device *dev, void *phy_np)
110 {
111 return dev_archdata_get_node(&dev->archdata) == phy_np;
112 }
113
114 if (!phy_np) 115 if (!phy_np)
115 return NULL; 116 return NULL;
116 117
117 d = bus_find_device(&mdio_bus_type, NULL, phy_np, match); 118 d = bus_find_device(&mdio_bus_type, NULL, phy_np, of_phy_match);
118 return d ? to_phy_device(d) : NULL; 119 return d ? to_phy_device(d) : NULL;
119} 120}
120EXPORT_SYMBOL(of_phy_find_device); 121EXPORT_SYMBOL(of_phy_find_device);