From: Oleksij Rempel Date: Wed, 18 Jun 2025 12:25:59 +0000 (+0200) Subject: net: usb: lan78xx: Use ethtool_op_get_link to reflect current link status X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=69909c56504bab938b77ccac279d242911a3c829;p=thirdparty%2Flinux.git net: usb: lan78xx: Use ethtool_op_get_link to reflect current link status Replace the custom lan78xx_get_link implementation with the standard ethtool_op_get_link helper, which uses netif_carrier_ok to reflect the current link status accurately. Signed-off-by: Oleksij Rempel Reviewed-by: Maxime Chevallier Reviewed-by: Russell King (Oracle) Link: https://patch.msgid.link/20250618122602.3156678-4-o.rempel@pengutronix.de Signed-off-by: Jakub Kicinski --- diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c index 18402a3922a64..9bb1d2527d0ca 100644 --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c @@ -1839,18 +1839,6 @@ out: return ret; } -static u32 lan78xx_get_link(struct net_device *net) -{ - u32 link; - - mutex_lock(&net->phydev->lock); - phy_read_status(net->phydev); - link = net->phydev->link; - mutex_unlock(&net->phydev->lock); - - return link; -} - static void lan78xx_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *info) { @@ -1970,7 +1958,7 @@ clean_data: } static const struct ethtool_ops lan78xx_ethtool_ops = { - .get_link = lan78xx_get_link, + .get_link = ethtool_op_get_link, .nway_reset = phy_ethtool_nway_reset, .get_drvinfo = lan78xx_get_drvinfo, .get_msglevel = lan78xx_get_msglevel,