[PATCH] net: cpsw: remove unnecessary mdiobus_scan()
Sascha Hauer
s.hauer at pengutronix.de
Thu Feb 15 23:39:46 PST 2018
No need to call mdiobus_scan() manually. it is called from
phy_device_connect() already in cpsw_open() which does all
the magic to connect a network device with its phy.
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
drivers/net/cpsw.c | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)
diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
index d11ca33f70..54ee5f327a 100644
--- a/drivers/net/cpsw.c
+++ b/drivers/net/cpsw.c
@@ -913,25 +913,13 @@ static int cpsw_slave_setup(struct cpsw_slave *slave, int slave_num,
struct eth_device *edev = &slave->edev;
struct device_d *dev = &slave->dev;
int ret;
- struct phy_device *phy;
-
- phy = mdiobus_scan(&priv->miibus, priv->slaves[slave_num].phy_id);
- if (IS_ERR(phy)) {
- ret = PTR_ERR(phy);
- goto err_out;
- }
-
- phy->dev.device_node = priv->slaves[slave_num].dev.device_node;
- ret = phy_register_device(phy);
- if (ret)
- goto err_out;
sprintf(dev->name, "cpsw-slave");
dev->id = slave->slave_num;
dev->parent = priv->dev;
ret = register_device(dev);
if (ret)
- goto err_register_dev;
+ return ret;
dev_dbg(&slave->dev, "* %s\n", __func__);
@@ -956,11 +944,9 @@ static int cpsw_slave_setup(struct cpsw_slave *slave, int slave_num,
return 0;
-err_register_dev:
- phy_unregister_device(phy);
err_register_edev:
unregister_device(dev);
-err_out:
+
slave->slave_num = -1;
return ret;
--
2.15.1
More information about the barebox
mailing list