From: Dario Binacchi <dario.binacchi@amarulasolutions.com>
To: linux-kernel@vger.kernel.org
Cc: linux-can@vger.kernel.org, Marc Kleine-Budde <mkl@pengutronix.de>,
Jeroen Hofstee <jhofstee@victronenergy.com>,
michael@amarulasolutions.com,
Amarula patchwork <linux-amarula@amarulasolutions.com>,
Oliver Hartkopp <socketcan@hartkopp.net>,
Vincent Mailhol <mailhol.vincent@wanadoo.fr>,
Dario Binacchi <dario.binacchi@amarulasolutions.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Wolfgang Grandegger <wg@grandegger.com>,
netdev@vger.kernel.org
Subject: [PATCH v4 1/7] can: slcan: use KBUILD_MODNAME and define pr_fmt to replace hardcoded names
Date: Thu, 28 Jul 2022 09:02:48 +0200 [thread overview]
Message-ID: <20220728070254.267974-2-dario.binacchi@amarulasolutions.com> (raw)
In-Reply-To: <20220728070254.267974-1-dario.binacchi@amarulasolutions.com>
From: Vincent Mailhol <mailhol.vincent@wanadoo.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@amarulasolutions.com>
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
(no changes since v1)
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 dfd1baba4130..2c9d9fc19ea9 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>
@@ -863,7 +865,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);
@@ -936,7 +938,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 {
@@ -1027,7 +1029,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,
@@ -1043,8 +1045,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)
@@ -1053,7 +1055,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.32.0
next prev parent reply other threads:[~2022-07-28 7:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-28 7:02 [PATCH v4 0/7] can: slcan: extend supported features (step 2) Dario Binacchi
2022-07-28 7:02 ` Dario Binacchi [this message]
2022-07-28 7:02 ` [PATCH v4 2/7] can: slcan: remove useless header inclusions Dario Binacchi
2022-07-28 7:02 ` [PATCH v4 3/7] can: slcan: remove legacy infrastructure Dario Binacchi
2022-07-28 7:02 ` [PATCH v4 4/7] can: slcan: change every `slc' occurrence in `slcan' Dario Binacchi
2022-07-28 7:02 ` [PATCH v4 5/7] can: slcan: use the generic can_change_mtu() Dario Binacchi
2022-07-28 7:02 ` [PATCH v4 6/7] can: slcan: add support for listen-only mode Dario Binacchi
2022-07-28 7:02 ` [PATCH v4 7/7] MAINTAINERS: Add maintainer for the slcan driver Dario Binacchi
2022-07-28 7:23 ` [PATCH v4 0/7] can: slcan: extend supported features (step 2) Marc Kleine-Budde
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220728070254.267974-2-dario.binacchi@amarulasolutions.com \
--to=dario.binacchi@amarulasolutions.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jhofstee@victronenergy.com \
--cc=kuba@kernel.org \
--cc=linux-amarula@amarulasolutions.com \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mailhol.vincent@wanadoo.fr \
--cc=michael@amarulasolutions.com \
--cc=mkl@pengutronix.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=socketcan@hartkopp.net \
--cc=wg@grandegger.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®