From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Joe Perches <joe@perches.com>
Cc: Oliver Hartkopp <socketcan@hartkopp.net>,
Urs Thuermann <urs.thuermann@volkswagen.de>,
"David S. Miller" <davem@davemloft.net>,
linux-can@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] can: Update logging style
Date: Tue, 29 Nov 2011 21:06:31 +0100 [thread overview]
Message-ID: <4ED53B47.1030703@pengutronix.de> (raw)
In-Reply-To: <30551d0a6a0f7f7799a6981c81c770a528f430d2.1322592708.git.joe@perches.com>
[-- Attachment #1: Type: text/plain, Size: 9011 bytes --]
On 11/29/2011 07:54 PM, Joe Perches wrote:
> Use pr_fmt, pr_<level> and pr_<level>_ratelimited.
> Coalesce format strings.
>
> Signed-off-by: Joe Perches <joe@perches.com>
The banners will probably looking a bit different, but I think nobody is
screen scraping that output :)
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
> ---
> net/can/af_can.c | 31 ++++++++++++++-----------------
> net/can/bcm.c | 14 ++++++++------
> net/can/gw.c | 6 ++++--
> net/can/proc.c | 8 ++++----
> net/can/raw.c | 8 +++++---
> 5 files changed, 35 insertions(+), 32 deletions(-)
>
> diff --git a/net/can/af_can.c b/net/can/af_can.c
> index 0ce2ad0..c4f0da5 100644
> --- a/net/can/af_can.c
> +++ b/net/can/af_can.c
> @@ -40,6 +40,8 @@
> *
> */
>
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
> #include <linux/module.h>
> #include <linux/init.h>
> #include <linux/kmod.h>
> @@ -62,8 +64,8 @@
>
> #include "af_can.h"
>
> -static __initdata const char banner[] = KERN_INFO
> - "can: controller area network core (" CAN_VERSION_STRING ")\n";
> +static __initdata const char banner[] =
> + "controller area network core (" CAN_VERSION_STRING ")";
>
> MODULE_DESCRIPTION("Controller Area Network PF_CAN core");
> MODULE_LICENSE("Dual BSD/GPL");
> @@ -161,8 +163,8 @@ static int can_create(struct net *net, struct socket *sock, int protocol,
> * return -EPROTONOSUPPORT
> */
> if (err)
> - printk_ratelimited(KERN_ERR "can: request_module "
> - "(can-proto-%d) failed.\n", protocol);
> + pr_err_ratelimited("request_module (can-proto-%d) failed\n",
> + protocol);
>
> cp = can_get_proto(protocol);
> }
> @@ -505,8 +507,7 @@ void can_rx_unregister(struct net_device *dev, canid_t can_id, canid_t mask,
>
> d = find_dev_rcv_lists(dev);
> if (!d) {
> - printk(KERN_ERR "BUG: receive list not found for "
> - "dev %s, id %03X, mask %03X\n",
> + pr_err("BUG: receive list not found for dev %s, id %03X, mask %03X\n",
> DNAME(dev), can_id, mask);
> goto out;
> }
> @@ -532,8 +533,7 @@ void can_rx_unregister(struct net_device *dev, canid_t can_id, canid_t mask,
> */
>
> if (!next) {
> - printk(KERN_ERR "BUG: receive list entry not found for "
> - "dev %s, id %03X, mask %03X\n",
> + pr_err("BUG: receive list entry not found for dev %s, id %03X, mask %03X\n",
> DNAME(dev), can_id, mask);
> r = NULL;
> goto out;
> @@ -701,8 +701,7 @@ int can_proto_register(const struct can_proto *cp)
> int err = 0;
>
> if (proto < 0 || proto >= CAN_NPROTO) {
> - printk(KERN_ERR "can: protocol number %d out of range\n",
> - proto);
> + pr_err("protocol number %d out of range\n", proto);
> return -EINVAL;
> }
>
> @@ -713,8 +712,7 @@ int can_proto_register(const struct can_proto *cp)
> mutex_lock(&proto_tab_lock);
>
> if (proto_tab[proto]) {
> - printk(KERN_ERR "can: protocol %d already registered\n",
> - proto);
> + pr_err("protocol %d already registered\n", proto);
> err = -EBUSY;
> } else
> RCU_INIT_POINTER(proto_tab[proto], cp);
> @@ -769,8 +767,7 @@ static int can_notifier(struct notifier_block *nb, unsigned long msg,
> /* create new dev_rcv_lists for this device */
> d = kzalloc(sizeof(*d), GFP_KERNEL);
> if (!d) {
> - printk(KERN_ERR
> - "can: allocation of receive list failed\n");
> + pr_err("allocation of receive list failed\n");
> return NOTIFY_DONE;
> }
> BUG_ON(dev->ml_priv);
> @@ -790,8 +787,8 @@ static int can_notifier(struct notifier_block *nb, unsigned long msg,
> dev->ml_priv = NULL;
> }
> } else
> - printk(KERN_ERR "can: notifier: receive list not "
> - "found for dev %s\n", dev->name);
> + pr_err("notifier: receive list not found for dev %s\n",
> + dev->name);
>
> spin_unlock(&can_rcvlists_lock);
>
> @@ -824,7 +821,7 @@ static struct notifier_block can_netdev_notifier __read_mostly = {
>
> static __init int can_init(void)
> {
> - printk(banner);
> + pr_info("%s\n", banner);
>
> memset(&can_rx_alldev_list, 0, sizeof(can_rx_alldev_list));
>
> diff --git a/net/can/bcm.c b/net/can/bcm.c
> index 151b773..540c804 100644
> --- a/net/can/bcm.c
> +++ b/net/can/bcm.c
> @@ -39,6 +39,8 @@
> *
> */
>
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
> #include <linux/module.h>
> #include <linux/init.h>
> #include <linux/interrupt.h>
> @@ -77,8 +79,8 @@
> (CAN_SFF_MASK | CAN_EFF_FLAG | CAN_RTR_FLAG))
>
> #define CAN_BCM_VERSION CAN_VERSION
> -static __initdata const char banner[] = KERN_INFO
> - "can: broadcast manager protocol (rev " CAN_BCM_VERSION " t)\n";
> +static __initdata const char banner[] =
> + "broadcast manager protocol (rev " CAN_BCM_VERSION " t)";
>
> MODULE_DESCRIPTION("PF_CAN broadcast manager protocol");
> MODULE_LICENSE("Dual BSD/GPL");
> @@ -729,8 +731,8 @@ static void bcm_rx_unreg(struct net_device *dev, struct bcm_op *op)
> /* mark as removed subscription */
> op->rx_reg_dev = NULL;
> } else
> - printk(KERN_ERR "can-bcm: bcm_rx_unreg: registered device "
> - "mismatch %p %p\n", op->rx_reg_dev, dev);
> + pr_err("%s: registered device mismatch %p %p\n",
> + __func__, op->rx_reg_dev, dev);
> }
>
> /*
> @@ -1606,11 +1608,11 @@ static int __init bcm_module_init(void)
> {
> int err;
>
> - printk(banner);
> + pr_info("%s\n", banner);
>
> err = can_proto_register(&bcm_can_proto);
> if (err < 0) {
> - printk(KERN_ERR "can: registration of bcm protocol failed\n");
> + pr_err("registration of bcm protocol failed\n");
> return err;
> }
>
> diff --git a/net/can/gw.c b/net/can/gw.c
> index 3d79b12..e17253f 100644
> --- a/net/can/gw.c
> +++ b/net/can/gw.c
> @@ -39,6 +39,8 @@
> *
> */
>
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
> #include <linux/module.h>
> #include <linux/init.h>
> #include <linux/types.h>
> @@ -59,7 +61,7 @@
>
> #define CAN_GW_VERSION "20101209"
> static __initdata const char banner[] =
> - KERN_INFO "can: netlink gateway (rev " CAN_GW_VERSION ")\n";
> + "netlink gateway (rev " CAN_GW_VERSION ")";
>
> MODULE_DESCRIPTION("PF_CAN netlink gateway");
> MODULE_LICENSE("Dual BSD/GPL");
> @@ -913,7 +915,7 @@ static int cgw_remove_job(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
>
> static __init int cgw_module_init(void)
> {
> - printk(banner);
> + pr_info("%s\n", banner);
>
> cgw_cache = kmem_cache_create("can_gw", sizeof(struct cgw_job),
> 0, 0, NULL);
> diff --git a/net/can/proc.c b/net/can/proc.c
> index ba873c3..c3aedf5 100644
> --- a/net/can/proc.c
> +++ b/net/can/proc.c
> @@ -39,6 +39,8 @@
> *
> */
>
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
> #include <linux/module.h>
> #include <linux/proc_fs.h>
> #include <linux/list.h>
> @@ -118,8 +120,7 @@ static unsigned long calc_rate(unsigned long oldjif, unsigned long newjif,
>
> /* see can_stat_update() - this should NEVER happen! */
> if (count > (ULONG_MAX / HZ)) {
> - printk(KERN_ERR "can: calc_rate: count exceeded! %ld\n",
> - count);
> + pr_err("%s: count exceeded! %ld\n", __func__, count);
> return 99999999;
> }
>
> @@ -475,8 +476,7 @@ void can_init_proc(void)
> can_dir = proc_mkdir("can", init_net.proc_net);
>
> if (!can_dir) {
> - printk(KERN_INFO "can: failed to create /proc/net/can . "
> - "CONFIG_PROC_FS missing?\n");
> + pr_info("failed to create /proc/net/can . CONFIG_PROC_FS missing?\n");
> return;
> }
>
> diff --git a/net/can/raw.c b/net/can/raw.c
> index cde1b4a..2875c55 100644
> --- a/net/can/raw.c
> +++ b/net/can/raw.c
> @@ -39,6 +39,8 @@
> *
> */
>
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
> #include <linux/module.h>
> #include <linux/init.h>
> #include <linux/uio.h>
> @@ -56,7 +58,7 @@
>
> #define CAN_RAW_VERSION CAN_VERSION
> static __initdata const char banner[] =
> - KERN_INFO "can: raw protocol (rev " CAN_RAW_VERSION ")\n";
> + "raw protocol (rev " CAN_RAW_VERSION ")";
>
> MODULE_DESCRIPTION("PF_CAN raw protocol");
> MODULE_LICENSE("Dual BSD/GPL");
> @@ -783,11 +785,11 @@ static __init int raw_module_init(void)
> {
> int err;
>
> - printk(banner);
> + pr_info("%s\n", banner);
>
> err = can_proto_register(&raw_can_proto);
> if (err < 0)
> - printk(KERN_ERR "can: registration of raw protocol failed\n");
> + pr_err("registration of raw protocol failed\n");
>
> return err;
> }
--
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: 262 bytes --]
next prev parent reply other threads:[~2011-11-29 20:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-29 18:54 [PATCH] can: Update logging style Joe Perches
2011-11-29 20:06 ` Marc Kleine-Budde [this message]
2011-11-30 13:43 ` Oliver Hartkopp
2011-11-30 18:23 ` Joe Perches
2011-12-01 6:56 ` Oliver Hartkopp
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=4ED53B47.1030703@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=davem@davemloft.net \
--cc=joe@perches.com \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=socketcan@hartkopp.net \
--cc=urs.thuermann@volkswagen.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.