aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kernel.h
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ellerman.id.au>2009-04-09 17:48:24 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-04-16 19:17:10 -0400
commit4ccb457966391295bd9b3644f6bdc9ddd97b6051 (patch)
tree9e69013dcb736c33be6ce6a8facaa606f7016fbf /include/linux/kernel.h
parent13977091a988fb0d21821c2221ddc920eba36b79 (diff)
dynamic debug: resurrect old pr_debug() semantics as pr_devel()
pr_debug() used to produce zero code unless DEBUG was #defined. This is now no longer the case in practice[1]. There are places where it's useful to have debugging printks, but we don't want them to generate any code in production kernels. So add a new macro, pr_devel(), for _devel_opment, to provide the old semantics, ie. if the programmer doesn't explicitly enable debugging, no code is produced. [1]: You can turn CONFIG_DYNAMIC_DEBUG off, but it's enabled in at least one distro kernel, so it's not really a solution. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Cc: Jason Baron <jbaron@redhat.com> Cc: Greg Banks <gnb@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r--include/linux/kernel.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index d9e75ec7def5..883cd44ff765 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -377,6 +377,15 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
377#define pr_cont(fmt, ...) \ 377#define pr_cont(fmt, ...) \
378 printk(KERN_CONT fmt, ##__VA_ARGS__) 378 printk(KERN_CONT fmt, ##__VA_ARGS__)
379 379
380/* pr_devel() should produce zero code unless DEBUG is defined */
381#ifdef DEBUG
382#define pr_devel(fmt, ...) \
383 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
384#else
385#define pr_devel(fmt, ...) \
386 ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; })
387#endif
388
380/* If you are writing a driver, please use dev_dbg instead */ 389/* If you are writing a driver, please use dev_dbg instead */
381#if defined(DEBUG) 390#if defined(DEBUG)
382#define pr_debug(fmt, ...) \ 391#define pr_debug(fmt, ...) \