net: usb: replace unnecessary get_link functions with usbnet_get_link
Subsystems (5)
PATCH 1/1 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.
--- drivers/net/usb/asix_devices.c | 11 ++--------- drivers/net/usb/dm9601.c | 9 +-------- drivers/net/usb/sr9800.c | 9 +-------- 3 files changed, 4 insertions(+), 25 deletions(-)
drivers/net/usb/asix_devices.c +2 -9
@@ -97,13 +97,6 @@ static u32 asix_get_phyid(struct usbnet *dev)return phy_id; } -static u32 asix_get_link (struct net_device *net) -{ -struct usbnet *dev =netdev_priv (net); - -return mii_link_ok (&dev->mii); -} -static int asix_ioctl (struct net_device *net,struct ifreq *rq,int cmd) {struct usbnet *dev =netdev_priv (net);
@@ -116,7 +109,7 @@ static int asix_ioctl (struct net_device *net, struct ifreq *rq, int cmd)devices that may be connected at the same time. */ static const struct ethtool_ops ax88172_ethtool_ops = { .get_drvinfo = asix_get_drvinfo, - .get_link = asix_get_link, + .get_link = usbnet_get_link, .get_msglevel = usbnet_get_msglevel, .set_msglevel = usbnet_set_msglevel, .get_wol = asix_get_wol,
@@ -986,7 +979,7 @@ static void ax88178_unbind(struct usbnet *dev, struct usb_interface *intf)static const struct ethtool_ops ax88178_ethtool_ops = { .get_drvinfo = asix_get_drvinfo, - .get_link = asix_get_link, + .get_link = usbnet_get_link, .get_msglevel = usbnet_get_msglevel, .set_msglevel = usbnet_set_msglevel, .get_wol = asix_get_wol,
drivers/net/usb/dm9601.c +1 -8
@@ -266,13 +266,6 @@ static void dm9601_get_drvinfo(struct net_device *net,usbnet_get_drvinfo (net, info); } -static u32 dm9601_get_link (struct net_device *net) -{ -struct usbnet *dev =netdev_priv (net); - -return mii_link_ok (&dev->mii); -} -static int dm9601_ioctl (struct net_device *net,struct ifreq *rq,int cmd) {struct usbnet *dev =netdev_priv (net);
@@ -282,7 +275,7 @@ static int dm9601_ioctl(struct net_device *net, struct ifreq *rq, int cmd)static const struct ethtool_ops dm9601_ethtool_ops = { .get_drvinfo = dm9601_get_drvinfo, - .get_link = dm9601_get_link, + .get_link = usbnet_get_link, .get_msglevel = usbnet_get_msglevel, .set_msglevel = usbnet_set_msglevel, .get_eeprom_len = dm9601_get_eeprom_len,
drivers/net/usb/sr9800.c +1 -8
@@ -478,13 +478,6 @@ static void sr_get_drvinfo(struct net_device *net,strscpy (info->version,DRIVER_VERSION ,sizeof (info->version)); } -static u32 sr_get_link (struct net_device *net) -{ -struct usbnet *dev =netdev_priv (net); - -return mii_link_ok (&dev->mii); -} -static int sr_ioctl (struct net_device *net,struct ifreq *rq,int cmd) {struct usbnet *dev =netdev_priv (net);
@@ -519,7 +512,7 @@ static int sr_set_mac_address(struct net_device *net, void *p)static const struct ethtool_ops sr9800_ethtool_ops = { .get_drvinfo = sr_get_drvinfo, - .get_link = sr_get_link, + .get_link = usbnet_get_link, .get_msglevel = usbnet_get_msglevel, .set_msglevel = usbnet_set_msglevel, .get_wol = sr_get_wol,
Signature · 1 line
2.43.0
Quoted 6 lines · Ethan Nelson-Moore
usbnet_get_linkcallsmii_link_okif the device has a MII defined in its usbnet struct and nocheck_connectfunction defined there. This is true of these drivers, so their customget_linkfunctions which callmii_link_okare useless. Remove them in favor ofusbnet_get_link.Signed-off-by Ethan Nelson-Moore <[email protected]>
Andrew
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Ethan" == Ethan Nelson-Moore <[email protected]> writes:
usbnet_get_linkcallsmii_link_okif the device has a MII defined in its usbnet struct and nocheck_connectfunction defined there. This is true of these drivers, so their customget_linkfunctions which callmii_link_okare useless. Remove them in favor ofusbnet_get_link.Signed-off-by Ethan Nelson-Moore <[email protected]>
Signature · 1 line
Bye, Peter Korsgaard
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Sat, 24 Jan 2026 00:22:06 -0800 you wrote:
usbnet_get_linkcallsmii_link_okif the device has a MII defined in its usbnet struct and nocheck_connectfunction defined there. This is true of these drivers, so their customget_linkfunctions which callmii_link_okare useless. Remove them in favor ofusbnet_get_link.Signed-off-by Ethan Nelson-Moore <[email protected]>[...]
Here is the summary with links:
- [net-next] net: usb: replace unnecessary get_link functions with usbnet_get_link
https://git.kernel.org/netdev/net-next/c/bd323fab96fb
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html