Skip to contentSkip to conversation

can: remove litteral strings used for driver name and remove DRV_VERSION

PATCH Superseded Vincent Mailhol 4 participants 32 messages Jul 25, 2022 – Sep 15, 2022

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover can: remove litteral strings used for driver name and remove DRV_VERSION

This is a cleanup series.

The patches 1 to 8 get rid of any hardcoded strings and instead relies on either KBUILD_MODNAME or DRV_NAME macros to get the device name. Patch 9 removes the DRV_VERSION macro from etas_es58x driver so that the module uses the default behavior and advertise the kernel version instead of a custom version.

* Changelog *

This series are the first 9 patches of:
https://lore.kernel.org/linux-can/[email protected]/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/[email protected]/

Instead, those patch are send as a standalone series

Vincent Mailhol (9):
can: can327: use KBUILD_MODNAME instead of hard coded name
can: ems_ubs: use KBUILD_MODNAME instead of hard coded name
can: slcan: add DRV_NAME and define pr_fmt to replace hardcoded names
can: softing: add DRV_NAME to replace hardcoded names
can: esd_usb: use KBUILD_MODNAME instead of hard coded name
can: gs_ubs: use KBUILD_MODNAME instead of hard coded name
can: softing: add DRV_NAME to replace hardcoded names
can: ubs_8dev: use KBUILD_MODNAME instead of hard coded name
can: etas_es58x: remove DRV_VERSION

 drivers/net/can/can327.c                         |  4 ++--
 drivers/net/can/slcan/slcan-core.c               | 15 +++++++++------
 drivers/net/can/softing/softing_main.c           |  5 +++--
 drivers/net/can/usb/ems_usb.c                    |  4 ++--
 drivers/net/can/usb/esd_usb.c                    |  2 +-
 drivers/net/can/usb/etas_es58x/es58x_core.c      |  7 ++-----
 drivers/net/can/usb/gs_usb.c                     |  6 +++---
 drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c |  4 +++-
 drivers/net/can/usb/usb_8dev.c                   |  4 ++--
 9 files changed, 27 insertions(+), 24 deletions(-)
Signature · 1 line
2.35.1
#1 lore raw

PATCH 1/9 can: can327: use KBUILD_MODNAME instead of hard coded name

The driver uses the string "can327" to populate tty_ldisc_ops::name. KBUILD_MODNAME also evaluates to "can327". Use KBUILD_MODNAME and get rid on the hardcoded string names.

---
 drivers/net/can/can327.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/can/can327.c +2 -2
index 5da7778d92dc..bf0cce2dbb40 100644
@@ -10,7 +10,7 @@
  *                   Fred N. van Kempen <[email protected]>
  */
 
-#define pr_fmt(fmt) "can327: " fmt
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/init.h>
 #include <linux/module.h>
@@ -1100,7 +1100,7 @@ static int can327_ldisc_ioctl(struct tty_struct *tty, unsigned int cmd,
 
 static struct tty_ldisc_ops can327_ldisc = {
 	.owner = THIS_MODULE,
-	.name = "can327",
+	.name = KBUILD_MODNAME,
 	.num = N_CAN327,
 	.receive_buf = can327_ldisc_rx,
 	.write_wakeup = can327_ldisc_tx_wakeup,
Signature · 1 line
2.35.1
#2 lore raw

PATCH 2/9 can: ems_ubs: use KBUILD_MODNAME instead of hard coded name

In reply to Vincent Mailhol

The driver uses the string "ems_usb" to populate usb_driver::name and can_bittiming_const::name. KBUILD_MODNAME also evaluates to "ems_ubs". Use KBUILD_MODNAME and get rid on the hardcoded string names.

---
 drivers/net/can/usb/ems_usb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/can/usb/ems_usb.c +2 -2
index bbec3311d893..89a64e05cbd7 100644
@@ -880,7 +880,7 @@ static const struct net_device_ops ems_usb_netdev_ops = {
 };
 
 static const struct can_bittiming_const ems_usb_bittiming_const = {
-	.name = "ems_usb",
+	.name = KBUILD_NAME,
 	.tseg1_min = 1,
 	.tseg1_max = 16,
 	.tseg2_min = 1,
@@ -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 */
 static struct usb_driver ems_usb_driver = {
-	.name = "ems_usb",
+	.name = KBUILD_NAME,
 	.probe = ems_usb_probe,
 	.disconnect = ems_usb_disconnect,
 	.id_table = ems_usb_table,
Signature · 1 line
2.35.1
#3 lore raw

Re: [PATCH 2/9] can: ems_ubs: use KBUILD_MODNAME instead of hard coded name

Quoted 15 lines · Vincent Mailhol

The driver uses the string "ems_usb" to populate usb_driver::name and can_bittiming_const::name. KBUILD_MODNAME also evaluates to "ems_ubs". Use KBUILD_MODNAME and get rid on the hardcoded string names.

---
 drivers/net/can/usb/ems_usb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/can/usb/ems_usb.c +0 -0
index bbec3311d893..89a64e05cbd7 100644

drivers/net/can/usb/ems_usb.c static const struct net_device_ops ems_usb_netdev_ops = { · line 883

Quoted 5 lines
drivers/net/can/usb/ems_usb.c +1 -1
@@ -880,7 +880,7 @@ static const struct net_device_ops ems_usb_netdev_ops = {
 };
 
 static const struct can_bittiming_const ems_usb_bittiming_const = {
-	.name = "ems_usb",
+	.name = KBUILD_NAME,

MOD

drivers/net/can/usb/ems_usb.c static void ems_usb_disconnect(struct usb_interface *intf) · line 1077

Quoted 9 lines
drivers/net/can/usb/ems_usb.c +1 -1
 	.tseg1_min = 1,
 	.tseg1_max = 16,
 	.tseg2_min = 1,
@@ -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 */
 static struct usb_driver ems_usb_driver = {
-	.name = "ems_usb",
+	.name = KBUILD_NAME,

MOD

drivers/net/can/usb/ems_usb.c static void ems_usb_disconnect(struct usb_interface *intf) · line 1080

Quoted 3 lines
drivers/net/can/usb/ems_usb.c +0 -0
 	.probe = ems_usb_probe,
 	.disconnect = ems_usb_disconnect,
 	.id_table = ems_usb_table,

regards,
Marc

Signature · 4 lines
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |
#4 lore raw

PATCH 3/9 can: slcan: add DRV_NAME and define pr_fmt to replace hardcoded names

In reply to Vincent Mailhol

The driver uses the string "slcan" to populate tty_ldisc_ops::name. Add a new macro DRV_NAME which evaluates to "slcan" and then use DRV_NAME and to get rid on the hardcoded string names.

Similarly, the pr_info() and pr_err() hardcoded the "slcan" prefix. Define pr_fmt so that the "slcan" prefix gets automatically added.

---

@Dario, because you are also doing a lot of changes on slcan, our patches might conflict. Do not hesitate to take this one and add it to your series to simplify the merge.

---
 drivers/net/can/slcan/slcan-core.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/net/can/slcan/slcan-core.c +9 -6
index dc28e715bbe1..d1562f9474c9 100644
@@ -35,6 +35,9 @@
  *
  */
 
+#define DRV_NAME "slcan"
+#define pr_fmt(fmt) DRV_NAME ": " fmt
+
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 
@@ -864,7 +867,7 @@ static struct slcan *slc_alloc(void)
 	if (!dev)
 		return NULL;
 
-	snprintf(dev->name, sizeof(dev->name), "slcan%d", i);
+	snprintf(dev->name, sizeof(dev->name), DRV_NAME "%d", i);
 	dev->netdev_ops = &slc_netdev_ops;
 	dev->base_addr  = i;
 	slcan_set_ethtool_ops(dev);
@@ -937,7 +940,7 @@ static int slcan_open(struct tty_struct *tty)
 		rtnl_unlock();
 		err = register_candev(sl->dev);
 		if (err) {
-			pr_err("slcan: can't register candev\n");
+			pr_err("can't register candev\n");
 			goto err_free_chan;
 		}
 	} else {
@@ -1028,7 +1031,7 @@ static int slcan_ioctl(struct tty_struct *tty, unsigned int cmd,
 static struct tty_ldisc_ops slc_ldisc = {
 	.owner		= THIS_MODULE,
 	.num		= N_SLCAN,
-	.name		= "slcan",
+	.name		= DRV_NAME,
 	.open		= slcan_open,
 	.close		= slcan_close,
 	.hangup		= slcan_hangup,
@@ -1044,8 +1047,8 @@ static int __init slcan_init(void)
 	if (maxdev < 4)
 		maxdev = 4; /* Sanity */
 
-	pr_info("slcan: serial line CAN interface driver\n");
-	pr_info("slcan: %d dynamic interface channels.\n", maxdev);
+	pr_info("serial line CAN interface driver\n");
+	pr_info("%d dynamic interface channels.\n", maxdev);
 
 	slcan_devs = kcalloc(maxdev, sizeof(struct net_device *), GFP_KERNEL);
 	if (!slcan_devs)
@@ -1054,7 +1057,7 @@ static int __init slcan_init(void)
 	/* Fill in our line protocol discipline, and register it */
 	status = tty_register_ldisc(&slc_ldisc);
 	if (status)  {
-		pr_err("slcan: can't register line discipline\n");
+		pr_err("can't register line discipline\n");
 		kfree(slcan_devs);
 	}
 	return status;
Signature · 1 line
2.35.1
#5 lore raw

PATCH 4/9 can: softing: add DRV_NAME to replace hardcoded names

In reply to Vincent Mailhol

The driver uses the string "softing" to populate platform_driver::name and can_bittiming_const::name. Add a new macro DRV_NAME which evaluates to "ems_ubs" and then use DRV_NAME and to get rid on the hardcoded string names.

---
 drivers/net/can/softing/softing_main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/can/softing/softing_main.c +3 -2
index 8d27ac66ca7f..d810fe6915a4 100644
@@ -11,6 +11,7 @@
 
 #include "softing.h"
 
+#define DRV_NAME "softing"
 #define TX_ECHO_SKB_MAX (((TXMAX+1)/2)-1)
 
 /*
@@ -612,7 +613,7 @@ static const struct net_device_ops softing_netdev_ops = {
 };
 
 static const struct can_bittiming_const softing_btr_const = {
-	.name = "softing",
+	.name = DRV_NAME,
 	.tseg1_min = 1,
 	.tseg1_max = 16,
 	.tseg2_min = 1,
@@ -846,7 +847,7 @@ static int softing_pdev_probe(struct platform_device *pdev)
 
 static struct platform_driver softing_driver = {
 	.driver = {
-		.name = "softing",
+		.name = DRV_NAME,
 	},
 	.probe = softing_pdev_probe,
 	.remove = softing_pdev_remove,
Signature · 1 line
2.35.1
#6 lore raw

Re: [PATCH 4/9] can: softing: add DRV_NAME to replace hardcoded names

Quoted 23 lines · Vincent Mailhol

The driver uses the string "softing" to populate platform_driver::name and can_bittiming_const::name. Add a new macro DRV_NAME which evaluates to "ems_ubs" and then use DRV_NAME and to get rid on the hardcoded string names.

---
 drivers/net/can/softing/softing_main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/can/softing/softing_main.c +1 -0
index 8d27ac66ca7f..d810fe6915a4 100644
@@ -11,6 +11,7 @@
 
 #include "softing.h"
 
+#define DRV_NAME "softing"
 #define TX_ECHO_SKB_MAX (((TXMAX+1)/2)-1)
 
 /*

drivers/net/can/softing/softing_main.c static const struct net_device_ops softing_netdev_ops = { · line 616

Quoted 5 lines
drivers/net/can/softing/softing_main.c +1 -1
@@ -612,7 +613,7 @@ static const struct net_device_ops softing_netdev_ops = {
 };
 
 static const struct can_bittiming_const softing_btr_const = {
-	.name = "softing",
+	.name = DRV_NAME,

KBUILD_MODNAME works here, too.

drivers/net/can/softing/softing_main.c static int softing_pdev_probe(struct platform_device *pdev) · line 850

Quoted 9 lines
drivers/net/can/softing/softing_main.c +1 -1
 	.tseg1_min = 1,
 	.tseg1_max = 16,
 	.tseg2_min = 1,
@@ -846,7 +847,7 @@ static int softing_pdev_probe(struct platform_device *pdev)
 
 static struct platform_driver softing_driver = {
 	.driver = {
-		.name = "softing",
+		.name = DRV_NAME,

same here

Quoted 7 lines
drivers/net/can/softing/softing_main.c +0 -0
 	},
 	.probe = softing_pdev_probe,
 	.remove = softing_pdev_remove,
Signature · 1 line
2.35.1

Marc

Signature · 4 lines
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |
#7 lore raw

PATCH 5/9 can: esd_usb: use KBUILD_MODNAME instead of hard coded name

In reply to Vincent Mailhol

The driver uses the string "ems_usb" to populate usb_driver::name. KBUILD_MODNAME also evaluates to "esd_ubs". Use KBUILD_MODNAME and get rid on the hardcoded string names.

---
 drivers/net/can/usb/ems_usb.c | 4 ++--
 drivers/net/can/usb/esd_usb.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/can/usb/ems_usb.c +2 -2
index 89a64e05cbd7..e86a2033db60 100644
@@ -880,7 +880,7 @@ static const struct net_device_ops ems_usb_netdev_ops = {
 };
 
 static const struct can_bittiming_const ems_usb_bittiming_const = {
-	.name = KBUILD_NAME,
+	.name = KBUILD_MODNAME,
 	.tseg1_min = 1,
 	.tseg1_max = 16,
 	.tseg2_min = 1,
@@ -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 */
 static struct usb_driver ems_usb_driver = {
-	.name = KBUILD_NAME,
+	.name = KBUILD_MODNAME,
 	.probe = ems_usb_probe,
 	.disconnect = ems_usb_disconnect,
 	.id_table = ems_usb_table,
drivers/net/can/usb/esd_usb.c +1 -1
index 177ed33e08d9..7b849bd3cc9c 100644
@@ -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 */
 static struct usb_driver esd_usb_driver = {
-	.name = "esd_usb",
+	.name = KBUILD_MODNAME,
 	.probe = esd_usb_probe,
 	.disconnect = esd_usb_disconnect,
 	.id_table = esd_usb_table,
Signature · 1 line
2.35.1
#8 lore raw

Re: [PATCH 5/9] can: esd_usb: use KBUILD_MODNAME instead of hard coded name

Quoted 25 lines · Vincent Mailhol

The driver uses the string "ems_usb" to populate usb_driver::name. KBUILD_MODNAME also evaluates to "esd_ubs". Use KBUILD_MODNAME and get rid on the hardcoded string names.

---
 drivers/net/can/usb/ems_usb.c | 4 ++--
 drivers/net/can/usb/esd_usb.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/can/usb/ems_usb.c +1 -1
index 89a64e05cbd7..e86a2033db60 100644
@@ -880,7 +880,7 @@ static const struct net_device_ops ems_usb_netdev_ops = {
 };
 
 static const struct can_bittiming_const ems_usb_bittiming_const = {
-	.name = KBUILD_NAME,
+	.name = KBUILD_MODNAME,
 	.tseg1_min = 1,
 	.tseg1_max = 16,
 	.tseg2_min = 1,

drivers/net/can/usb/ems_usb.c static void ems_usb_disconnect(struct usb_interface *intf) · line 1077

Quoted 5 lines
drivers/net/can/usb/ems_usb.c +1 -1
@@ -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 */
 static struct usb_driver ems_usb_driver = {
-	.name = KBUILD_NAME,
+	.name = KBUILD_MODNAME,

These 2 hunks should go into patch 2.

Marc

Quoted 20 lines
drivers/net/can/usb/ems_usb.c +0 -0
 	.probe = ems_usb_probe,
 	.disconnect = ems_usb_disconnect,
 	.id_table = ems_usb_table,
drivers/net/can/usb/esd_usb.c +1 -1
index 177ed33e08d9..7b849bd3cc9c 100644
@@ -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 */
 static struct usb_driver esd_usb_driver = {
-	.name = "esd_usb",
+	.name = KBUILD_MODNAME,
 	.probe = esd_usb_probe,
 	.disconnect = esd_usb_disconnect,
 	.id_table = esd_usb_table,
Signature · 1 line
2.35.1
Signature · 4 lines
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |
#9 lore raw

PATCH 6/9 can: gs_ubs: use KBUILD_MODNAME instead of hard coded name

In reply to Vincent Mailhol

The driver uses the string "gs_usb" to populate usb_driver::name, can_bittiming_const::name and can_data_bittiming_const::name. KBUILD_MODNAME evaluates to "gs_ubs". Use KBUILD_MODNAME and get rid on the hardcoded string names.

---
 drivers/net/can/usb/gs_usb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/can/usb/gs_usb.c +3 -3
index d3a658b444b5..fd239b523c42 100644
@@ -993,7 +993,7 @@ static struct gs_can *gs_make_candev(unsigned int channel,
 	netdev->flags |= IFF_ECHO; /* we support full roundtrip echo */
 
 	/* 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_max = le32_to_cpu(bt_const->tseg1_max);
 	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,
 			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_max = le32_to_cpu(bt_const_extended->dtseg1_max);
 		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[] = {
 MODULE_DEVICE_TABLE(usb, gs_usb_table);
 
 static struct usb_driver gs_usb_driver = {
-	.name = "gs_usb",
+	.name = KBUILD_MODNAME,
 	.probe = gs_usb_probe,
 	.disconnect = gs_usb_disconnect,
 	.id_table = gs_usb_table,
Signature · 1 line
2.35.1
#10 lore raw

PATCH 7/9 can: softing: add DRV_NAME to replace hardcoded names

In reply to Vincent Mailhol

The driver uses the string "kvaser_usb" to populate usb_driver::name. Add a new macro DRV_NAME which evaluates to "ems_ubs" and then use DRV_NAME and to get rid on the hardcoded string names.

---
 drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +3 -1
index f211bfcb1d97..a6cff8da5a41 100644
@@ -29,6 +29,8 @@
 
 #include "kvaser_usb.h"
 
+#define DRV_NAME "kvaser_usb"
+
 /* Kvaser USB vendor id. */
 #define KVASER_VENDOR_ID			0x0bfd
 
@@ -869,7 +871,7 @@ static void kvaser_usb_disconnect(struct usb_interface *intf)
 }
 
 static struct usb_driver kvaser_usb_driver = {
-	.name = "kvaser_usb",
+	.name = DRV_NAME,
 	.probe = kvaser_usb_probe,
 	.disconnect = kvaser_usb_disconnect,
 	.id_table = kvaser_usb_table,
Signature · 1 line
2.35.1
#11 lore raw

Re: [PATCH 7/9] can: softing: add DRV_NAME to replace hardcoded names

Quoted 24 lines · Vincent Mailhol

The driver uses the string "kvaser_usb" to populate usb_driver::name. Add a new macro DRV_NAME which evaluates to "ems_ubs" and then use DRV_NAME and to get rid on the hardcoded string names.

---
 drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +2 -0
index f211bfcb1d97..a6cff8da5a41 100644
@@ -29,6 +29,8 @@
 
 #include "kvaser_usb.h"
 
+#define DRV_NAME "kvaser_usb"
+
 /* Kvaser USB vendor id. */
 #define KVASER_VENDOR_ID			0x0bfd
 

drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c static void kvaser_usb_disconnect(struct usb_interface *intf) · line 877

Quoted 8 lines
drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +1 -1
@@ -869,7 +871,7 @@ static void kvaser_usb_disconnect(struct usb_interface *intf)
 }
 
 static struct usb_driver kvaser_usb_driver = {
-	.name = "kvaser_usb",
+	.name = DRV_NAME,
 	.probe = kvaser_usb_probe,
 	.disconnect = kvaser_usb_disconnect,
 	.id_table = kvaser_usb_table,

KBUILD_MODNAME works here, too. I just checked with:

| make drivers/net/can/usb/kvaser_usb/kvaser_usb_core.i
| grep -A5 "struct usb_driver kvaser_usb_driver" drivers/net/can/usb/kvaser_usb/kvaser_usb_core.i
| static struct usb_driver kvaser_usb_driver = {
|  .name = "kvaser_usb",
|  .probe = kvaser_usb_probe,
|  .disconnect = kvaser_usb_disconnect,
|  .id_table = kvaser_usb_table,
| };

Marc

Signature · 4 lines
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |
#12 lore raw

PATCH 8/9 can: ubs_8dev: use KBUILD_MODNAME instead of hard coded name

In reply to Vincent Mailhol

The driver uses the string "usb_8dev" to populate usb_driver::name and can_bittiming_const::name. KBUILD_MODNAME also evaluates to "ubs_8dev". Use KBUILD_MODNAME and get rid on the hardcoded string names.

---
 drivers/net/can/usb/usb_8dev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/can/usb/usb_8dev.c +2 -2
index 8b7cd69e20b0..6665a66745a7 100644
@@ -871,7 +871,7 @@ static const struct net_device_ops usb_8dev_netdev_ops = {
 };
 
 static const struct can_bittiming_const usb_8dev_bittiming_const = {
-	.name = "usb_8dev",
+	.name = KBUILD_MODNAME,
 	.tseg1_min = 1,
 	.tseg1_max = 16,
 	.tseg2_min = 1,
@@ -997,7 +997,7 @@ static void usb_8dev_disconnect(struct usb_interface *intf)
 }
 
 static struct usb_driver usb_8dev_driver = {
-	.name =		"usb_8dev",
+	.name =		KBUILD_MODNAME,
 	.probe =	usb_8dev_probe,
 	.disconnect =	usb_8dev_disconnect,
 	.id_table =	usb_8dev_table,
Signature · 1 line
2.35.1
#13 lore raw

PATCH 9/9 can: etas_es58x: remove DRV_VERSION

In reply to Vincent Mailhol

DRV_VERSION is a leftover from when the driver was an out of tree module. The driver version was never incremented despite of the numerous changes made since it was mainstreamed. Keeping an unmaintained driver version number makes no sense. Remove it and rely on the kernel version instead.

---
 drivers/net/can/usb/etas_es58x/es58x_core.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/net/can/usb/etas_es58x/es58x_core.c +2 -5
index 7353745f92d7..3f51488bd649 100644
@@ -18,11 +18,9 @@
 
 #include "es58x_core.h"
 
-#define DRV_VERSION "1.00"
 MODULE_AUTHOR("Vincent Mailhol <[email protected]>");
 MODULE_AUTHOR("Arunachalam Santhanam <[email protected]>");
 MODULE_DESCRIPTION("Socket CAN driver for ETAS ES58X USB adapters");
-MODULE_VERSION(DRV_VERSION);
 MODULE_LICENSE("GPL v2");
 
 #define ES58X_MODULE_NAME "etas_es58x"
@@ -2181,9 +2179,8 @@ static struct es58x_device *es58x_init_es58x_dev(struct usb_interface *intf,
 	struct usb_endpoint_descriptor *ep_in, *ep_out;
 	int ret;
 
-	dev_info(dev,
-		 "Starting %s %s (Serial Number %s) driver version %s\n",
-		 udev->manufacturer, udev->product, udev->serial, DRV_VERSION);
+	dev_info(dev, "Starting %s %s (Serial Number %s)\n",
+		 udev->manufacturer, udev->product, udev->serial);
 
 	ret = usb_find_common_endpoints(intf->cur_altsetting, &ep_in, &ep_out,
 					NULL, NULL);
Signature · 1 line
2.35.1
#14 lore raw

v2 cover can: remove litteral strings used for driver names and remove DRV_VERSION

In reply to Vincent Mailhol

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:

This series are the first 9 patches of:
https://lore.kernel.org/linux-can/[email protected]/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/[email protected]/

Instead, those patch are send as a standalone series

Vincent Mailhol (10):
can: can327: use KBUILD_MODNAME instead of hard coded names
can: ems_usb: use KBUILD_MODNAME instead of hard coded names
can: slcan: use KBUILD_MODNAME and define pr_fmt to replace hardcoded
names
can: softing: use KBUILD_MODNAME instead of hard coded names
can: esd_usb: use KBUILD_MODNAME instead of hard coded names
can: gs_ubs: use KBUILD_MODNAME instead of hard coded names
can: kvaser_usb: use KBUILD_MODNAME instead of hard coded names
can: ubs_8dev: use KBUILD_MODNAME instead of hard coded names
can: etas_es58x: replace ES58X_MODULE_NAME with KBUILD_MODNAME
can: etas_es58x: remove DRV_VERSION

 drivers/net/can/can327.c                         |  4 ++--
 drivers/net/can/slcan/slcan-core.c               | 14 ++++++++------
 drivers/net/can/softing/softing_main.c           |  4 ++--
 drivers/net/can/usb/ems_usb.c                    |  4 ++--
 drivers/net/can/usb/esd_usb.c                    |  2 +-
 drivers/net/can/usb/etas_es58x/es58x_core.c      | 14 +++++---------
 drivers/net/can/usb/gs_usb.c                     |  6 +++---
 drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c |  2 +-
 drivers/net/can/usb/usb_8dev.c                   |  4 ++--
 9 files changed, 26 insertions(+), 28 deletions(-)
Signature · 1 line
2.35.1
#15 lore raw

PATCH v2 1/10 can: can327: use KBUILD_MODNAME instead of hard coded names

The driver uses the string "can327" to populate tty_ldisc_ops::name. KBUILD_MODNAME also evaluates to "can327". Use KBUILD_MODNAME and get rid on the hardcoded string names.

---
 drivers/net/can/can327.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/can/can327.c +2 -2
index 5da7778d92dc..bf0cce2dbb40 100644
@@ -10,7 +10,7 @@
  *                   Fred N. van Kempen <[email protected]>
  */
 
-#define pr_fmt(fmt) "can327: " fmt
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/init.h>
 #include <linux/module.h>
@@ -1100,7 +1100,7 @@ static int can327_ldisc_ioctl(struct tty_struct *tty, unsigned int cmd,
 
 static struct tty_ldisc_ops can327_ldisc = {
 	.owner = THIS_MODULE,
-	.name = "can327",
+	.name = KBUILD_MODNAME,
 	.num = N_CAN327,
 	.receive_buf = can327_ldisc_rx,
 	.write_wakeup = can327_ldisc_tx_wakeup,
Signature · 1 line
2.35.1
#16 lore raw

PATCH v2 2/10 can: ems_usb: use KBUILD_MODNAME instead of hard coded names

In reply to Vincent Mailhol

The driver uses the string "ems_usb" to populate usb_driver::name and can_bittiming_const::name. KBUILD_MODNAME also evaluates to "ems_ubs". Use KBUILD_MODNAME and get rid on the hardcoded string names.

---
 drivers/net/can/usb/ems_usb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/can/usb/ems_usb.c +2 -2
index bbec3311d893..e86a2033db60 100644
@@ -880,7 +880,7 @@ static const struct net_device_ops ems_usb_netdev_ops = {
 };
 
 static const struct can_bittiming_const ems_usb_bittiming_const = {
-	.name = "ems_usb",
+	.name = KBUILD_MODNAME,
 	.tseg1_min = 1,
 	.tseg1_max = 16,
 	.tseg2_min = 1,
@@ -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 */
 static struct usb_driver ems_usb_driver = {
-	.name = "ems_usb",
+	.name = KBUILD_MODNAME,
 	.probe = ems_usb_probe,
 	.disconnect = ems_usb_disconnect,
 	.id_table = ems_usb_table,
Signature · 1 line
2.35.1
#17 lore raw

PATCH v2 3/10 can: slcan: use KBUILD_MODNAME and define pr_fmt to replace hardcoded names

In reply to Vincent Mailhol

The driver uses the string "slcan" to populate tty_ldisc_ops::name. KBUILD_MODNAME also evaluates to "slcan". Use KBUILD_MODNAME to get rid on the hardcoded string names.

Similarly, the pr_info() and pr_err() hardcoded the "slcan" prefix. Define pr_fmt so that the "slcan" prefix gets automatically added.

can: ems_ubs: use KBUILD_MODNAME instead of hard coded name

The driver uses the string "ems_usb" to populate usb_driver::name and can_bittiming_const::name. KBUILD_MODNAME also evaluates to "ems_ubs". Use KBUILD_MODNAME and get rid on the hardcoded string names.

---

@Dario, because you are also doing a lot of changes on slcan, our patches might conflict. Do not hesitate to take this one and add it to your series to simplify the merge.

---
 drivers/net/can/slcan/slcan-core.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/net/can/slcan/slcan-core.c +8 -6
index dc28e715bbe1..3039ce37c8f1 100644
@@ -35,6 +35,8 @@
  *
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 
@@ -864,7 +866,7 @@ static struct slcan *slc_alloc(void)
 	if (!dev)
 		return NULL;
 
-	snprintf(dev->name, sizeof(dev->name), "slcan%d", i);
+	snprintf(dev->name, sizeof(dev->name), KBUILD_MODNAME "%d", i);
 	dev->netdev_ops = &slc_netdev_ops;
 	dev->base_addr  = i;
 	slcan_set_ethtool_ops(dev);
@@ -937,7 +939,7 @@ static int slcan_open(struct tty_struct *tty)
 		rtnl_unlock();
 		err = register_candev(sl->dev);
 		if (err) {
-			pr_err("slcan: can't register candev\n");
+			pr_err("can't register candev\n");
 			goto err_free_chan;
 		}
 	} else {
@@ -1028,7 +1030,7 @@ static int slcan_ioctl(struct tty_struct *tty, unsigned int cmd,
 static struct tty_ldisc_ops slc_ldisc = {
 	.owner		= THIS_MODULE,
 	.num		= N_SLCAN,
-	.name		= "slcan",
+	.name		= KBUILD_MODNAME,
 	.open		= slcan_open,
 	.close		= slcan_close,
 	.hangup		= slcan_hangup,
@@ -1044,8 +1046,8 @@ static int __init slcan_init(void)
 	if (maxdev < 4)
 		maxdev = 4; /* Sanity */
 
-	pr_info("slcan: serial line CAN interface driver\n");
-	pr_info("slcan: %d dynamic interface channels.\n", maxdev);
+	pr_info("serial line CAN interface driver\n");
+	pr_info("%d dynamic interface channels.\n", maxdev);
 
 	slcan_devs = kcalloc(maxdev, sizeof(struct net_device *), GFP_KERNEL);
 	if (!slcan_devs)
@@ -1054,7 +1056,7 @@ static int __init slcan_init(void)
 	/* Fill in our line protocol discipline, and register it */
 	status = tty_register_ldisc(&slc_ldisc);
 	if (status)  {
-		pr_err("slcan: can't register line discipline\n");
+		pr_err("can't register line discipline\n");
 		kfree(slcan_devs);
 	}
 	return status;
Signature · 1 line
2.35.1
#18 lore raw

PATCH v2 4/10 can: softing: use KBUILD_MODNAME instead of hard coded names

In reply to Vincent Mailhol

The driver uses the string "softing" to populate platform_driver::name and can_bittiming_const::name. KBUILD_MODNAME also evaluates to "softing". Use KBUILD_MODNAME and get rid on the hardcoded string names.

---
 drivers/net/can/softing/softing_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/can/softing/softing_main.c +2 -2
index 8d27ac66ca7f..8cca6f07e7c3 100644
@@ -612,7 +612,7 @@ static const struct net_device_ops softing_netdev_ops = {
 };
 
 static const struct can_bittiming_const softing_btr_const = {
-	.name = "softing",
+	.name = KBUILD_MODNAME,
 	.tseg1_min = 1,
 	.tseg1_max = 16,
 	.tseg2_min = 1,
@@ -846,7 +846,7 @@ static int softing_pdev_probe(struct platform_device *pdev)
 
 static struct platform_driver softing_driver = {
 	.driver = {
-		.name = "softing",
+		.name = KBUILD_MODNAME,
 	},
 	.probe = softing_pdev_probe,
 	.remove = softing_pdev_remove,
Signature · 1 line
2.35.1
#19 lore raw

PATCH v2 5/10 can: esd_usb: use KBUILD_MODNAME instead of hard coded names

In reply to Vincent Mailhol

The driver uses the string "ems_usb" to populate usb_driver::name. KBUILD_MODNAME also evaluates to "esd_ubs". Use KBUILD_MODNAME and get rid on the hardcoded string names.

---
 drivers/net/can/usb/esd_usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/usb/esd_usb.c +1 -1
index 177ed33e08d9..7b849bd3cc9c 100644
@@ -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 */
 static struct usb_driver esd_usb_driver = {
-	.name = "esd_usb",
+	.name = KBUILD_MODNAME,
 	.probe = esd_usb_probe,
 	.disconnect = esd_usb_disconnect,
 	.id_table = esd_usb_table,
Signature · 1 line
2.35.1
#20 lore raw

PATCH v2 6/10 can: gs_ubs: use KBUILD_MODNAME instead of hard coded names

In reply to Vincent Mailhol

The driver uses the string "gs_usb" to populate usb_driver::name, can_bittiming_const::name and can_data_bittiming_const::name. KBUILD_MODNAME evaluates to "gs_ubs". Use KBUILD_MODNAME and get rid on the hardcoded string names.

---
 drivers/net/can/usb/gs_usb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/can/usb/gs_usb.c +3 -3
index d3a658b444b5..fd239b523c42 100644
@@ -993,7 +993,7 @@ static struct gs_can *gs_make_candev(unsigned int channel,
 	netdev->flags |= IFF_ECHO; /* we support full roundtrip echo */
 
 	/* 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_max = le32_to_cpu(bt_const->tseg1_max);
 	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,
 			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_max = le32_to_cpu(bt_const_extended->dtseg1_max);
 		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[] = {
 MODULE_DEVICE_TABLE(usb, gs_usb_table);
 
 static struct usb_driver gs_usb_driver = {
-	.name = "gs_usb",
+	.name = KBUILD_MODNAME,
 	.probe = gs_usb_probe,
 	.disconnect = gs_usb_disconnect,
 	.id_table = gs_usb_table,
Signature · 1 line
2.35.1
#21 lore raw

PATCH v2 7/10 can: kvaser_usb: use KBUILD_MODNAME instead of hard coded names

In reply to Vincent Mailhol

The driver uses the string "kvaser_usb" to populate usb_driver::name. KBUILD_MODNAME also evaluates to "kvaser_ubs". Use KBUILD_MODNAME and get rid on the hardcoded string names.

---
 drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +1 -1
index f211bfcb1d97..ce60b16ac8ee 100644
@@ -869,7 +869,7 @@ static void kvaser_usb_disconnect(struct usb_interface *intf)
 }
 
 static struct usb_driver kvaser_usb_driver = {
-	.name = "kvaser_usb",
+	.name = KBUILD_MODNAME,
 	.probe = kvaser_usb_probe,
 	.disconnect = kvaser_usb_disconnect,
 	.id_table = kvaser_usb_table,
Signature · 1 line
2.35.1
#22 lore raw

PATCH v2 8/10 can: ubs_8dev: use KBUILD_MODNAME instead of hard coded names

In reply to Vincent Mailhol

The driver uses the string "usb_8dev" to populate usb_driver::name and can_bittiming_const::name. KBUILD_MODNAME also evaluates to "ubs_8dev". Use KBUILD_MODNAME and get rid on the hardcoded string names.

---
 drivers/net/can/usb/usb_8dev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/can/usb/usb_8dev.c +2 -2
index 8b7cd69e20b0..6665a66745a7 100644
@@ -871,7 +871,7 @@ static const struct net_device_ops usb_8dev_netdev_ops = {
 };
 
 static const struct can_bittiming_const usb_8dev_bittiming_const = {
-	.name = "usb_8dev",
+	.name = KBUILD_MODNAME,
 	.tseg1_min = 1,
 	.tseg1_max = 16,
 	.tseg2_min = 1,
@@ -997,7 +997,7 @@ static void usb_8dev_disconnect(struct usb_interface *intf)
 }
 
 static struct usb_driver usb_8dev_driver = {
-	.name =		"usb_8dev",
+	.name =		KBUILD_MODNAME,
 	.probe =	usb_8dev_probe,
 	.disconnect =	usb_8dev_disconnect,
 	.id_table =	usb_8dev_table,
Signature · 1 line
2.35.1
#23 lore raw

PATCH v2 9/10 can: etas_es58x: replace ES58X_MODULE_NAME with KBUILD_MODNAME

In reply to Vincent Mailhol

ES58X_MODULE_NAME is set to "etas_es58x". KBUILD_MODNAME also evaluates to "etas_es58x". Get rid of ES58X_MODULE_NAME and rely on KBUILD_MODNAME instead.

---
 drivers/net/can/usb/etas_es58x/es58x_core.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/net/can/usb/etas_es58x/es58x_core.c +3 -4
index 7353745f92d7..ade0a650e0ed 100644
@@ -25,7 +25,6 @@ MODULE_DESCRIPTION("Socket CAN driver for ETAS ES58X USB adapters");
 MODULE_VERSION(DRV_VERSION);
 MODULE_LICENSE("GPL v2");
 
-#define ES58X_MODULE_NAME "etas_es58x"
 #define ES58X_VENDOR_ID 0x108C
 #define ES581_4_PRODUCT_ID 0x0159
 #define ES582_1_PRODUCT_ID 0x0168
@@ -59,11 +58,11 @@ MODULE_DEVICE_TABLE(usb, es58x_id_table);
 
 #define es58x_print_hex_dump(buf, len)					\
 	print_hex_dump(KERN_DEBUG,					\
-		       ES58X_MODULE_NAME " " __stringify(buf) ": ",	\
+		       KBUILD_MODNAME " " __stringify(buf) ": ",	\
 		       DUMP_PREFIX_NONE, 16, 1, buf, len, false)
 
 #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)
 
 /* The last two bytes of an ES58X command is a CRC16. The first two
@@ -2280,7 +2279,7 @@ static void es58x_disconnect(struct usb_interface *intf)
 }
 
 static struct usb_driver es58x_driver = {
-	.name = ES58X_MODULE_NAME,
+	.name = KBUILD_MODNAME,
 	.probe = es58x_probe,
 	.disconnect = es58x_disconnect,
 	.id_table = es58x_id_table
Signature · 1 line
2.35.1
#24 lore raw

PATCH v2 10/10 can: etas_es58x: remove DRV_VERSION

In reply to Vincent Mailhol

DRV_VERSION is a leftover from when the driver was an out of tree module. The driver version was never incremented despite of the numerous changes made since it was mainstreamed. Keeping an unmaintained driver version number makes no sense. Remove it and rely on the kernel version instead.

---
 drivers/net/can/usb/etas_es58x/es58x_core.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/net/can/usb/etas_es58x/es58x_core.c +2 -5
index ade0a650e0ed..c22e989d42ff 100644
@@ -18,11 +18,9 @@
 
 #include "es58x_core.h"
 
-#define DRV_VERSION "1.00"
 MODULE_AUTHOR("Vincent Mailhol <[email protected]>");
 MODULE_AUTHOR("Arunachalam Santhanam <[email protected]>");
 MODULE_DESCRIPTION("Socket CAN driver for ETAS ES58X USB adapters");
-MODULE_VERSION(DRV_VERSION);
 MODULE_LICENSE("GPL v2");
 
 #define ES58X_VENDOR_ID 0x108C
@@ -2180,9 +2178,8 @@ static struct es58x_device *es58x_init_es58x_dev(struct usb_interface *intf,
 	struct usb_endpoint_descriptor *ep_in, *ep_out;
 	int ret;
 
-	dev_info(dev,
-		 "Starting %s %s (Serial Number %s) driver version %s\n",
-		 udev->manufacturer, udev->product, udev->serial, DRV_VERSION);
+	dev_info(dev, "Starting %s %s (Serial Number %s)\n",
+		 udev->manufacturer, udev->product, udev->serial);
 
 	ret = usb_find_common_endpoints(intf->cur_altsetting, &ep_in, &ep_out,
 					NULL, NULL);
Signature · 1 line
2.35.1
#25 lore raw

Re: [PATCH v2 00/10] can: remove litteral strings used for driver names and remove DRV_VERSION

In reply to Vincent Mailhol
Quoted 8 lines · Vincent Mailhol

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.

Added to linux-can-next/master. Dropped patch "[PATCH v2 03/14] can:
slcan: add software tx timestamps", to let Dario Binacchi pick that up.

regards,
Marc

Signature · 4 lines
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |
maintainer
#26 lore raw

Re: [PATCH v2 00/10] can: remove litteral strings used for driver names and remove DRV_VERSION

Quoted 11 lines · Marc Kleine-Budde
Quoted 8 lines · Vincent Mailhol

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.

Quoted 2 lines

Added to linux-can-next/master. Dropped patch "[PATCH v2 03/14] can:
slcan: add software tx timestamps", to let Dario Binacchi pick that up.

or "can: slcan: use KBUILD_MODNAME and define pr_fmt to replace hardcoded names" ?

Thanks and regards,
Dario

Quoted 9 lines

regards,
Marc

--

Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |
Signature · 17 lines
Dario Binacchi

Embedded Linux Developer

[email protected]

__________________________________


Amarula Solutions SRL

Via Le Canevare 30, 31100 Treviso, Veneto, IT

T. +39 042 243 5310
[email protected]

www.amarulasolutions.com
#27 lore raw

Re: [PATCH v2 00/10] can: remove litteral strings used for driver names and remove DRV_VERSION

Quoted 12 lines · Dario Binacchi
Quoted 11 lines · Marc Kleine-Budde
Quoted 8 lines · Vincent Mailhol

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.

Quoted 5 lines
Quoted 2 lines

Added to linux-can-next/master. Dropped patch "[PATCH v2 03/14] can:
slcan: add software tx timestamps", to let Dario Binacchi pick that up.

or "can: slcan: use KBUILD_MODNAME and define pr_fmt to replace hardcoded names" ?

Doh! ACK, fixed.

Marc

Signature · 4 lines
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |
#28 lore raw

Re: [PATCH v2 00/10] can: remove litteral strings used for driver names and remove DRV_VERSION

In reply to Vincent Mailhol

Tue, Jul 26, 2022 at 05:26:57PM +0900, Vincent Mailhol kirjoitti:

Quoted 8 lines

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.

I guess you all understand that this is potential ABI breakage. The driver can be instantiated by its name (for matching purposes) from board files or MFD cell. If you change the name of the file, the module will be changed and hence the breakage.

That said, NAK from me (as I do usually the opposite change).

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#29 lore raw

Re: [PATCH v2 00/10] can: remove litteral strings used for driver names and remove DRV_VERSION

Quoted 11 lines · On 15.09.2022 15:18:02, [email protected] wrote:

Tue, Jul 26, 2022 at 05:26:57PM +0900, Vincent Mailhol kirjoitti:

Quoted 8 lines

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.

I guess you all understand that this is potential ABI breakage.

Good point.

Quoted 2 lines

The driver can be instantiated by its name (for matching purposes) from board files or MFD cell.

Hope we don't have board files anymore....

Quoted 4 lines

If you change the name of the file, the module will be changed and hence the breakage.

That said, NAK from me (as I do usually the opposite change).

Let's look at the diffstat:

These are serial line disciplines, they have their own ID:

 drivers/net/can/can327.c                         |  4 ++--
 drivers/net/can/slcan/slcan-core.c               | 14 ++++++++------

This might be a problem, it's a platform driver:

 drivers/net/can/softing/softing_main.c           |  4 ++--

It should be no problem for USB devices, right?

 drivers/net/can/usb/ems_usb.c                    |  4 ++--
 drivers/net/can/usb/esd_usb.c                    |  2 +-
 drivers/net/can/usb/etas_es58x/es58x_core.c      | 14 +++++---------
 drivers/net/can/usb/gs_usb.c                     |  6 +++---
 drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c |  2 +-
 drivers/net/can/usb/usb_8dev.c                   |  4 ++--

Marc

--

Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |
#30 lore raw

Re: [PATCH v2 00/10] can: remove litteral strings used for driver names and remove DRV_VERSION

Quoted 34 lines · Marc Kleine-Budde
Quoted 11 lines · On 15.09.2022 15:18:02, [email protected] wrote:

Tue, Jul 26, 2022 at 05:26:57PM +0900, Vincent Mailhol kirjoitti:

Quoted 8 lines

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.

I guess you all understand that this is potential ABI breakage.

Good point.

Quoted 2 lines

The driver can be instantiated by its name (for matching purposes) from board files or MFD cell.

Hope we don't have board files anymore....

Quoted 4 lines

If you change the name of the file, the module will be changed and hence the breakage.

That said, NAK from me (as I do usually the opposite change).

Let's look at the diffstat:

These are serial line disciplines, they have their own ID:

 drivers/net/can/can327.c                         |  4 ++--
 drivers/net/can/slcan/slcan-core.c               | 14 ++++++++------

This might be a problem, it's a platform driver:

 drivers/net/can/softing/softing_main.c           |  4 ++--
Quoted 7 lines

It should be no problem for USB devices, right?

 drivers/net/can/usb/ems_usb.c                    |  4 ++--
 drivers/net/can/usb/esd_usb.c                    |  2 +-
 drivers/net/can/usb/etas_es58x/es58x_core.c      | 14 +++++---------
 drivers/net/can/usb/gs_usb.c                     |  6 +++---
 drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c |  2 +-
 drivers/net/can/usb/usb_8dev.c                   |  4 ++--

I agree with your grouping and analysis. This is minor anyway, but better to have it more robust. So, yes, with USB I don't believe it would be an issue, but for platform driver it might be.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#31 lore raw

Re: [PATCH v2 00/10] can: remove litteral strings used for driver names and remove DRV_VERSION

Quoted 22 lines · Andy Shevchenko
Quoted 14 lines
Quoted 4 lines

If you change the name of the file, the module will be changed and hence the breakage.

That said, NAK from me (as I do usually the opposite change).

Let's look at the diffstat:

These are serial line disciplines, they have their own ID:

 drivers/net/can/can327.c                         |  4 ++--
 drivers/net/can/slcan/slcan-core.c               | 14 ++++++++------

This might be a problem, it's a platform driver:

 drivers/net/can/softing/softing_main.c           |  4 ++--
Quoted 7 lines

It should be no problem for USB devices, right?

 drivers/net/can/usb/ems_usb.c                    |  4 ++--
 drivers/net/can/usb/esd_usb.c                    |  2 +-
 drivers/net/can/usb/etas_es58x/es58x_core.c      | 14 +++++---------
 drivers/net/can/usb/gs_usb.c                     |  6 +++---
 drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c |  2 +-
 drivers/net/can/usb/usb_8dev.c                   |  4 ++--
Quoted 3 lines

I agree with your grouping and analysis. This is minor anyway, but better to have it more robust. So, yes, with USB I don't believe it would be an issue, but for platform driver it might be.

This series is in >= v6.0 and there are several platform drivers that use KBUILD_MODNAME for .name before this series.

I'll take care to revert that change on the softing driver and prepare patches for the others.

regards,
Marc

Signature · 4 lines
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |