All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@suse.de>
To: linux-kernel@vger.kernel.org
Cc: David Brownell <david-b@pacbell.net>,
	David Brownell <dbrownell@users.sourceforge.net>,
	Andrew Morton <akpm@linux-foundation.org>,
	Greg Kroah-Hartman <gregkh@suse.de>
Subject: [PATCH 09/14] dev_vdbg(), available with -DVERBOSE_DEBUG
Date: Wed, 18 Jul 2007 16:25:45 -0700	[thread overview]
Message-ID: <11848011842017-git-send-email-gregkh@suse.de> (raw)
In-Reply-To: <11848011802979-git-send-email-gregkh@suse.de>

From: David Brownell <david-b@pacbell.net>

This defines a dev_vdbg() call, which is enabled with -DVERBOSE_DEBUG.
When enabled, dev_vdbg() acts just like dev_dbg().  When disabled, it is a
NOP ...  just like dev_dbg() without -DDEBUG.  The specific code was moved
out of a USB patch, but lots of drivers have similar support.

That is, code can now be written to use an additional level of debug
output, selected at compile time.  Many driver authors have found this
idiom to be very useful.  A typical usage model is for "normal" debug
messages to focus on fault paths and not be very "chatty", so that those
messages can be left on during normal operation without much of a
performance or syslog load.  On the other hand "verbose" messages would be
noisy enough that they wouldn't normally be enabled; they might even affect
timings enough to change system or driver behavior.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/usb/core/driver.c |    7 -------
 include/linux/device.h    |   10 ++++++++++
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 73c4936..6548574 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -29,13 +29,6 @@
 #include "hcd.h"
 #include "usb.h"
 
-#define VERBOSE_DEBUG	0
-
-#if VERBOSE_DEBUG
-#define dev_vdbg	dev_dbg
-#else
-#define dev_vdbg(dev, fmt, args...)	do { } while (0)
-#endif
 
 #ifdef CONFIG_HOTPLUG
 
diff --git a/include/linux/device.h b/include/linux/device.h
index be2debe..d9f0a57 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -572,6 +572,16 @@ dev_dbg(struct device * dev, const char * fmt, ...)
 }
 #endif
 
+#ifdef VERBOSE_DEBUG
+#define dev_vdbg	dev_dbg
+#else
+static inline int __attribute__ ((format (printf, 2, 3)))
+dev_vdbg(struct device * dev, const char * fmt, ...)
+{
+	return 0;
+}
+#endif
+
 #define dev_err(dev, format, arg...)		\
 	dev_printk(KERN_ERR , dev , format , ## arg)
 #define dev_info(dev, format, arg...)		\
-- 
1.5.2.2


  reply	other threads:[~2007-07-18 23:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-18 23:24 [GIT PATCH] more sysfs and driver core patches for 2.6.22 Greg KH
2007-07-18 23:25 ` [PATCH 01/14] debugfs: remove rmdir() non-empty complaint Greg Kroah-Hartman
2007-07-18 23:25   ` [PATCH 02/14] Driver core: accept all valid action-strings in uevent-trigger Greg Kroah-Hartman
2007-07-18 23:25     ` [PATCH 03/14] PM: Remove deprecated sysfs files Greg Kroah-Hartman
2007-07-18 23:25       ` [PATCH 04/14] PM: remove deprecated dpm_runtime_* routines Greg Kroah-Hartman
2007-07-18 23:25         ` [PATCH 05/14] sysfs: avoid kmem_cache_free(NULL) Greg Kroah-Hartman
2007-07-18 23:25           ` [PATCH 06/14] Documentation fix devres.txt: lib/iomap.c -> lib/devres.c Greg Kroah-Hartman
2007-07-18 23:25             ` [PATCH 07/14] sysfs: fix sysfs root inode nlink accounting Greg Kroah-Hartman
2007-07-18 23:25               ` [PATCH 08/14] sysfs: make sysfs_init_inode() static Greg Kroah-Hartman
2007-07-18 23:25                 ` Greg Kroah-Hartman [this message]
2007-07-18 23:25                   ` [PATCH 10/14] dev_vdbg() documentation Greg Kroah-Hartman
2007-07-18 23:25                     ` [PATCH 11/14] HOWTO: Add the knwon_regression URI to the documentation Greg Kroah-Hartman
2007-07-18 23:25                       ` [PATCH 12/14] Driver core: check return code of sysfs_create_link() Greg Kroah-Hartman
2007-07-18 23:25                         ` [PATCH 13/14] sysfs: kill an extra put in sysfs_create_link() failure path Greg Kroah-Hartman
2007-07-18 23:25                           ` [PATCH 14/14] sysfs: cosmetic clean up on node creation failure paths Greg Kroah-Hartman

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=11848011842017-git-send-email-gregkh@suse.de \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=david-b@pacbell.net \
    --cc=dbrownell@users.sourceforge.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.