net: usb: remove unnecessary get_drvinfo code and driver versions
Subsystems (7)
PATCH 1/1 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.
--- drivers/net/usb/aqc111.c | 5 ----- drivers/net/usb/asix.h | 3 --- drivers/net/usb/asix_common.c | 8 -------- drivers/net/usb/asix_devices.c | 8 +++----- drivers/net/usb/ax88172a.c | 2 +- drivers/net/usb/catc.c | 7 ------- drivers/net/usb/dm9601.c | 9 +-------- drivers/net/usb/mcs7830.c | 7 +------ drivers/net/usb/pegasus.c | 3 --- drivers/net/usb/r8152.c | 10 ---------- drivers/net/usb/rtl8150.c | 3 --- drivers/net/usb/sierra_net.c | 14 +------------- drivers/net/usb/sr9800.c | 12 +----------- drivers/net/usb/sr9800.h | 3 +-- 14 files changed, 9 insertions(+), 85 deletions(-)
drivers/net/usb/aqc111.c +0 -5
@@ -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,
drivers/net/usb/asix.h +0 -3
@@ -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 */
drivers/net/usb/asix_common.c +0 -8
@@ -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);
drivers/net/usb/asix_devices.c +3 -5
@@ -115,7 +115,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 = asix_get_link, .get_msglevel = usbnet_get_msglevel, .set_msglevel = usbnet_set_msglevel,
@@ -324,7 +324,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,
@@ -985,7 +985,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 = asix_get_link, .get_msglevel = usbnet_get_msglevel, .set_msglevel = usbnet_set_msglevel,
@@ -1642,7 +1642,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" ); -
drivers/net/usb/ax88172a.c +1 -1
@@ -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,
drivers/net/usb/catc.c +0 -7
@@ -37,14 +37,8 @@#include <linux/usb.h> -/* -* Version information. -*/ - -#define DRIVER_VERSION "v2.8"#define DRIVER_AUTHOR "Vojtech Pavlik <[email protected]>"#define DRIVER_DESC "CATC EL1210A NetMate USB Ethernet driver" -#define SHORT_DRIVER_DESC "EL1210A NetMate USB Ethernet"MODULE_AUTHOR (DRIVER_AUTHOR );MODULE_DESCRIPTION (DRIVER_DESC );
@@ -673,7 +667,6 @@ static void catc_get_drvinfo(struct net_device *dev, {struct catc *catc =netdev_priv (dev);strscpy (info->driver, driver_name,sizeof (info->driver)); -strscpy (info->version,DRIVER_VERSION ,sizeof (info->version));usb_make_path (catc->usbdev, info->bus_info,sizeof (info->bus_info)); }
drivers/net/usb/dm9601.c +1 -8
@@ -259,13 +259,6 @@ static void dm9601_mdio_write(struct net_device *netdev, int phy_id, int loc,dm_write_shared_word (dev,1 , loc, res); } -static void dm9601_get_drvinfo (struct net_device *net, -struct ethtool_drvinfo *info) -{ -/* Inherit standard device info */ -usbnet_get_drvinfo (net, info); -} -static u32 dm9601_get_link (struct net_device *net) {struct usbnet *dev =netdev_priv (net);
@@ -281,7 +274,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_drvinfo = usbnet_get_drvinfo, .get_link = dm9601_get_link, .get_msglevel = usbnet_get_msglevel, .set_msglevel = usbnet_set_msglevel,
drivers/net/usb/mcs7830.c +1 -6
@@ -438,11 +438,6 @@ static int mcs7830_get_regs_len(struct net_device *net)return 0 ; } -static void mcs7830_get_drvinfo (struct net_device *net,struct ethtool_drvinfo *drvinfo) -{ -usbnet_get_drvinfo (net, drvinfo); -} -static void mcs7830_get_regs (struct net_device *net,struct ethtool_regs *regs,void *data) {struct usbnet *dev =netdev_priv (net);
@@ -452,11 +447,11 @@ static void mcs7830_get_regs(struct net_device *net, struct ethtool_regs *regs, }static const struct ethtool_ops mcs7830_ethtool_ops = { - .get_drvinfo = mcs7830_get_drvinfo, .get_regs_len = mcs7830_get_regs_len, .get_regs = mcs7830_get_regs,/* common usbnet calls */ + .get_drvinfo = usbnet_get_drvinfo, .get_link = usbnet_get_link, .get_msglevel = usbnet_get_msglevel, .set_msglevel = usbnet_set_msglevel,
drivers/net/usb/pegasus.c +0 -3
@@ -18,9 +18,6 @@#include <linux/uaccess.h> #include "pegasus.h" -/* -* Version Information -*/ #define DRIVER_AUTHOR "Petko Manolov <[email protected]>"#define DRIVER_DESC "Pegasus/Pegasus II USB Ethernet driver"
drivers/net/usb/r8152.c +0 -10
@@ -30,13 +30,6 @@#include <linux/usb/r8152.h> #include <net/gso.h> -/* Information for net-next */ -#define NETNEXT_VERSION "12" - -/* Information for net */ -#define NET_VERSION "13" - -#define DRIVER_VERSION "v1." NETNEXT_VERSION "." NET_VERSION#define DRIVER_AUTHOR "Realtek linux nic maintainers <[email protected]>"#define DRIVER_DESC "Realtek RTL8152/RTL8153 Based USB Ethernet Adapters"#define MODULENAME "r8152"
@@ -8756,7 +8749,6 @@ static void rtl8152_get_drvinfo(struct net_device *netdev,struct r8152 *tp =netdev_priv (netdev);strscpy (info->driver,MODULENAME ,sizeof (info->driver)); -strscpy (info->version,DRIVER_VERSION ,sizeof (info->version));usb_make_path (tp->udev, info->bus_info,sizeof (info->bus_info));if (!IS_ERR_OR_NULL (tp->rtl_fw.fw)) strscpy(info->fw_version, tp->rtl_fw.version,
@@ -9950,7 +9942,6 @@ static int rtl8152_probe_once(struct usb_interface *intf, goto out2;set_bit (PROBED_WITH_NO_ERRORS , &tp->flags); -netif_info (tp, probe, netdev,"%s\n" ,DRIVER_VERSION );return 0 ;
@@ -10145,4 +10136,3 @@ module_exit(rtl8152_driver_exit);MODULE_AUTHOR (DRIVER_AUTHOR );MODULE_DESCRIPTION (DRIVER_DESC );MODULE_LICENSE ("GPL" ); -MODULE_VERSION (DRIVER_VERSION );
drivers/net/usb/rtl8150.c +0 -3
@@ -13,8 +13,6 @@#include <linux/usb.h> #include <linux/uaccess.h> -/* Version Information */ -#define DRIVER_VERSION "v0.6.2 (2004/08/27)"#define DRIVER_AUTHOR "Petko Manolov <[email protected]>"#define DRIVER_DESC "rtl8150 based usb-ethernet driver"
@@ -785,7 +783,6 @@ static void rtl8150_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfrtl8150_t *dev =netdev_priv (netdev);strscpy (info->driver, driver_name,sizeof (info->driver)); -strscpy (info->version,DRIVER_VERSION ,sizeof (info->version));usb_make_path (dev->udev, info->bus_info,sizeof (info->bus_info)); }
drivers/net/usb/sierra_net.c +1 -13
@@ -12,10 +12,8 @@* Sierra Wireless. Use at your own risk. */ -#define DRIVER_VERSION "v.2.0"#define DRIVER_AUTHOR "Paxton Smith, Matthew Safar, Rory Filer"#define DRIVER_DESC "USB-to-WWAN Driver for Sierra Wireless modems" -static const char driver_name[] ="sierra_net" ;/* if defined debug messages enabled */ /*#define DEBUG*/
@@ -607,15 +605,6 @@ static void sierra_net_status(struct usbnet *dev, struct urb *urb) } } -static void sierra_net_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)); -} -static u32 sierra_net_get_link (struct net_device *net) {struct usbnet *dev =netdev_priv (net);
@@ -624,7 +613,7 @@ static u32 sierra_net_get_link(struct net_device *net) }static const struct ethtool_ops sierra_net_ethtool_ops = { - .get_drvinfo = sierra_net_get_drvinfo, + .get_drvinfo = usbnet_get_drvinfo, .get_link = sierra_net_get_link, .get_msglevel = usbnet_get_msglevel, .set_msglevel = usbnet_set_msglevel,
@@ -973,5 +962,4 @@ module_usb_driver(sierra_net_driver);MODULE_AUTHOR (DRIVER_AUTHOR );MODULE_DESCRIPTION (DRIVER_DESC ); -MODULE_VERSION (DRIVER_VERSION );MODULE_LICENSE ("GPL" );
drivers/net/usb/sr9800.c +1 -11
@@ -469,15 +469,6 @@ static int sr_get_eeprom(struct net_device *net,return 0 ; } -static void sr_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)); -} -static u32 sr_get_link (struct net_device *net) {struct usbnet *dev =netdev_priv (net);
@@ -518,7 +509,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_drvinfo = usbnet_get_drvinfo, .get_link = sr_get_link, .get_msglevel = usbnet_get_msglevel, .set_msglevel = usbnet_set_msglevel,
@@ -872,6 +863,5 @@ static struct usb_driver sr_driver = {module_usb_driver (sr_driver);MODULE_AUTHOR ("Liu Junliang <[email protected]" ); -MODULE_VERSION (DRIVER_VERSION );MODULE_DESCRIPTION ("SR9800 USB 2.0 USB2NET Dev : http://www.corechip-sz.com" );MODULE_LICENSE ("GPL" );
drivers/net/usb/sr9800.h +1 -2
@@ -147,8 +147,7 @@#define SR_EEPROM_MAGIC 0xdeadbeef#define SR9800_EEPROM_LEN 0xff -/* SR9800 Driver Version and Driver Name */ -#define DRIVER_VERSION "11-Nov-2013" +/* SR9800 Driver Name and Flags */ #define DRIVER_NAME "CoreChips"#define DRIVER_FLAG \ (FLAG_ETHER | FLAG_FRAMING_AX | FLAG_LINK_INTR | FLAG_MULTI_PACKET)
Signature · 1 line
2.43.0
Quoted 9 lines · Ethan Nelson-Moore
Many USB network drivers define
get_drvinfofunctions which add no value overusbnet_get_drvinfo, only setting the driver name and version.usbnet_get_drvinfoautomatically sets the driver name, and separate driver versions are now frowned upon in the kernel. Remove all driver versions and replace theseget_drvinfofunctions with references tousbnet_get_drvinfowhere possible. Where that is not possible, remove unnecessary code to set the driver name. Also remove two unnecessary initializations fromaqc111_get_drvinfo, an inaccurate comment inpegasus.c, and an unused macro incatc.c.
FWIW,
...
drivers/net/usb/catc.c static void catc_get_drvinfo(struct net_device *dev, · line 669
Quoted 5 lines
static void catc_get_drvinfo(struct
net_device*dev,{
drivers/net/usb/catc.c +0
-0struct catc *catc =netdev_priv (dev);strscpy (info->driver, driver_name,sizeof (info->driver));
Side note: and we usually require blank line after the definition block. On top, strscpy() in such cases can be improved to use 2-arguments variant, as it adds a check for the destination to be an array.
Quoted 3 lines
drivers/net/usb/catc.c +0
-1-strscpy (info->version,DRIVER_VERSION ,sizeof (info->version));usb_make_path (catc->usbdev, info->bus_info,sizeof (info->bus_info)); }
...
drivers/net/usb/r8152.c static void rtl8152_get_drvinfo(struct net_device *netdev, · line 8751
Quoted 5 lines
static void rtl8152_get_drvinfo(struct
net_device*netdev,drivers/net/usb/r8152.c +0
-0struct r8152 *tp =netdev_priv (netdev);strscpy (info->driver,MODULENAME ,sizeof (info->driver));
Ditto.
drivers/net/usb/r8152.c static void rtl8152_get_drvinfo(struct net_device *netdev, · line 8754
Quoted 4 lines
drivers/net/usb/r8152.c +0
-1-strscpy (info->version,DRIVER_VERSION ,sizeof (info->version));usb_make_path (tp->udev, info->bus_info,sizeof (info->bus_info));if (!IS_ERR_OR_NULL (tp->rtl_fw.fw)) strscpy(info->fw_version, tp->rtl_fw.version,
Seems the same, and so on...
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 11 lines · Ethan Nelson-Moore
Many USB network drivers define
get_drvinfofunctions which add no value overusbnet_get_drvinfo, only setting the driver name and version.usbnet_get_drvinfoautomatically sets the driver name, and separate driver versions are now frowned upon in the kernel. Remove all driver versions and replace theseget_drvinfofunctions with references tousbnet_get_drvinfowhere possible. Where that is not possible, remove unnecessary code to set the driver name. Also remove two unnecessary initializations fromaqc111_get_drvinfo, an inaccurate comment inpegasus.c, and an unused macro incatc.c.Signed-off-by Ethan Nelson-Moore <[email protected]>
Andrew