mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Jiri Kosina <jkosina@suse.cz>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH V2 6/8] pktcdvd: Convert pr_notice to pkt_notice
Date: Fri, 31 May 2013 21:11:27 -0700	[thread overview]
Message-ID: <57c43b1b2fdcec5bc95d22654bd4f34df6cc1faf.1370048648.git.joe@perches.com> (raw)
In-Reply-To: <cover.1370048648.git.joe@perches.com>

Add a new pkt_notice macro to prefix the name to the logging output.

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/block/pktcdvd.c | 32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 07ff878..3815f01 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -71,17 +71,19 @@
 
 #define DRIVER_NAME	"pktcdvd"
 
+#define pkt_err(pd, fmt, ...)						\
+	pr_err("%s: " fmt, pd->name, ##__VA_ARGS__)
+#define pkt_notice(pd, fmt, ...)					\
+	pr_notice("%s: " fmt, pd->name, ##__VA_ARGS__)
+
 #define pkt_dbg(level, pd, fmt, ...)					\
 do {									\
 	if (level == 2 && PACKET_DEBUG >= 2)				\
-		pr_notice("%s: %s():" fmt,				\
-			  pd->name, __func__, ##__VA_ARGS__);		\
+		pkt_notice(pd, "%s(): " fmt, __func__, ##__VA_ARGS__);	\
 	else if (level == 1 && PACKET_DEBUG >= 1)			\
-		pr_notice("%s: " fmt, pd->name, ##__VA_ARGS__);		\
+		pkt_notice(pd, fmt, ##__VA_ARGS__);			\
 } while (0)
 
-#define pkt_err(pd, fmt, ...)						\
-	pr_err("%s: " fmt, pd->name, ##__VA_ARGS__)
 
 #define MAX_SPEED 0xffff
 
@@ -1821,7 +1823,7 @@ static int pkt_writable_disc(struct pktcdvd_device *pd, disc_information *di)
 	 * but i'm not sure, should we leave this to user apps? probably.
 	 */
 	if (di->disc_type == 0xff) {
-		pr_notice("unknown disc - no track?\n");
+		pkt_notice(pd, "unknown disc - no track?\n");
 		return 0;
 	}
 
@@ -1831,7 +1833,7 @@ static int pkt_writable_disc(struct pktcdvd_device *pd, disc_information *di)
 	}
 
 	if (di->erasable == 0) {
-		pr_notice("disc not erasable\n");
+		pkt_notice(pd, "disc not erasable\n");
 		return 0;
 	}
 
@@ -1887,7 +1889,7 @@ static noinline_for_stack int pkt_probe_settings(struct pktcdvd_device *pd)
 	 */
 	pd->settings.size = be32_to_cpu(ti.fixed_packet_size) << 2;
 	if (pd->settings.size == 0) {
-		pr_notice("detected zero packet size!\n");
+		pkt_notice(pd, "detected zero packet size!\n");
 		return -ENXIO;
 	}
 	if (pd->settings.size > PACKET_MAX_SECTORS) {
@@ -1970,7 +1972,7 @@ static noinline_for_stack int pkt_write_caching(struct pktcdvd_device *pd,
 		pkt_err(pd, "write caching control failed\n");
 		pkt_dump_sense(&cgc);
 	} else if (!ret && set)
-		pr_notice("enabled write caching on %s\n", pd->name);
+		pkt_notice(pd, "enabled write caching\n");
 	return ret;
 }
 
@@ -2085,11 +2087,11 @@ static noinline_for_stack int pkt_media_speed(struct pktcdvd_device *pd,
 	}
 
 	if (!(buf[6] & 0x40)) {
-		pr_notice("disc type is not CD-RW\n");
+		pkt_notice(pd, "disc type is not CD-RW\n");
 		return 1;
 	}
 	if (!(buf[6] & 0x4)) {
-		pr_notice("A1 values on media are not valid, maybe not CDRW?\n");
+		pkt_notice(pd, "A1 values on media are not valid, maybe not CDRW?\n");
 		return 1;
 	}
 
@@ -2109,14 +2111,14 @@ static noinline_for_stack int pkt_media_speed(struct pktcdvd_device *pd,
 			*speed = us_clv_to_speed[sp];
 			break;
 		default:
-			pr_notice("unknown disc sub-type %d\n", st);
+			pkt_notice(pd, "unknown disc sub-type %d\n", st);
 			return 1;
 	}
 	if (*speed) {
 		pr_info("maximum media speed: %d\n", *speed);
 		return 0;
 	} else {
-		pr_notice("unknown speed %d for sub-type %d\n", sp, st);
+		pkt_notice(pd, "unknown speed %d for sub-type %d\n", sp, st);
 		return 1;
 	}
 }
@@ -2382,8 +2384,8 @@ static void pkt_make_request(struct request_queue *q, struct bio *bio)
 	}
 
 	if (!test_bit(PACKET_WRITABLE, &pd->flags)) {
-		pr_notice("WRITE for ro device %s (%llu)\n",
-			  pd->name, (unsigned long long)bio->bi_sector);
+		pkt_notice(pd, "WRITE for ro device (%llu)\n",
+			   (unsigned long long)bio->bi_sector);
 		goto end_io;
 	}
 
-- 
1.8.1.2.459.gbcd45b4.dirty


  parent reply	other threads:[~2013-06-01  4:12 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-16  8:11 [patch] pktcdvd: silence static checker warning Dan Carpenter
2013-05-29 13:37 ` Jiri Kosina
2013-05-30 20:57   ` [PATCH 0/3] pktcdvd: A few more neatenings Joe Perches
2013-05-30 20:57     ` [PATCH 1/3] pktcdvd: Convert ZONE macro to static function get_zone() Joe Perches
2013-05-30 20:57     ` [PATCH 2/3] pktcdvd: Convert printk to pr_<level> Joe Perches
2013-05-31 19:44       ` Andy Shevchenko
2013-05-31 21:56         ` Joe Perches
2013-05-30 20:57     ` [PATCH 3/3] pktcdvd: Consolidate DPRINTK and VPRINTK macros Joe Perches
2013-05-31  5:37     ` [PATCH 0/3] pktcdvd: A few more neatenings Joe Perches
2013-06-01  4:11       ` [PATCH V2 0/8] pktcdvd: More neatenings Joe Perches
2013-06-01  4:11         ` [PATCH V2 1/8] pktcdvd: Convert ZONE macro to static function get_zone() Joe Perches
2013-06-01  4:11         ` [PATCH V2 2/8] pktcdvd: Convert printk to pr_<level> Joe Perches
2013-06-03  9:57           ` Dan Carpenter
2013-06-03 10:42             ` Andy Shevchenko
2013-06-03 11:59             ` Joe Perches
2013-06-03 12:50               ` Dan Carpenter
2013-06-03 12:58                 ` Joe Perches
2013-06-03 16:45                 ` [PATCH V3 0/8] pktcdvd: More neatenings Joe Perches
2013-06-03 16:45                   ` [PATCH V3 1/8] pktcdvd: Convert ZONE macro to static function get_zone() Joe Perches
2013-06-03 16:45                   ` [PATCH V3 2/8] pktcdvd: Convert printk to pr_<level> Joe Perches
2013-06-03 16:45                   ` [PATCH V3 3/8] pktcdvd: Consolidate DPRINTK and VPRINTK macros Joe Perches
2013-06-03 16:45                   ` [PATCH V3 4/8] pktcdvd: Add struct pktcdvd_device * to pkt_dbg Joe Perches
2013-06-03 16:45                   ` [PATCH V3 5/8] pktcdvd: Add struct pktcdvd_device.name to pr_err logging where possible Joe Perches
2013-06-03 16:45                   ` [PATCH V3 6/8] pktcdvd: Convert pr_notice to pkt_notice Joe Perches
2013-06-03 16:45                   ` [PATCH V3 7/8] pktcdvd: Convert pr_info to pkt_info Joe Perches
2013-06-03 16:45                   ` [PATCH V3 8/8] pktcdvd: Add struct pktcdvd_device * to pkt_dump_sense() Joe Perches
2013-07-23  0:53                   ` [PATCH V3 0/8] pktcdvd: More neatenings Joe Perches
2013-07-30  9:18                     ` Jiri Kosina
2013-06-01  4:11         ` [PATCH V2 3/8] pktcdvd: Consolidate DPRINTK and VPRINTK macros Joe Perches
2013-06-01  4:11         ` [PATCH V2 4/8] pktcdvd: Add struct pktcdvd_device * to pkt_dbg Joe Perches
2013-06-01  4:11         ` [PATCH V2 5/8] pktcdvd: Add struct pktcdvd_device.name to pr_err logging where possible Joe Perches
2013-06-01  4:11         ` Joe Perches [this message]
2013-06-02 12:12           ` [PATCH V2 6/8] pktcdvd: Convert pr_notice to pkt_notice Andy Shevchenko
2013-06-02 12:22             ` Joe Perches
2013-06-01  4:11         ` [PATCH V2 7/8] pktcdvd: Convert pr_info to pkt_info Joe Perches
2013-06-01  4:11         ` [PATCH V2 8/8] pktcdvd: Add struct pktcdvd_device * to pkt_dump_sense() Joe Perches

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=57c43b1b2fdcec5bc95d22654bd4f34df6cc1faf.1370048648.git.joe@perches.com \
    --to=joe@perches.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=dan.carpenter@oracle.com \
    --cc=jkosina@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    /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®