aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/dynamic_debug.h
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /include/linux/dynamic_debug.h
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'include/linux/dynamic_debug.h')
-rw-r--r--include/linux/dynamic_debug.h33
1 files changed, 15 insertions, 18 deletions
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index 52c0da4bdd18..e747ecd48e1c 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -22,8 +22,6 @@ struct _ddebug {
22 const char *function; 22 const char *function;
23 const char *filename; 23 const char *filename;
24 const char *format; 24 const char *format;
25 char primary_hash;
26 char secondary_hash;
27 unsigned int lineno:24; 25 unsigned int lineno:24;
28 /* 26 /*
29 * The flags field controls the behaviour at the callsite. 27 * The flags field controls the behaviour at the callsite.
@@ -31,8 +29,13 @@ struct _ddebug {
31 * writes commands to <debugfs>/dynamic_debug/control 29 * writes commands to <debugfs>/dynamic_debug/control
32 */ 30 */
33#define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */ 31#define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */
32#define _DPRINTK_FLAGS_INCL_MODNAME (1<<1)
33#define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<2)
34#define _DPRINTK_FLAGS_INCL_LINENO (1<<3)
35#define _DPRINTK_FLAGS_INCL_TID (1<<4)
34#define _DPRINTK_FLAGS_DEFAULT 0 36#define _DPRINTK_FLAGS_DEFAULT 0
35 unsigned int flags:8; 37 unsigned int flags:8;
38 char enabled;
36} __attribute__((aligned(8))); 39} __attribute__((aligned(8)));
37 40
38 41
@@ -41,23 +44,17 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n,
41 44
42#if defined(CONFIG_DYNAMIC_DEBUG) 45#if defined(CONFIG_DYNAMIC_DEBUG)
43extern int ddebug_remove_module(const char *mod_name); 46extern int ddebug_remove_module(const char *mod_name);
44 47extern int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
45#define __dynamic_dbg_enabled(dd) ({ \ 48 __attribute__ ((format (printf, 2, 3)));
46 int __ret = 0; \
47 if (unlikely((dynamic_debug_enabled & (1LL << DEBUG_HASH)) && \
48 (dynamic_debug_enabled2 & (1LL << DEBUG_HASH2)))) \
49 if (unlikely(dd.flags)) \
50 __ret = 1; \
51 __ret; })
52 49
53#define dynamic_pr_debug(fmt, ...) do { \ 50#define dynamic_pr_debug(fmt, ...) do { \
54 static struct _ddebug descriptor \ 51 static struct _ddebug descriptor \
55 __used \ 52 __used \
56 __attribute__((section("__verbose"), aligned(8))) = \ 53 __attribute__((section("__verbose"), aligned(8))) = \
57 { KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \ 54 { KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \
58 DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \ 55 _DPRINTK_FLAGS_DEFAULT }; \
59 if (__dynamic_dbg_enabled(descriptor)) \ 56 if (unlikely(descriptor.enabled)) \
60 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \ 57 __dynamic_pr_debug(&descriptor, pr_fmt(fmt), ##__VA_ARGS__); \
61 } while (0) 58 } while (0)
62 59
63 60
@@ -65,9 +62,9 @@ extern int ddebug_remove_module(const char *mod_name);
65 static struct _ddebug descriptor \ 62 static struct _ddebug descriptor \
66 __used \ 63 __used \
67 __attribute__((section("__verbose"), aligned(8))) = \ 64 __attribute__((section("__verbose"), aligned(8))) = \
68 { KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \ 65 { KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \
69 DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \ 66 _DPRINTK_FLAGS_DEFAULT }; \
70 if (__dynamic_dbg_enabled(descriptor)) \ 67 if (unlikely(descriptor.enabled)) \
71 dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \ 68 dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \
72 } while (0) 69 } while (0)
73 70
@@ -80,7 +77,7 @@ static inline int ddebug_remove_module(const char *mod)
80 77
81#define dynamic_pr_debug(fmt, ...) \ 78#define dynamic_pr_debug(fmt, ...) \
82 do { if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); } while (0) 79 do { if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); } while (0)
83#define dynamic_dev_dbg(dev, format, ...) \ 80#define dynamic_dev_dbg(dev, fmt, ...) \
84 do { if (0) dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); } while (0) 81 do { if (0) dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); } while (0)
85#endif 82#endif
86 83