Commit 44ecaff5 authored by Ethan Nelson-Moore's avatar Ethan Nelson-Moore Committed by Jakub Kicinski
Browse files

net: usb: remove unnecessary get_drvinfo code and driver versions



Many USB network drivers define get_drvinfo functions which add no
value over usbnet_get_drvinfo, only setting the driver name and
version. usbnet_get_drvinfo automatically sets the driver name, and
separate driver versions are now frowned upon in the kernel. Remove all
driver versions and replace these get_drvinfo functions with references
to usbnet_get_drvinfo where possible. Where that is not possible,
remove unnecessary code to set the driver name. Also remove two
unnecessary initializations from aqc111_get_drvinfo, an inaccurate
comment in pegasus.c, and an unused macro in catc.c.

Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Peter Korsgaard <peter@korsgaard.com> (for dm9601.c)
Signed-off-by: default avatarEthan Nelson-Moore <enelsonmoore@gmail.com>
Link: https://patch.msgid.link/20260129042435.13395-2-enelsonmoore@gmail.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 96e1c895
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -20,8 +20,6 @@

#include "aqc111.h"

#define DRIVER_NAME "aqc111"

static int aqc111_read_cmd_nopm(struct usbnet *dev, u8 cmd, u16 value,
				u16 index, u16 size, void *data)
{
@@ -207,13 +205,10 @@ static void aqc111_get_drvinfo(struct net_device *net,

	/* Inherit standard device info */
	usbnet_get_drvinfo(net, info);
	strscpy(info->driver, DRIVER_NAME, sizeof(info->driver));
	snprintf(info->fw_version, sizeof(info->fw_version), "%u.%u.%u",
		 aqc111_data->fw_ver.major,
		 aqc111_data->fw_ver.minor,
		 aqc111_data->fw_ver.rev);
	info->eedump_len = 0x00;
	info->regdump_len = 0x00;
}

static void aqc111_get_wol(struct net_device *net,
+0 −3
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@
#include <net/selftests.h>
#include <linux/phylink.h>

#define DRIVER_VERSION "22-Dec-2011"
#define DRIVER_NAME "asix"

/* ASIX AX8817X based USB 2.0 Ethernet Devices */
@@ -248,8 +247,6 @@ int asix_get_eeprom(struct net_device *net, struct ethtool_eeprom *eeprom,
int asix_set_eeprom(struct net_device *net, struct ethtool_eeprom *eeprom,
		    u8 *data);

void asix_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *info);

int asix_set_mac_address(struct net_device *net, void *p);

#endif /* _ASIX_H */
+0 −8
Original line number Diff line number Diff line
@@ -731,14 +731,6 @@ int asix_set_eeprom(struct net_device *net, struct ethtool_eeprom *eeprom,
	return ret;
}

void asix_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *info)
{
	/* Inherit standard device info */
	usbnet_get_drvinfo(net, info);
	strscpy(info->driver, DRIVER_NAME, sizeof(info->driver));
	strscpy(info->version, DRIVER_VERSION, sizeof(info->version));
}

int asix_set_mac_address(struct net_device *net, void *p)
{
	struct usbnet *dev = netdev_priv(net);
+3 −5
Original line number Diff line number Diff line
@@ -108,7 +108,7 @@ static int asix_ioctl (struct net_device *net, struct ifreq *rq, int cmd)
   own structure so we don't interfere with other usbnet
   devices that may be connected at the same time. */
static const struct ethtool_ops ax88172_ethtool_ops = {
	.get_drvinfo		= asix_get_drvinfo,
	.get_drvinfo		= usbnet_get_drvinfo,
	.get_link		= usbnet_get_link,
	.get_msglevel		= usbnet_get_msglevel,
	.set_msglevel		= usbnet_set_msglevel,
@@ -317,7 +317,7 @@ static int ax88772_ethtool_set_pauseparam(struct net_device *ndev,
}

static const struct ethtool_ops ax88772_ethtool_ops = {
	.get_drvinfo		= asix_get_drvinfo,
	.get_drvinfo		= usbnet_get_drvinfo,
	.get_link		= usbnet_get_link,
	.get_msglevel		= usbnet_get_msglevel,
	.set_msglevel		= usbnet_set_msglevel,
@@ -978,7 +978,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_drvinfo		= usbnet_get_drvinfo,
	.get_link		= usbnet_get_link,
	.get_msglevel		= usbnet_get_msglevel,
	.set_msglevel		= usbnet_set_msglevel,
@@ -1635,7 +1635,5 @@ static struct usb_driver asix_driver = {
module_usb_driver(asix_driver);

MODULE_AUTHOR("David Hollis");
MODULE_VERSION(DRIVER_VERSION);
MODULE_DESCRIPTION("ASIX AX8817X based USB 2.0 Ethernet Devices");
MODULE_LICENSE("GPL");
+1 −1
Original line number Diff line number Diff line
@@ -114,7 +114,7 @@ static const struct net_device_ops ax88172a_netdev_ops = {
};

static const struct ethtool_ops ax88172a_ethtool_ops = {
	.get_drvinfo		= asix_get_drvinfo,
	.get_drvinfo		= usbnet_get_drvinfo,
	.get_link		= usbnet_get_link,
	.get_msglevel		= usbnet_get_msglevel,
	.set_msglevel		= usbnet_set_msglevel,
Loading