Skip to content

Commit

Permalink
dev_vdbg(), available with -DVERBOSE_DEBUG
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David Brownell authored and Greg Kroah-Hartman committed Jul 18, 2007
1 parent bc37e28 commit aebdc3b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
7 changes: 0 additions & 7 deletions drivers/usb/core/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 10 additions & 0 deletions include/linux/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -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...) \
Expand Down

0 comments on commit aebdc3b

Please sign in to comment.