mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@suse.de>
To: linux-kernel@vger.kernel.org
Cc: Michael Ellerman <michael@ellerman.id.au>,
	Jason Baron <jbaron@redhat.com>, Greg Banks <gnb@sgi.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Greg Kroah-Hartman <gregkh@suse.de>
Subject: [PATCH 07/10] dynamic debug: resurrect old pr_debug() semantics as pr_devel()
Date: Fri, 17 Apr 2009 12:04:31 -0700	[thread overview]
Message-ID: <1239995074-4065-7-git-send-email-gregkh@suse.de> (raw)
In-Reply-To: <20090417190144.GB3548@kroah.com>

From: Michael Ellerman <michael@ellerman.id.au>

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>
---
 include/linux/kernel.h |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index d9e75ec..883cd44 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)
 #define pr_cont(fmt, ...) \
 	printk(KERN_CONT fmt, ##__VA_ARGS__)
 
+/* pr_devel() should produce zero code unless DEBUG is defined */
+#ifdef DEBUG
+#define pr_devel(fmt, ...) \
+	printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
+#else
+#define pr_devel(fmt, ...) \
+	({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; })
+#endif
+
 /* If you are writing a driver, please use dev_dbg instead */
 #if defined(DEBUG)
 #define pr_debug(fmt, ...) \
-- 
1.6.2


  parent reply	other threads:[~2009-04-17 19:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-17 19:01 [GIT PATCH] driver core patches for 2.6.31-rc2 Greg KH
2009-04-17 19:04 ` [PATCH 01/10] sysfs: don't use global workqueue in sysfs_schedule_callback() Greg Kroah-Hartman
2009-04-22 20:14   ` Andrew Morton
2009-04-28  5:15     ` Alex Chiang
2009-04-17 19:04 ` [PATCH 02/10] driver core: fix driver_match_device Greg Kroah-Hartman
2009-04-17 19:04 ` [PATCH 03/10] driver core: allow non-root users to listen to uevents Greg Kroah-Hartman
2009-04-17 19:04 ` [PATCH 04/10] sysfs: sysfs poll keep the poll rule of regular file Greg Kroah-Hartman
2009-04-17 19:04 ` [PATCH 05/10] proc: mounts_poll() make consistent to mdstat_poll Greg Kroah-Hartman
2009-04-17 19:04 ` [PATCH 06/10] Driver Core: early platform driver Greg Kroah-Hartman
2009-04-17 19:04 ` Greg Kroah-Hartman [this message]
2009-04-17 19:04 ` [PATCH 08/10] driver core: prevent device_for_each_child from oopsing Greg Kroah-Hartman
2009-04-17 19:04 ` [PATCH 09/10] Driver core: remove pr_fmt() from dynamic_dev_dbg() printk Greg Kroah-Hartman
2009-04-17 19:04 ` [PATCH 10/10] UIO: fix specific device driver missing statement for depmod Greg Kroah-Hartman
2009-04-18  3:57 ` [GIT PATCH] driver core patches for 2.6.31-rc2 KOSAKI Motohiro
2009-04-18 16:50   ` Greg KH

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=1239995074-4065-7-git-send-email-gregkh@suse.de \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=gnb@sgi.com \
    --cc=jbaron@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael@ellerman.id.au \
    /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

Powered by JetHome