[PATCH 1/1] block: aoe: Standardize logging with pr_<level> macros and DEVICE_NAME prefix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Convert printks to pr_<level> and use the pr_fmt()
macro to prefix all the output with DEVICE_NAME.

No functional changes.

Signed-off-by: Longlong Xia <xialonglong@xxxxxxxxxx>
---
 drivers/block/aoe/aoe.h     | 3 +++
 drivers/block/aoe/aoeblk.c  | 4 ++--
 drivers/block/aoe/aoechr.c  | 7 +++----
 drivers/block/aoe/aoecmd.c  | 9 ++++-----
 drivers/block/aoe/aoedev.c  | 3 +--
 drivers/block/aoe/aoemain.c | 6 +++---
 drivers/block/aoe/aoenet.c  | 7 +++----
 7 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/drivers/block/aoe/aoe.h b/drivers/block/aoe/aoe.h
index 749ae1246f4c..13b7d388929b 100644
--- a/drivers/block/aoe/aoe.h
+++ b/drivers/block/aoe/aoe.h
@@ -5,6 +5,9 @@
 #define AOE_MAJOR 152
 #define DEVICE_NAME "aoe"
 
+#undef pr_fmt
+#define pr_fmt(fmt) DEVICE_NAME ": " fmt
+
 /* set AOE_PARTITIONS to 1 to use whole-disks only
  * default is 16, which is 15 partitions plus the whole disk
  */
diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
index b6dac8cee70f..6a9fc9578a6d 100644
--- a/drivers/block/aoe/aoeblk.c
+++ b/drivers/block/aoe/aoeblk.c
@@ -274,7 +274,7 @@ aoeblk_getgeo(struct block_device *bdev, struct hd_geometry *geo)
 	struct aoedev *d = bdev->bd_disk->private_data;
 
 	if ((d->flags & DEVFL_UP) == 0) {
-		printk(KERN_ERR "aoe: disk not up\n");
+		pr_err("disk not up\n");
 		return -ENODEV;
 	}
 
@@ -356,7 +356,7 @@ aoeblk_gdalloc(void *vp)
 	mp = mempool_create(MIN_BUFS, mempool_alloc_slab, mempool_free_slab,
 		buf_pool_cache);
 	if (mp == NULL) {
-		printk(KERN_ERR "aoe: cannot allocate bufpool for %ld.%d\n",
+		pr_err("cannot allocate bufpool for %ld.%d\n",
 			d->aoemajor, d->aoeminor);
 		goto err;
 	}
diff --git a/drivers/block/aoe/aoechr.c b/drivers/block/aoe/aoechr.c
index a42c4bcc85ba..49e579047c99 100644
--- a/drivers/block/aoe/aoechr.c
+++ b/drivers/block/aoe/aoechr.c
@@ -79,8 +79,7 @@ static int
 interfaces(const char __user *str, size_t size)
 {
 	if (set_aoe_iflist(str, size)) {
-		printk(KERN_ERR
-			"aoe: could not set interface list: too many interfaces\n");
+		pr_err("could not set interface list: too many interfaces\n");
 		return -EINVAL;
 	}
 	return 0;
@@ -173,7 +172,7 @@ aoechr_write(struct file *filp, const char __user *buf, size_t cnt, loff_t *offp
 
 	switch ((unsigned long) filp->private_data) {
 	default:
-		printk(KERN_INFO "aoe: can't write to that file.\n");
+		pr_info("can't write to that file.\n");
 		break;
 	case MINOR_DISCOVER:
 		ret = discover();
@@ -290,7 +289,7 @@ aoechr_init(void)
 
 	n = register_chrdev(AOE_MAJOR, "aoechr", &aoe_fops);
 	if (n < 0) {
-		printk(KERN_ERR "aoe: can't register char device\n");
+		pr_err("can't register char device\n");
 		return n;
 	}
 	init_completion(&emsgs_comp);
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index cc9077b588d7..290b92467406 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -255,7 +255,7 @@ newframe(struct aoedev *d)
 	int has_untainted;
 
 	if (!d->targets || !d->targets[0]) {
-		printk(KERN_ERR "aoe: NULL TARGETS!\n");
+		pr_err("NULL TARGETS!\n");
 		return NULL;
 	}
 	tt = d->tgt;	/* last used target */
@@ -426,7 +426,7 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoeminor, struct sk_buff_head *qu
 
 		skb = new_skb(sizeof *h + sizeof *ch);
 		if (skb == NULL) {
-			printk(KERN_INFO "aoe: skb alloc failure\n");
+			pr_info("skb alloc failure\n");
 			dev_put(ifp);
 			continue;
 		}
@@ -955,8 +955,7 @@ ataid_complete(struct aoedev *d, struct aoetgt *t, unsigned char *id)
 	memcpy(d->ident, id, sizeof(d->ident));
 
 	if (d->ssize != ssize)
-		printk(KERN_INFO
-			"aoe: %pm e%ld.%d v%04x has %llu sectors\n",
+		pr_info("%pm e%ld.%d v%04x has %llu sectors\n",
 			t->addr,
 			d->aoemajor, d->aoeminor,
 			d->fw_ver, (long long)ssize);
@@ -1533,7 +1532,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
 	 */
 	aoemajor = get_unaligned_be16(&h->major);
 	if (aoemajor == 0xfff) {
-		printk(KERN_ERR "aoe: Warning: shelf address is all ones.  "
+		pr_err("Warning: shelf address is all ones.  "
 			"Check shelf dip switches.\n");
 		return;
 	}
diff --git a/drivers/block/aoe/aoedev.c b/drivers/block/aoe/aoedev.c
index 3523dd82d7a0..9782c6e31448 100644
--- a/drivers/block/aoe/aoedev.c
+++ b/drivers/block/aoe/aoedev.c
@@ -411,8 +411,7 @@ skbfree(struct sk_buff *skb)
 	while (atomic_read(&skb_shinfo(skb)->dataref) != 1 && i-- > 0)
 		msleep(Sms);
 	if (i < 0) {
-		printk(KERN_ERR
-			"aoe: %s holds ref: %s\n",
+		pr_err("%s holds ref: %s\n",
 			skb->dev ? skb->dev->name : "netif",
 			"cannot free skb -- memory leaked.");
 		return;
diff --git a/drivers/block/aoe/aoemain.c b/drivers/block/aoe/aoemain.c
index 6238c4c87cfc..a37ed6806e37 100644
--- a/drivers/block/aoe/aoemain.c
+++ b/drivers/block/aoe/aoemain.c
@@ -65,10 +65,10 @@ aoe_init(void)
 		goto cmd_fail;
 	ret = register_blkdev(AOE_MAJOR, DEVICE_NAME);
 	if (ret < 0) {
-		printk(KERN_ERR "aoe: can't register major\n");
+		pr_err("can't register major\n");
 		goto blkreg_fail;
 	}
-	printk(KERN_INFO "aoe: AoE v%s initialised.\n", VERSION);
+	pr_info("AoE v%s initialised.\n", VERSION);
 
 	timer_setup(&timer, discover_timer, 0);
 	discover_timer(&timer);
@@ -86,7 +86,7 @@ aoe_init(void)
  dev_fail:
 	destroy_workqueue(aoe_wq);
 
-	printk(KERN_INFO "aoe: initialisation failure.\n");
+	pr_info("initialisation failure.\n");
 	return ret;
 }
 
diff --git a/drivers/block/aoe/aoenet.c b/drivers/block/aoe/aoenet.c
index 923a134fd766..7c8311e7cfb0 100644
--- a/drivers/block/aoe/aoenet.c
+++ b/drivers/block/aoe/aoenet.c
@@ -102,7 +102,7 @@ set_aoe_iflist(const char __user *user_str, size_t size)
 		return -EINVAL;
 
 	if (copy_from_user(aoe_iflist, user_str, size)) {
-		printk(KERN_INFO "aoe: copy from user failed\n");
+		pr_info("copy from user failed\n");
 		return -EFAULT;
 	}
 	aoe_iflist[size] = 0x00;
@@ -160,9 +160,8 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt,
 		if (n > NECODES)
 			n = 0;
 		if (net_ratelimit())
-			printk(KERN_ERR
-				"%s%d.%d@%s; ecode=%d '%s'\n",
-				"aoe: error packet from ",
+			pr_err("%s%d.%d@%s; ecode=%d '%s'\n",
+				"error packet from ",
 				get_unaligned_be16(&h->major),
 				h->minor, skb->dev->name,
 				h->err, aoe_errlist[n]);
-- 
2.45.1





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux