aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/dynamic_debug.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/dynamic_debug.h')
-rw-r--r--include/linux/dynamic_debug.h24
1 files changed, 10 insertions, 14 deletions
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index a90b3892074a..0c9653f11c18 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -31,6 +31,10 @@ struct _ddebug {
31 * writes commands to <debugfs>/dynamic_debug/control 31 * writes commands to <debugfs>/dynamic_debug/control
32 */ 32 */
33#define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */ 33#define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */
34#define _DPRINTK_FLAGS_INCL_MODNAME (1<<1)
35#define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<2)
36#define _DPRINTK_FLAGS_INCL_LINENO (1<<3)
37#define _DPRINTK_FLAGS_INCL_TID (1<<4)
34#define _DPRINTK_FLAGS_DEFAULT 0 38#define _DPRINTK_FLAGS_DEFAULT 0
35 unsigned int flags:8; 39 unsigned int flags:8;
36 char enabled; 40 char enabled;
@@ -42,36 +46,28 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n,
42 46
43#if defined(CONFIG_DYNAMIC_DEBUG) 47#if defined(CONFIG_DYNAMIC_DEBUG)
44extern int ddebug_remove_module(const char *mod_name); 48extern int ddebug_remove_module(const char *mod_name);
49extern int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
50 __attribute__ ((format (printf, 2, 3)));
45 51
46#define dynamic_pr_debug(fmt, ...) do { \ 52#define dynamic_pr_debug(fmt, ...) do { \
47 __label__ do_printk; \
48 __label__ out; \
49 static struct _ddebug descriptor \ 53 static struct _ddebug descriptor \
50 __used \ 54 __used \
51 __attribute__((section("__verbose"), aligned(8))) = \ 55 __attribute__((section("__verbose"), aligned(8))) = \
52 { KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \ 56 { KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \
53 _DPRINTK_FLAGS_DEFAULT }; \ 57 _DPRINTK_FLAGS_DEFAULT }; \
54 JUMP_LABEL(&descriptor.enabled, do_printk); \ 58 if (unlikely(descriptor.enabled)) \
55 goto out; \ 59 __dynamic_pr_debug(&descriptor, pr_fmt(fmt), ##__VA_ARGS__); \
56do_printk: \
57 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \
58out: ; \
59 } while (0) 60 } while (0)
60 61
61 62
62#define dynamic_dev_dbg(dev, fmt, ...) do { \ 63#define dynamic_dev_dbg(dev, fmt, ...) do { \
63 __label__ do_printk; \
64 __label__ out; \
65 static struct _ddebug descriptor \ 64 static struct _ddebug descriptor \
66 __used \ 65 __used \
67 __attribute__((section("__verbose"), aligned(8))) = \ 66 __attribute__((section("__verbose"), aligned(8))) = \
68 { KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \ 67 { KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \
69 _DPRINTK_FLAGS_DEFAULT }; \ 68 _DPRINTK_FLAGS_DEFAULT }; \
70 JUMP_LABEL(&descriptor.enabled, do_printk); \ 69 if (unlikely(descriptor.enabled)) \
71 goto out; \ 70 dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \
72do_printk: \
73 dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \
74out: ; \
75 } while (0) 71 } while (0)
76 72
77#else 73#else