From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jC2L7-00049O-8A for barebox@lists.infradead.org; Wed, 11 Mar 2020 14:28:08 +0000 From: Sascha Hauer Date: Wed, 11 Mar 2020 15:27:54 +0100 Message-Id: <20200311142757.25263-14-s.hauer@pengutronix.de> In-Reply-To: <20200311142757.25263-1-s.hauer@pengutronix.de> References: <20200311142757.25263-1-s.hauer@pengutronix.de> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 13/16] net: phy: Also print link down messages To: Barebox List Cc: Edmund Henniges , =?UTF-8?q?Daniel=20Gl=C3=B6ckner?= Not only print when the link comes up, but also when it goes down. Signed-off-by: Sascha Hauer --- drivers/net/phy/phy.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index ccdc9f3716..a440edffd6 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -46,6 +46,7 @@ int phy_update_status(struct phy_device *phydev) struct eth_device *edev = phydev->attached_dev; int ret; int oldspeed = phydev->speed, oldduplex = phydev->duplex; + int oldlink = phydev->link; if (drv) { ret = drv->read_status(phydev); @@ -53,7 +54,8 @@ int phy_update_status(struct phy_device *phydev) return ret; } - if (phydev->speed == oldspeed && phydev->duplex == oldduplex) + if (phydev->speed == oldspeed && phydev->duplex == oldduplex && + phydev->link == oldlink) return 0; if (phydev->adjust_link) @@ -62,6 +64,8 @@ int phy_update_status(struct phy_device *phydev) if (phydev->link) dev_info(&edev->dev, "%dMbps %s duplex link detected\n", phydev->speed, phydev->duplex ? "full" : "half"); + else if (oldlink) + dev_info(&edev->dev, "link down\n"); return 0; } -- 2.25.1 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox