diff mbox

[RFC] Add pr_dbg and pr_dbg_always (was: Re: [PATCH v2] net: arp: code cleanup)

Message ID 1283449109.1797.347.camel@Joe-Laptop
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

Joe Perches Sept. 2, 2010, 5:38 p.m. UTC
On Thu, 2010-09-02 at 10:27 +0200, Eric Dumazet wrote:
> Le jeudi 02 septembre 2010 à 16:18 +0800, Changli Gao a écrit :
> > Replace printk(KERN_DEBUG...) with pr_debug(...).
> pr_debug() is not an exact replacement of printk(KERN_DEBUG ...)
> With pr_debug(), you need to recompile this file with -DDEBUG or
> CONFIG_DYNAMIC_DEBUG if you want to catch the messages.

That's also the reason I think there should a new
not conditionally compiled away KERN_DEBUG level like

#define pr_somename(fmt, arg) printk(KERN_DEBUG pr_fmt(fmt), ##arg)

where pr_somename is something moderately short like:

pr_debug_always
pr_debug_force
pr_debug_info
pr_dbg_always

pr_dbg wouldn't be good because it uses a similar name to
dev_dbg but not be conditionally compiled away.

I lean to pr_dbg_always.
I think  pr_dbg should be added for symmetry.

Anyone have other suggestions?

Just leave it alone is one, but I think that because there's
a message logging level below KERN_INFO that people find useful,
there should be an unconditional pr_<level> call for it.

So add pr_dbg, pr_dbg_always and pr_dbg_ratelimited to kernel.h.
---
 include/linux/kernel.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 2b0a35e..398f8db 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -416,6 +416,8 @@  extern int hex_to_bin(char ch);
         printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
 #define pr_info(fmt, ...) \
         printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_dbg_always(fmt, ...) \
+        printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
 #define pr_cont(fmt, ...) \
 	printk(KERN_CONT fmt, ##__VA_ARGS__)
 
@@ -441,6 +443,8 @@  extern int hex_to_bin(char ch);
 	({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; })
 #endif
 
+#define pr_dbg pr_debug
+
 /*
  * ratelimited messages with local ratelimit_state,
  * no local ratelimit_state used in the !PRINTK case
@@ -474,6 +478,8 @@  extern int hex_to_bin(char ch);
 	printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
 #define pr_info_ratelimited(fmt, ...) \
 	printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_dbg_ratelimited(fmt, ...) \
+	printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
 /* no pr_cont_ratelimited, don't do that... */
 /* If you are writing a driver, please use dev_dbg instead */
 #if defined(DEBUG)