path: root/configs/platform-v7a/patches/barebox-2021.02.0/net-phy-fix-waiting-for-link.patch
blob: cf4279860c6edfe90a9b32261933ba4aef02a11e (plain) (tree)

From: Sascha Hauer <>
Date: Fri, 12 Mar 2021 11:13:09 +0100
Subject: [PATCH] net: phy: fix waiting for link

phydev->adjust_link() is called only from phy_update_status() when the
link status changes during that function. phydev->link is also updated
in genphy_update_link() called from phy_wait_aneg_done(), so it can
happen that phydev->link changes outside of phy_update_status(), thus
phydev->adjust_link is never called and no link change notice is

Instead of calling genphy_update_link() from phy_wait_aneg_done(), call
phy_update_status(). This makes sure that a link change is properly

Fixes: 8f75aa496dcb ("net: reply to ping requests")
Signed-off-by: Sascha Hauer <>
 drivers/net/phy/phy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 622acbe40dd9..e8e8dad5bd25 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -571,7 +571,7 @@ int phy_wait_aneg_done(struct phy_device *phydev)
 	do {
-		genphy_update_link(phydev);
+		phy_update_status(phydev);
 		if (phydev->link == 1)
 			return 0;
 	} while (!is_timeout(start, PHY_AN_TIMEOUT * SECOND));