[PATCH 1/2] mdiobus: return existing phydev in mdiobus_scan
Sascha Hauer
s.hauer at pengutronix.de
Tue Oct 30 12:32:36 EDT 2012
Test if we already found a phy device on an address earlier and return
it if it exists. This makes it possible to call mdiobus_scan multiple
times.
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
drivers/net/phy/mdio_bus.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index b49f714..5025e3f 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -101,6 +101,9 @@ struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr)
{
struct phy_device *phydev;
+ if (bus->phy_map[addr])
+ return bus->phy_map[addr];
+
phydev = get_phy_device(bus, addr);
if (IS_ERR(phydev) || phydev == NULL)
return phydev;
--
1.7.10.4
More information about the barebox
mailing list