linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] can: eliminate banner[] variable and switch to pr_info()
@ 2014-11-22  7:42 Jeremiah Mahler
  2014-11-22 16:41 ` Oliver Hartkopp
  2014-11-22 16:59 ` Marc Kleine-Budde
  0 siblings, 2 replies; 4+ messages in thread
From: Jeremiah Mahler @ 2014-11-22  7:42 UTC (permalink / raw)
  To: Oliver Hartkopp
  Cc: David S. Miller, linux-can, netdev, linux-kernel, Jeremiah Mahler

Several CAN modules use a design pattern with a banner[] variable at the
top which defines a string that is used once during init to print the
banner.  The 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.

Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
---
 net/can/af_can.c | 5 +----
 net/can/bcm.c    | 4 +---
 net/can/raw.c    | 4 +---
 3 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/net/can/af_can.c b/net/can/af_can.c
index ce82337..ac05be1 100644
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -64,9 +64,6 @@
 
 #include "af_can.h"
 
-static __initconst const char banner[] = KERN_INFO
-	"can: controller area network core (" CAN_VERSION_STRING ")\n";
-
 MODULE_DESCRIPTION("Controller Area Network PF_CAN core");
 MODULE_LICENSE("Dual BSD/GPL");
 MODULE_AUTHOR("Urs Thuermann <urs.thuermann@volkswagen.de>, "
@@ -896,7 +893,7 @@ static __init int can_init(void)
 		     offsetof(struct can_frame, data) !=
 		     offsetof(struct canfd_frame, data));
 
-	printk(banner);
+	pr_info("can: controller area network core (" CAN_VERSION_STRING ")\n");
 
 	memset(&can_rx_alldev_list, 0, sizeof(can_rx_alldev_list));
 
diff --git a/net/can/bcm.c b/net/can/bcm.c
index dcb75c0..9aa3f76 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -78,8 +78,6 @@
 		     (CAN_SFF_MASK | CAN_EFF_FLAG | CAN_RTR_FLAG))
 
 #define CAN_BCM_VERSION CAN_VERSION
-static __initconst const char banner[] = KERN_INFO
-	"can: broadcast manager protocol (rev " CAN_BCM_VERSION " t)\n";
 
 MODULE_DESCRIPTION("PF_CAN broadcast manager protocol");
 MODULE_LICENSE("Dual BSD/GPL");
@@ -1615,7 +1613,7 @@ static int __init bcm_module_init(void)
 {
 	int err;
 
-	printk(banner);
+	pr_info("can: broadcast manager protocol (rev " CAN_BCM_VERSION " t)\n");
 
 	err = can_proto_register(&bcm_can_proto);
 	if (err < 0) {
diff --git a/net/can/raw.c b/net/can/raw.c
index 081e81f..e3250e2 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -56,8 +56,6 @@
 #include <net/net_namespace.h>
 
 #define CAN_RAW_VERSION CAN_VERSION
-static __initconst const char banner[] =
-	KERN_INFO "can: raw protocol (rev " CAN_RAW_VERSION ")\n";
 
 MODULE_DESCRIPTION("PF_CAN raw protocol");
 MODULE_LICENSE("Dual BSD/GPL");
@@ -810,7 +808,7 @@ static __init int raw_module_init(void)
 {
 	int err;
 
-	printk(banner);
+	pr_info("can: raw protocol (rev " CAN_RAW_VERSION ")\n");
 
 	err = can_proto_register(&raw_can_proto);
 	if (err < 0)
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] can: eliminate banner[] variable and switch to pr_info()
  2014-11-22  7:42 [PATCH] can: eliminate banner[] variable and switch to pr_info() Jeremiah Mahler
@ 2014-11-22 16:41 ` Oliver Hartkopp
  2014-11-22 20:18   ` Jeremiah Mahler
  2014-11-22 16:59 ` Marc Kleine-Budde
  1 sibling, 1 reply; 4+ messages in thread
From: Oliver Hartkopp @ 2014-11-22 16:41 UTC (permalink / raw)
  To: Jeremiah Mahler; +Cc: David S. Miller, linux-can, netdev, linux-kernel

On 22.11.2014 08:42, Jeremiah Mahler wrote:
> Several CAN modules use a design pattern with a banner[] variable at the
> top which defines a string that is used once during init to print the
> banner.  The 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.
>
> Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>

Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>

Next time please only post on linux-can ML which is the first address for CAN 
related stuff - as long as you don't feel it's a networking relevant issue.

But for almost editorial changes - which is not urgent - linux-can should be 
enough.

Thanks,
Oliver


> ---
>   net/can/af_can.c | 5 +----
>   net/can/bcm.c    | 4 +---
>   net/can/raw.c    | 4 +---
>   3 files changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/net/can/af_can.c b/net/can/af_can.c
> index ce82337..ac05be1 100644
> --- a/net/can/af_can.c
> +++ b/net/can/af_can.c
> @@ -64,9 +64,6 @@
>
>   #include "af_can.h"
>
> -static __initconst const char banner[] = KERN_INFO
> -	"can: controller area network core (" CAN_VERSION_STRING ")\n";
> -
>   MODULE_DESCRIPTION("Controller Area Network PF_CAN core");
>   MODULE_LICENSE("Dual BSD/GPL");
>   MODULE_AUTHOR("Urs Thuermann <urs.thuermann@volkswagen.de>, "
> @@ -896,7 +893,7 @@ static __init int can_init(void)
>   		     offsetof(struct can_frame, data) !=
>   		     offsetof(struct canfd_frame, data));
>
> -	printk(banner);
> +	pr_info("can: controller area network core (" CAN_VERSION_STRING ")\n");
>
>   	memset(&can_rx_alldev_list, 0, sizeof(can_rx_alldev_list));
>
> diff --git a/net/can/bcm.c b/net/can/bcm.c
> index dcb75c0..9aa3f76 100644
> --- a/net/can/bcm.c
> +++ b/net/can/bcm.c
> @@ -78,8 +78,6 @@
>   		     (CAN_SFF_MASK | CAN_EFF_FLAG | CAN_RTR_FLAG))
>
>   #define CAN_BCM_VERSION CAN_VERSION
> -static __initconst const char banner[] = KERN_INFO
> -	"can: broadcast manager protocol (rev " CAN_BCM_VERSION " t)\n";
>
>   MODULE_DESCRIPTION("PF_CAN broadcast manager protocol");
>   MODULE_LICENSE("Dual BSD/GPL");
> @@ -1615,7 +1613,7 @@ static int __init bcm_module_init(void)
>   {
>   	int err;
>
> -	printk(banner);
> +	pr_info("can: broadcast manager protocol (rev " CAN_BCM_VERSION " t)\n");
>
>   	err = can_proto_register(&bcm_can_proto);
>   	if (err < 0) {
> diff --git a/net/can/raw.c b/net/can/raw.c
> index 081e81f..e3250e2 100644
> --- a/net/can/raw.c
> +++ b/net/can/raw.c
> @@ -56,8 +56,6 @@
>   #include <net/net_namespace.h>
>
>   #define CAN_RAW_VERSION CAN_VERSION
> -static __initconst const char banner[] =
> -	KERN_INFO "can: raw protocol (rev " CAN_RAW_VERSION ")\n";
>
>   MODULE_DESCRIPTION("PF_CAN raw protocol");
>   MODULE_LICENSE("Dual BSD/GPL");
> @@ -810,7 +808,7 @@ static __init int raw_module_init(void)
>   {
>   	int err;
>
> -	printk(banner);
> +	pr_info("can: raw protocol (rev " CAN_RAW_VERSION ")\n");
>
>   	err = can_proto_register(&raw_can_proto);
>   	if (err < 0)
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] can: eliminate banner[] variable and switch to pr_info()
  2014-11-22  7:42 [PATCH] can: eliminate banner[] variable and switch to pr_info() Jeremiah Mahler
  2014-11-22 16:41 ` Oliver Hartkopp
@ 2014-11-22 16:59 ` Marc Kleine-Budde
  1 sibling, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2014-11-22 16:59 UTC (permalink / raw)
  To: Jeremiah Mahler, Oliver Hartkopp
  Cc: David S. Miller, linux-can, netdev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 801 bytes --]

On 11/22/2014 08:42 AM, Jeremiah Mahler wrote:
> Several CAN modules use a design pattern with a banner[] variable at the
> top which defines a string that is used once during init to print the
> banner.  The 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.

Applied to can-next.

Thanks,
Marc

-- 
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   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] can: eliminate banner[] variable and switch to pr_info()
  2014-11-22 16:41 ` Oliver Hartkopp
@ 2014-11-22 20:18   ` Jeremiah Mahler
  0 siblings, 0 replies; 4+ messages in thread
From: Jeremiah Mahler @ 2014-11-22 20:18 UTC (permalink / raw)
  To: Oliver Hartkopp; +Cc: linux-can, linux-kernel

Oliver,

On Sat, Nov 22, 2014 at 05:41:28PM +0100, Oliver Hartkopp wrote:
> On 22.11.2014 08:42, Jeremiah Mahler wrote:
> >Several CAN modules use a design pattern with a banner[] variable at the
> >top which defines a string that is used once during init to print the
> >banner.  The 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.
> >
> >Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
> 
> Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
> 
> Next time please only post on linux-can ML which is the first address for
> CAN related stuff - as long as you don't feel it's a networking relevant
> issue.
> 
> But for almost editorial changes - which is not urgent - linux-can should be
> enough.
> 
> Thanks,
> Oliver
> 
Will do, thanks.

-- 
- Jeremiah Mahler

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-11-22 20:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-22  7:42 [PATCH] can: eliminate banner[] variable and switch to pr_info() Jeremiah Mahler
2014-11-22 16:41 ` Oliver Hartkopp
2014-11-22 20:18   ` Jeremiah Mahler
2014-11-22 16:59 ` Marc Kleine-Budde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).