[PATCH 02/10] net: phy: move setting of phy_map to phy_register_device

Sascha Hauer s.hauer at pengutronix.de
Wed May 21 05:18:52 PDT 2014


The phy_map should be valid once a phy_device is registered. This
allows registering phys outside of mdiobus_scan.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/net/phy/mdio_bus.c | 2 --
 drivers/net/phy/phy.c      | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 895ead0..5c4dea4 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -114,8 +114,6 @@ struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr)
 	if (IS_ERR(phydev))
 		return phydev;
 
-	bus->phy_map[addr] = phydev;
-
 	return phydev;
 }
 EXPORT_SYMBOL(mdiobus_scan);
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index a8a8a2c..1e26e45 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -245,6 +245,8 @@ int phy_register_device(struct phy_device* dev)
 	if (ret)
 		return ret;
 
+	dev->bus->phy_map[dev->addr] = dev;
+
 	dev->registered = 1;
 
 	if (dev->dev.driver)
-- 
2.0.0.rc0




More information about the barebox mailing list