Skip to content

Commit aebdc3b

Browse files
David Brownellgregkh
authored andcommitted
dev_vdbg(), available with -DVERBOSE_DEBUG
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>
1 parent bc37e28 commit aebdc3b

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

‎drivers/usb/core/driver.c‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,6 @@
2929
#include "hcd.h"
3030
#include "usb.h"
3131

32-
#define VERBOSE_DEBUG 0
33-
34-
#if VERBOSE_DEBUG
35-
#define dev_vdbg dev_dbg
36-
#else
37-
#define dev_vdbg(dev, fmt, args...) do { } while (0)
38-
#endif
3932

4033
#ifdef CONFIG_HOTPLUG
4134

‎include/linux/device.h‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,16 @@ dev_dbg(struct device * dev, const char * fmt, ...)
572572
}
573573
#endif
574574

575+
#ifdef VERBOSE_DEBUG
576+
#define dev_vdbg dev_dbg
577+
#else
578+
static inline int __attribute__ ((format (printf, 2, 3)))
579+
dev_vdbg(struct device * dev, const char * fmt, ...)
580+
{
581+
return 0;
582+
}
583+
#endif
584+
575585
#define dev_err(dev, format, arg...) \
576586
dev_printk(KERN_ERR , dev , format , ## arg)
577587
#define dev_info(dev, format, arg...) \

0 commit comments

Comments
 (0)