Commit a6e6231a authored by Marc Kleine-Budde's avatar Marc Kleine-Budde

Merge patch series "can: remove litteral strings used for driver names and remove DRV_VERSION"

Vincent Mailhol <mailhol.vincent@wanadoo.fr> says:

====================

This is a cleanup series.

The patches 1 to 8 get rid of any hardcoded strings and instead relies
on the KBUILD_MODNAME macros to get the device name. Patch 9 replaces
the ES58X_MODULE_NAME macro with KBUILD_MODNAME in
etas_es58x. Finally, also in etas_es58x, patch 10 removes the
DRV_VERSION so that the module uses the default behavior and advertise
the kernel version instead of a custom version.

* Changelog *

v1 -> v2:

  * The patch for esd_usb contained some changes for ems_usb.

  * v1 assumed that KBUILD_MODNAME could only be used when the file
    basename and the module had the same name (e.g. vcan.c for the
    vcan.ko). The fact is that KBUILD_NAME extends to the module name
    and can thus be used even if the basename is different
    (e.g. slcan-core.c and slcan.ko)

  * Add patch #9: can: etas_es58x: replace ES58X_MODULE_NAME with
    KBUILD_MODNAME

v1: https://lore.kernel.org/all/20220725153124.467061-1-mailhol.vincent@wanadoo.fr

This series are the first 9 patches of:
https://lore.kernel.org/linux-can/20220725133208.432176-1-mailhol.vincent@wanadoo.fr/T/

The initial intent of those 9 patches was to do so cleanup in order to
implement ethtool_ops::get_drvinfo but this appeared to be useless:
https://lore.kernel.org/linux-can/20220725140911.2djwxfrx3kdmjeuc@pengutronix.de/

Instead, those patch are send as a standalone series.

====================

Drop "[PATCH v2 03/10] can: slcan: use KBUILD_MODNAME and define
pr_fmt to replace hardcoded names" to avoid conflicts with Dario
Binacchi's work on the slcan driver.

Link: https://lore.kernel.org/all/20220726082707.58758-1-mailhol.vincent@wanadoo.frSigned-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parents 1dba745c ddbce345
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* Fred N. van Kempen <waltje@uwalt.nl.mugnet.org> * Fred N. van Kempen <waltje@uwalt.nl.mugnet.org>
*/ */
#define pr_fmt(fmt) "can327: " fmt #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -1100,7 +1100,7 @@ static int can327_ldisc_ioctl(struct tty_struct *tty, unsigned int cmd, ...@@ -1100,7 +1100,7 @@ static int can327_ldisc_ioctl(struct tty_struct *tty, unsigned int cmd,
static struct tty_ldisc_ops can327_ldisc = { static struct tty_ldisc_ops can327_ldisc = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "can327", .name = KBUILD_MODNAME,
.num = N_CAN327, .num = N_CAN327,
.receive_buf = can327_ldisc_rx, .receive_buf = can327_ldisc_rx,
.write_wakeup = can327_ldisc_tx_wakeup, .write_wakeup = can327_ldisc_tx_wakeup,
......
...@@ -612,7 +612,7 @@ static const struct net_device_ops softing_netdev_ops = { ...@@ -612,7 +612,7 @@ static const struct net_device_ops softing_netdev_ops = {
}; };
static const struct can_bittiming_const softing_btr_const = { static const struct can_bittiming_const softing_btr_const = {
.name = "softing", .name = KBUILD_MODNAME,
.tseg1_min = 1, .tseg1_min = 1,
.tseg1_max = 16, .tseg1_max = 16,
.tseg2_min = 1, .tseg2_min = 1,
...@@ -846,7 +846,7 @@ static int softing_pdev_probe(struct platform_device *pdev) ...@@ -846,7 +846,7 @@ static int softing_pdev_probe(struct platform_device *pdev)
static struct platform_driver softing_driver = { static struct platform_driver softing_driver = {
.driver = { .driver = {
.name = "softing", .name = KBUILD_MODNAME,
}, },
.probe = softing_pdev_probe, .probe = softing_pdev_probe,
.remove = softing_pdev_remove, .remove = softing_pdev_remove,
......
...@@ -880,7 +880,7 @@ static const struct net_device_ops ems_usb_netdev_ops = { ...@@ -880,7 +880,7 @@ static const struct net_device_ops ems_usb_netdev_ops = {
}; };
static const struct can_bittiming_const ems_usb_bittiming_const = { static const struct can_bittiming_const ems_usb_bittiming_const = {
.name = "ems_usb", .name = KBUILD_MODNAME,
.tseg1_min = 1, .tseg1_min = 1,
.tseg1_max = 16, .tseg1_max = 16,
.tseg2_min = 1, .tseg2_min = 1,
...@@ -1074,7 +1074,7 @@ static void ems_usb_disconnect(struct usb_interface *intf) ...@@ -1074,7 +1074,7 @@ static void ems_usb_disconnect(struct usb_interface *intf)
/* usb specific object needed to register this driver with the usb subsystem */ /* usb specific object needed to register this driver with the usb subsystem */
static struct usb_driver ems_usb_driver = { static struct usb_driver ems_usb_driver = {
.name = "ems_usb", .name = KBUILD_MODNAME,
.probe = ems_usb_probe, .probe = ems_usb_probe,
.disconnect = ems_usb_disconnect, .disconnect = ems_usb_disconnect,
.id_table = ems_usb_table, .id_table = ems_usb_table,
......
...@@ -1138,7 +1138,7 @@ static void esd_usb_disconnect(struct usb_interface *intf) ...@@ -1138,7 +1138,7 @@ static void esd_usb_disconnect(struct usb_interface *intf)
/* usb specific object needed to register this driver with the usb subsystem */ /* usb specific object needed to register this driver with the usb subsystem */
static struct usb_driver esd_usb_driver = { static struct usb_driver esd_usb_driver = {
.name = "esd_usb", .name = KBUILD_MODNAME,
.probe = esd_usb_probe, .probe = esd_usb_probe,
.disconnect = esd_usb_disconnect, .disconnect = esd_usb_disconnect,
.id_table = esd_usb_table, .id_table = esd_usb_table,
......
...@@ -18,14 +18,11 @@ ...@@ -18,14 +18,11 @@
#include "es58x_core.h" #include "es58x_core.h"
#define DRV_VERSION "1.00"
MODULE_AUTHOR("Vincent Mailhol <mailhol.vincent@wanadoo.fr>"); MODULE_AUTHOR("Vincent Mailhol <mailhol.vincent@wanadoo.fr>");
MODULE_AUTHOR("Arunachalam Santhanam <arunachalam.santhanam@in.bosch.com>"); MODULE_AUTHOR("Arunachalam Santhanam <arunachalam.santhanam@in.bosch.com>");
MODULE_DESCRIPTION("Socket CAN driver for ETAS ES58X USB adapters"); MODULE_DESCRIPTION("Socket CAN driver for ETAS ES58X USB adapters");
MODULE_VERSION(DRV_VERSION);
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
#define ES58X_MODULE_NAME "etas_es58x"
#define ES58X_VENDOR_ID 0x108C #define ES58X_VENDOR_ID 0x108C
#define ES581_4_PRODUCT_ID 0x0159 #define ES581_4_PRODUCT_ID 0x0159
#define ES582_1_PRODUCT_ID 0x0168 #define ES582_1_PRODUCT_ID 0x0168
...@@ -59,11 +56,11 @@ MODULE_DEVICE_TABLE(usb, es58x_id_table); ...@@ -59,11 +56,11 @@ MODULE_DEVICE_TABLE(usb, es58x_id_table);
#define es58x_print_hex_dump(buf, len) \ #define es58x_print_hex_dump(buf, len) \
print_hex_dump(KERN_DEBUG, \ print_hex_dump(KERN_DEBUG, \
ES58X_MODULE_NAME " " __stringify(buf) ": ", \ KBUILD_MODNAME " " __stringify(buf) ": ", \
DUMP_PREFIX_NONE, 16, 1, buf, len, false) DUMP_PREFIX_NONE, 16, 1, buf, len, false)
#define es58x_print_hex_dump_debug(buf, len) \ #define es58x_print_hex_dump_debug(buf, len) \
print_hex_dump_debug(ES58X_MODULE_NAME " " __stringify(buf) ": ",\ print_hex_dump_debug(KBUILD_MODNAME " " __stringify(buf) ": ",\
DUMP_PREFIX_NONE, 16, 1, buf, len, false) DUMP_PREFIX_NONE, 16, 1, buf, len, false)
/* The last two bytes of an ES58X command is a CRC16. The first two /* The last two bytes of an ES58X command is a CRC16. The first two
...@@ -2181,9 +2178,8 @@ static struct es58x_device *es58x_init_es58x_dev(struct usb_interface *intf, ...@@ -2181,9 +2178,8 @@ static struct es58x_device *es58x_init_es58x_dev(struct usb_interface *intf,
struct usb_endpoint_descriptor *ep_in, *ep_out; struct usb_endpoint_descriptor *ep_in, *ep_out;
int ret; int ret;
dev_info(dev, dev_info(dev, "Starting %s %s (Serial Number %s)\n",
"Starting %s %s (Serial Number %s) driver version %s\n", udev->manufacturer, udev->product, udev->serial);
udev->manufacturer, udev->product, udev->serial, DRV_VERSION);
ret = usb_find_common_endpoints(intf->cur_altsetting, &ep_in, &ep_out, ret = usb_find_common_endpoints(intf->cur_altsetting, &ep_in, &ep_out,
NULL, NULL); NULL, NULL);
...@@ -2280,7 +2276,7 @@ static void es58x_disconnect(struct usb_interface *intf) ...@@ -2280,7 +2276,7 @@ static void es58x_disconnect(struct usb_interface *intf)
} }
static struct usb_driver es58x_driver = { static struct usb_driver es58x_driver = {
.name = ES58X_MODULE_NAME, .name = KBUILD_MODNAME,
.probe = es58x_probe, .probe = es58x_probe,
.disconnect = es58x_disconnect, .disconnect = es58x_disconnect,
.id_table = es58x_id_table .id_table = es58x_id_table
......
...@@ -993,7 +993,7 @@ static struct gs_can *gs_make_candev(unsigned int channel, ...@@ -993,7 +993,7 @@ static struct gs_can *gs_make_candev(unsigned int channel,
netdev->flags |= IFF_ECHO; /* we support full roundtrip echo */ netdev->flags |= IFF_ECHO; /* we support full roundtrip echo */
/* dev setup */ /* dev setup */
strcpy(dev->bt_const.name, "gs_usb"); strcpy(dev->bt_const.name, KBUILD_MODNAME);
dev->bt_const.tseg1_min = le32_to_cpu(bt_const->tseg1_min); dev->bt_const.tseg1_min = le32_to_cpu(bt_const->tseg1_min);
dev->bt_const.tseg1_max = le32_to_cpu(bt_const->tseg1_max); dev->bt_const.tseg1_max = le32_to_cpu(bt_const->tseg1_max);
dev->bt_const.tseg2_min = le32_to_cpu(bt_const->tseg2_min); dev->bt_const.tseg2_min = le32_to_cpu(bt_const->tseg2_min);
...@@ -1100,7 +1100,7 @@ static struct gs_can *gs_make_candev(unsigned int channel, ...@@ -1100,7 +1100,7 @@ static struct gs_can *gs_make_candev(unsigned int channel,
return ERR_PTR(rc); return ERR_PTR(rc);
} }
strcpy(dev->data_bt_const.name, "gs_usb"); strcpy(dev->data_bt_const.name, KBUILD_MODNAME);
dev->data_bt_const.tseg1_min = le32_to_cpu(bt_const_extended->dtseg1_min); dev->data_bt_const.tseg1_min = le32_to_cpu(bt_const_extended->dtseg1_min);
dev->data_bt_const.tseg1_max = le32_to_cpu(bt_const_extended->dtseg1_max); dev->data_bt_const.tseg1_max = le32_to_cpu(bt_const_extended->dtseg1_max);
dev->data_bt_const.tseg2_min = le32_to_cpu(bt_const_extended->dtseg2_min); dev->data_bt_const.tseg2_min = le32_to_cpu(bt_const_extended->dtseg2_min);
...@@ -1270,7 +1270,7 @@ static const struct usb_device_id gs_usb_table[] = { ...@@ -1270,7 +1270,7 @@ static const struct usb_device_id gs_usb_table[] = {
MODULE_DEVICE_TABLE(usb, gs_usb_table); MODULE_DEVICE_TABLE(usb, gs_usb_table);
static struct usb_driver gs_usb_driver = { static struct usb_driver gs_usb_driver = {
.name = "gs_usb", .name = KBUILD_MODNAME,
.probe = gs_usb_probe, .probe = gs_usb_probe,
.disconnect = gs_usb_disconnect, .disconnect = gs_usb_disconnect,
.id_table = gs_usb_table, .id_table = gs_usb_table,
......
...@@ -869,7 +869,7 @@ static void kvaser_usb_disconnect(struct usb_interface *intf) ...@@ -869,7 +869,7 @@ static void kvaser_usb_disconnect(struct usb_interface *intf)
} }
static struct usb_driver kvaser_usb_driver = { static struct usb_driver kvaser_usb_driver = {
.name = "kvaser_usb", .name = KBUILD_MODNAME,
.probe = kvaser_usb_probe, .probe = kvaser_usb_probe,
.disconnect = kvaser_usb_disconnect, .disconnect = kvaser_usb_disconnect,
.id_table = kvaser_usb_table, .id_table = kvaser_usb_table,
......
...@@ -871,7 +871,7 @@ static const struct net_device_ops usb_8dev_netdev_ops = { ...@@ -871,7 +871,7 @@ static const struct net_device_ops usb_8dev_netdev_ops = {
}; };
static const struct can_bittiming_const usb_8dev_bittiming_const = { static const struct can_bittiming_const usb_8dev_bittiming_const = {
.name = "usb_8dev", .name = KBUILD_MODNAME,
.tseg1_min = 1, .tseg1_min = 1,
.tseg1_max = 16, .tseg1_max = 16,
.tseg2_min = 1, .tseg2_min = 1,
...@@ -997,7 +997,7 @@ static void usb_8dev_disconnect(struct usb_interface *intf) ...@@ -997,7 +997,7 @@ static void usb_8dev_disconnect(struct usb_interface *intf)
} }
static struct usb_driver usb_8dev_driver = { static struct usb_driver usb_8dev_driver = {
.name = "usb_8dev", .name = KBUILD_MODNAME,
.probe = usb_8dev_probe, .probe = usb_8dev_probe,
.disconnect = usb_8dev_disconnect, .disconnect = usb_8dev_disconnect,
.id_table = usb_8dev_table, .id_table = usb_8dev_table,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment