Commit b558c96f authored by Jim Cromie's avatar Jim Cromie Committed by Greg Kroah-Hartman

dynamic_debug: make dynamic-debug supersede DEBUG ccflag

If CONFIG_DYNAMIC_DEBUG is defined, honor it over DEBUG, so that
pr_debug()s are controllable, instead of always-on.  When DEBUG is
also defined, change _DPRINTK_FLAGS_DEFAULT to enable printing by
default.

Also adding _DPRINTK_FLAGS_INCL_MODNAME would be nice, but there are
numerous cases of pr_debug(NAME ": ...), which would result in double
printing of module-name.  So defer this until things settle.

Cc: David Miller <davem@davemloft.net>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: default avatarJim Cromie <jim.cromie@gmail.com>
Signed-off-by: default avatarJason Baron <jbaron@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 87e6f968
...@@ -945,14 +945,14 @@ int _dev_info(const struct device *dev, const char *fmt, ...) ...@@ -945,14 +945,14 @@ int _dev_info(const struct device *dev, const char *fmt, ...)
#define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg) #define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg)
#if defined(DEBUG) #if defined(CONFIG_DYNAMIC_DEBUG)
#define dev_dbg(dev, format, arg...) \
dev_printk(KERN_DEBUG, dev, format, ##arg)
#elif defined(CONFIG_DYNAMIC_DEBUG)
#define dev_dbg(dev, format, ...) \ #define dev_dbg(dev, format, ...) \
do { \ do { \
dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \ dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \
} while (0) } while (0)
#elif defined(DEBUG)
#define dev_dbg(dev, format, arg...) \
dev_printk(KERN_DEBUG, dev, format, ##arg)
#else #else
#define dev_dbg(dev, format, arg...) \ #define dev_dbg(dev, format, arg...) \
({ \ ({ \
......
...@@ -26,7 +26,11 @@ struct _ddebug { ...@@ -26,7 +26,11 @@ struct _ddebug {
#define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<2) #define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<2)
#define _DPRINTK_FLAGS_INCL_LINENO (1<<3) #define _DPRINTK_FLAGS_INCL_LINENO (1<<3)
#define _DPRINTK_FLAGS_INCL_TID (1<<4) #define _DPRINTK_FLAGS_INCL_TID (1<<4)
#if defined DEBUG
#define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINT
#else
#define _DPRINTK_FLAGS_DEFAULT 0 #define _DPRINTK_FLAGS_DEFAULT 0
#endif
unsigned int flags:8; unsigned int flags:8;
} __attribute__((aligned(8))); } __attribute__((aligned(8)));
......
...@@ -2687,14 +2687,14 @@ int netdev_info(const struct net_device *dev, const char *format, ...); ...@@ -2687,14 +2687,14 @@ int netdev_info(const struct net_device *dev, const char *format, ...);
#define MODULE_ALIAS_NETDEV(device) \ #define MODULE_ALIAS_NETDEV(device) \
MODULE_ALIAS("netdev-" device) MODULE_ALIAS("netdev-" device)
#if defined(DEBUG) #if defined(CONFIG_DYNAMIC_DEBUG)
#define netdev_dbg(__dev, format, args...) \
netdev_printk(KERN_DEBUG, __dev, format, ##args)
#elif defined(CONFIG_DYNAMIC_DEBUG)
#define netdev_dbg(__dev, format, args...) \ #define netdev_dbg(__dev, format, args...) \
do { \ do { \
dynamic_netdev_dbg(__dev, format, ##args); \ dynamic_netdev_dbg(__dev, format, ##args); \
} while (0) } while (0)
#elif defined(DEBUG)
#define netdev_dbg(__dev, format, args...) \
netdev_printk(KERN_DEBUG, __dev, format, ##args)
#else #else
#define netdev_dbg(__dev, format, args...) \ #define netdev_dbg(__dev, format, args...) \
({ \ ({ \
......
...@@ -180,13 +180,13 @@ extern void dump_stack(void) __cold; ...@@ -180,13 +180,13 @@ extern void dump_stack(void) __cold;
#endif #endif
/* If you are writing a driver, please use dev_dbg instead */ /* If you are writing a driver, please use dev_dbg instead */
#if defined(DEBUG) #if defined(CONFIG_DYNAMIC_DEBUG)
#define pr_debug(fmt, ...) \
printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
#elif defined(CONFIG_DYNAMIC_DEBUG)
/* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */ /* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */
#define pr_debug(fmt, ...) \ #define pr_debug(fmt, ...) \
dynamic_pr_debug(fmt, ##__VA_ARGS__) dynamic_pr_debug(fmt, ##__VA_ARGS__)
#elif defined(DEBUG)
#define pr_debug(fmt, ...) \
printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
#else #else
#define pr_debug(fmt, ...) \ #define pr_debug(fmt, ...) \
no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment