Skip to contentSkip to conversation

can: slcan/vcan: eliminate banner[] variable, switch to pr_info()

PATCH Applied Jeremiah Mahler 3 participants 3 messages Dec 3, 2014 – Dec 7, 2014 CAN network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 can: slcan/vcan: eliminate banner[] variable, switch to pr_info()

Several can modules in drivers/net/can use a banner[] variable at the top which defines a string that is used once during init. This string is also embedded with KERN_INFO which makes it printk() specific.

Improve the code by eliminating the banner[] variable and moving the string to where it is printed. Then switch from printk(KERN_INFO to pr_info() for the lines that were changed.

This patch is similar to [1] which was applied to net/can.

[1]: https://lkml.org/lkml/2014/11/22/10

---
 drivers/net/can/slcan.c | 7 ++-----
 drivers/net/can/vcan.c  | 5 +----
 2 files changed, 3 insertions(+), 9 deletions(-)
drivers/net/can/slcan.c +2 -5
index acb5b92..c837eb9 100644
@@ -56,9 +56,6 @@
 #include <linux/can.h>
 #include <linux/can/skb.h>
 
-static __initconst const char banner[] =
-	KERN_INFO "slcan: serial line CAN interface driver\n";
-
 MODULE_ALIAS_LDISC(N_SLCAN);
 MODULE_DESCRIPTION("serial line CAN interface");
 MODULE_LICENSE("GPL");
@@ -702,8 +699,8 @@ static int __init slcan_init(void)
 	if (maxdev < 4)
 		maxdev = 4; /* Sanity */
 
-	printk(banner);
-	printk(KERN_INFO "slcan: %d dynamic interface channels.\n", maxdev);
+	pr_info("slcan: serial line CAN interface driver\n");
+	pr_info("slcan: %d dynamic interface channels.\n", maxdev);
 
 	slcan_devs = kzalloc(sizeof(struct net_device *)*maxdev, GFP_KERNEL);
 	if (!slcan_devs)
drivers/net/can/vcan.c +1 -4
index 4e94057..674f367 100644
@@ -50,9 +50,6 @@
 #include <linux/slab.h>
 #include <net/rtnetlink.h>
 
-static __initconst const char banner[] =
-	KERN_INFO "vcan: Virtual CAN interface driver\n";
-
 MODULE_DESCRIPTION("virtual CAN interface");
 MODULE_LICENSE("Dual BSD/GPL");
 MODULE_AUTHOR("Urs Thuermann <[email protected]>");
@@ -173,7 +170,7 @@ static struct rtnl_link_ops vcan_link_ops __read_mostly = {
 
 static __init int vcan_init_module(void)
 {
-	printk(banner);
+	pr_info("vcan: Virtual CAN interface driver\n");
 
 	if (echo)
 		printk(KERN_INFO "vcan: enabled echo on driver level.\n");
Signature · 1 line
2.1.3
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Jeremiah Mahler

Several can modules in drivers/net/can use a banner[] variable at the top which defines a string that is used once during init. This string is also embedded with KERN_INFO which makes it printk() specific.

Improve the code by eliminating the banner[] variable and moving the string to where it is printed. Then switch from printk(KERN_INFO to pr_info() for the lines that were changed.

Quoted 5 lines

This patch is similar to [1] which was applied to net/can.

   [1]: https://lkml.org/lkml/2014/11/22/10

Tnx

Oliver

Quoted 54 lines
---
  drivers/net/can/slcan.c | 7 ++-----
  drivers/net/can/vcan.c  | 5 +----
  2 files changed, 3 insertions(+), 9 deletions(-)
drivers/net/can/slcan.c +2 -5
index acb5b92..c837eb9 100644
@@ -56,9 +56,6 @@
  #include <linux/can.h>
  #include <linux/can/skb.h>
 
-static __initconst const char banner[] =
-	KERN_INFO "slcan: serial line CAN interface driver\n";
-
  MODULE_ALIAS_LDISC(N_SLCAN);
  MODULE_DESCRIPTION("serial line CAN interface");
  MODULE_LICENSE("GPL");
@@ -702,8 +699,8 @@ static int __init slcan_init(void)
  	if (maxdev < 4)
  		maxdev = 4; /* Sanity */
 
-	printk(banner);
-	printk(KERN_INFO "slcan: %d dynamic interface channels.\n", maxdev);
+	pr_info("slcan: serial line CAN interface driver\n");
+	pr_info("slcan: %d dynamic interface channels.\n", maxdev);
 
  	slcan_devs = kzalloc(sizeof(struct net_device *)*maxdev, GFP_KERNEL);
  	if (!slcan_devs)
drivers/net/can/vcan.c +1 -4
index 4e94057..674f367 100644
@@ -50,9 +50,6 @@
  #include <linux/slab.h>
  #include <net/rtnetlink.h>
 
-static __initconst const char banner[] =
-	KERN_INFO "vcan: Virtual CAN interface driver\n";
-
  MODULE_DESCRIPTION("virtual CAN interface");
  MODULE_LICENSE("Dual BSD/GPL");
  MODULE_AUTHOR("Urs Thuermann <[email protected]>");
@@ -173,7 +170,7 @@ static struct rtnl_link_ops vcan_link_ops __read_mostly = {
 
  static __init int vcan_init_module(void)
  {
-	printk(banner);
+	pr_info("vcan: Virtual CAN interface driver\n");
 
  	if (echo)
  		printk(KERN_INFO "vcan: enabled echo on driver level.\n");
maintainer Applied
#2 lore raw
In reply to Jeremiah Mahler
Quoted 8 lines · Jeremiah Mahler

Several can modules in drivers/net/can use a banner[] variable at the top which defines a string that is used once during init. This string is also embedded with KERN_INFO which makes it printk() specific.

Improve the code by eliminating the banner[] variable and moving the string to where it is printed. Then switch from printk(KERN_INFO to pr_info() for the lines that were changed.

Quoted 5 lines

This patch is similar to [1] which was applied to net/can.

[1]: https://lkml.org/lkml/2014/11/22/10

applied to can-next/master.

Tnx,
Marc

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