Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: usb: replace unnecessary get_link functions with usbnet_get_link

usbnet_get_link calls mii_link_ok if the device has a MII defined in
its usbnet struct and no check_connect function defined there. This is
true of these drivers, so their custom get_link functions which call
mii_link_ok are useless. Remove them in favor of usbnet_get_link.

Signed-off-by: Ethan Nelson-Moore <enelsonmoore@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Peter Korsgaard <peter@korsgaard.com>
Link: https://patch.msgid.link/20260124082217.82351-1-enelsonmoore@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Ethan Nelson-Moore and committed by
Jakub Kicinski
bd323fab 2dd698f6

+4 -25
+2 -9
drivers/net/usb/asix_devices.c
··· 97 97 return phy_id; 98 98 } 99 99 100 - static u32 asix_get_link(struct net_device *net) 101 - { 102 - struct usbnet *dev = netdev_priv(net); 103 - 104 - return mii_link_ok(&dev->mii); 105 - } 106 - 107 100 static int asix_ioctl (struct net_device *net, struct ifreq *rq, int cmd) 108 101 { 109 102 struct usbnet *dev = netdev_priv(net); ··· 109 116 devices that may be connected at the same time. */ 110 117 static const struct ethtool_ops ax88172_ethtool_ops = { 111 118 .get_drvinfo = asix_get_drvinfo, 112 - .get_link = asix_get_link, 119 + .get_link = usbnet_get_link, 113 120 .get_msglevel = usbnet_get_msglevel, 114 121 .set_msglevel = usbnet_set_msglevel, 115 122 .get_wol = asix_get_wol, ··· 979 986 980 987 static const struct ethtool_ops ax88178_ethtool_ops = { 981 988 .get_drvinfo = asix_get_drvinfo, 982 - .get_link = asix_get_link, 989 + .get_link = usbnet_get_link, 983 990 .get_msglevel = usbnet_get_msglevel, 984 991 .set_msglevel = usbnet_set_msglevel, 985 992 .get_wol = asix_get_wol,
+1 -8
drivers/net/usb/dm9601.c
··· 266 266 usbnet_get_drvinfo(net, info); 267 267 } 268 268 269 - static u32 dm9601_get_link(struct net_device *net) 270 - { 271 - struct usbnet *dev = netdev_priv(net); 272 - 273 - return mii_link_ok(&dev->mii); 274 - } 275 - 276 269 static int dm9601_ioctl(struct net_device *net, struct ifreq *rq, int cmd) 277 270 { 278 271 struct usbnet *dev = netdev_priv(net); ··· 275 282 276 283 static const struct ethtool_ops dm9601_ethtool_ops = { 277 284 .get_drvinfo = dm9601_get_drvinfo, 278 - .get_link = dm9601_get_link, 285 + .get_link = usbnet_get_link, 279 286 .get_msglevel = usbnet_get_msglevel, 280 287 .set_msglevel = usbnet_set_msglevel, 281 288 .get_eeprom_len = dm9601_get_eeprom_len,
+1 -8
drivers/net/usb/sr9800.c
··· 478 478 strscpy(info->version, DRIVER_VERSION, sizeof(info->version)); 479 479 } 480 480 481 - static u32 sr_get_link(struct net_device *net) 482 - { 483 - struct usbnet *dev = netdev_priv(net); 484 - 485 - return mii_link_ok(&dev->mii); 486 - } 487 - 488 481 static int sr_ioctl(struct net_device *net, struct ifreq *rq, int cmd) 489 482 { 490 483 struct usbnet *dev = netdev_priv(net); ··· 512 519 513 520 static const struct ethtool_ops sr9800_ethtool_ops = { 514 521 .get_drvinfo = sr_get_drvinfo, 515 - .get_link = sr_get_link, 522 + .get_link = usbnet_get_link, 516 523 .get_msglevel = usbnet_get_msglevel, 517 524 .set_msglevel = usbnet_set_msglevel, 518 525 .get_wol = sr_get_wol,