* [PATCH net-next] net: usb: replace unnecessary get_link functions with usbnet_get_link
@ 2026-01-24 8:22 Ethan Nelson-Moore
2026-01-24 18:51 ` Andrew Lunn
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Ethan Nelson-Moore @ 2026-01-24 8:22 UTC (permalink / raw)
To: netdev, linux-usb
Cc: Ethan Nelson-Moore, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Peter Korsgaard, Oleksij Rempel,
Max Schulze, Krzysztof Hałasa
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>
---
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(-)
diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
index 232bbd79a4de..c73cf52a65a8 100644
--- a/drivers/net/usb/asix_devices.c
+++ b/drivers/net/usb/asix_devices.c
@@ -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,
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c
index 2b4716ccf0c5..5540f7ec4906 100644
--- a/drivers/net/usb/dm9601.c
+++ b/drivers/net/usb/dm9601.c
@@ -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,
diff --git a/drivers/net/usb/sr9800.c b/drivers/net/usb/sr9800.c
index 57947a5590cc..ee8c6c9d3962 100644
--- a/drivers/net/usb/sr9800.c
+++ b/drivers/net/usb/sr9800.c
@@ -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,
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH net-next] net: usb: replace unnecessary get_link functions with usbnet_get_link
2026-01-24 8:22 [PATCH net-next] net: usb: replace unnecessary get_link functions with usbnet_get_link Ethan Nelson-Moore
@ 2026-01-24 18:51 ` Andrew Lunn
2026-01-25 9:09 ` Peter Korsgaard
2026-01-27 3:40 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2026-01-24 18:51 UTC (permalink / raw)
To: Ethan Nelson-Moore
Cc: netdev, linux-usb, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Peter Korsgaard, Oleksij Rempel,
Max Schulze, Krzysztof Hałasa
On Sat, Jan 24, 2026 at 12:22:06AM -0800, Ethan Nelson-Moore wrote:
> 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>
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH net-next] net: usb: replace unnecessary get_link functions with usbnet_get_link
2026-01-24 8:22 [PATCH net-next] net: usb: replace unnecessary get_link functions with usbnet_get_link Ethan Nelson-Moore
2026-01-24 18:51 ` Andrew Lunn
@ 2026-01-25 9:09 ` Peter Korsgaard
2026-01-27 3:40 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Peter Korsgaard @ 2026-01-25 9:09 UTC (permalink / raw)
To: Ethan Nelson-Moore
Cc: netdev, linux-usb, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Oleksij Rempel, Max Schulze,
Krzysztof Hałasa
>>>>> "Ethan" == Ethan Nelson-Moore <enelsonmoore@gmail.com> writes:
> 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: Peter Korsgaard <peter@korsgaard.com>
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: usb: replace unnecessary get_link functions with usbnet_get_link
2026-01-24 8:22 [PATCH net-next] net: usb: replace unnecessary get_link functions with usbnet_get_link Ethan Nelson-Moore
2026-01-24 18:51 ` Andrew Lunn
2026-01-25 9:09 ` Peter Korsgaard
@ 2026-01-27 3:40 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-01-27 3:40 UTC (permalink / raw)
To: Ethan Nelson-Moore
Cc: netdev, linux-usb, andrew+netdev, davem, edumazet, kuba, pabeni,
peter, o.rempel, max.schulze, khalasa
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Sat, 24 Jan 2026 00:22:06 -0800 you wrote:
> 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>
>
> [...]
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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-01-27 3:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-24 8:22 [PATCH net-next] net: usb: replace unnecessary get_link functions with usbnet_get_link Ethan Nelson-Moore
2026-01-24 18:51 ` Andrew Lunn
2026-01-25 9:09 ` Peter Korsgaard
2026-01-27 3:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox