diff mbox series

[2/3,net-next,v4] net: ethernet: ixp4xx: Retire ancient phy retrieveal

Message ID 20210425003038.2937498-2-linus.walleij@linaro.org (mailing list archive)
State Accepted
Commit 3e8047a98553e234a751f4f7f42d687ba98c0822
Delegated to: Netdev Maintainers
Headers show
Series [1/3,net-next,v4] net: ethernet: ixp4xx: Add DT bindings | expand

Checks

Context Check Description
netdev/cover_letter warning Series does not have a cover letter
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers warning 2 maintainers not CCed: khalasa@piap.pl kuba@kernel.org
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 26 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Linus Walleij April 25, 2021, 12:30 a.m. UTC
This driver was using a really dated way of obtaining the
phy by printing a string and using it with phy_connect().
Switch to using more reasonable modern interfaces.

Suggested-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v3->v4:
- Collect Andrew's review tag
ChangeLog v1->v3:
- New patch
---
 drivers/net/ethernet/xscale/ixp4xx_eth.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c
index 9defaa21a1a9..4df2686ac5b8 100644
--- a/drivers/net/ethernet/xscale/ixp4xx_eth.c
+++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c
@@ -1360,7 +1360,6 @@  static const struct net_device_ops ixp4xx_netdev_ops = {
 
 static int ixp4xx_eth_probe(struct platform_device *pdev)
 {
-	char phy_id[MII_BUS_ID_SIZE + 3];
 	struct phy_device *phydev = NULL;
 	struct device *dev = &pdev->dev;
 	struct eth_plat_info *plat;
@@ -1462,14 +1461,15 @@  static int ixp4xx_eth_probe(struct platform_device *pdev)
 	__raw_writel(DEFAULT_CORE_CNTRL, &port->regs->core_control);
 	udelay(50);
 
-	snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT,
-		mdio_bus->id, plat->phy);
-	phydev = phy_connect(ndev, phy_id, &ixp4xx_adjust_link,
-			     PHY_INTERFACE_MODE_MII);
+	phydev = mdiobus_get_phy(mdio_bus, plat->phy);
 	if (IS_ERR(phydev)) {
 		err = PTR_ERR(phydev);
 		goto err_free_mem;
 	}
+	err = phy_connect_direct(ndev, phydev, ixp4xx_adjust_link,
+				 PHY_INTERFACE_MODE_MII);
+	if (err)
+		goto err_free_mem;
 
 	phydev->irq = PHY_POLL;