[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220731192029.746751-15-mkl@pengutronix.de>
Date: Sun, 31 Jul 2022 21:20:07 +0200
From: Marc Kleine-Budde <mkl@...gutronix.de>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, kuba@...nel.org, linux-can@...r.kernel.org,
kernel@...gutronix.de,
Vincent Mailhol <mailhol.vincent@...adoo.fr>,
Dario Binacchi <dario.binacchi@...rulasolutions.com>,
Marc Kleine-Budde <mkl@...gutronix.de>
Subject: [PATCH net-next 14/36] can: slcan: use KBUILD_MODNAME and define pr_fmt to replace hardcoded names
From: Vincent Mailhol <mailhol.vincent@...adoo.fr>
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.
CC: Dario Binacchi <dario.binacchi@...rulasolutions.com>
Signed-off-by: Vincent Mailhol <mailhol.vincent@...adoo.fr>
Signed-off-by: Dario Binacchi <dario.binacchi@...rulasolutions.com>
Link: https://lore.kernel.org/all/20220728070254.267974-2-dario.binacchi@amarulasolutions.com
Signed-off-by: Marc Kleine-Budde <mkl@...gutronix.de>
---
drivers/net/can/slcan/slcan-core.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/net/can/slcan/slcan-core.c b/drivers/net/can/slcan/slcan-core.c
index 6162e6132ea4..3b1f39d69e6e 100644
--- a/drivers/net/can/slcan/slcan-core.c
+++ b/drivers/net/can/slcan/slcan-core.c
@@ -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->ethtool_ops = &slcan_ethtool_ops;
dev->base_addr = i;
@@ -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;
--
2.35.1
Powered by blists - more mailing lists