diff options
author | Jim Cromie <jim.cromie@gmail.com> | 2011-12-19 17:11:13 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2012-01-24 15:46:44 -0500 |
commit | 87e6f968339bcdda56b39572c7e63331192296a0 (patch) | |
tree | f6e6b4afd8fa9d94540d844927e41f3c01a79f7d | |
parent | 07100be7e0495ff39237d48886bca7396c873db7 (diff) |
dynamic_debug: drop enabled field from struct _ddebug, use _DPRINTK_FLAGS_PRINT
Currently any enabled dynamic-debug flag on a pr_debug callsite will
enable printing, even if _DPRINTK_FLAGS_PRINT is off. Checking print
flag directly allows "-p" to disable callsites without fussing with
other flags, so the following disables everything, without altering
flags user may have set:
echo -p > $DBGFS/dynamic_debug/control
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | include/linux/dynamic_debug.h | 10 | ||||
-rw-r--r-- | lib/dynamic_debug.c | 4 |
2 files changed, 4 insertions, 10 deletions
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 0564e3c39882..f71a6b046245 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h | |||
@@ -28,7 +28,6 @@ struct _ddebug { | |||
28 | #define _DPRINTK_FLAGS_INCL_TID (1<<4) | 28 | #define _DPRINTK_FLAGS_INCL_TID (1<<4) |
29 | #define _DPRINTK_FLAGS_DEFAULT 0 | 29 | #define _DPRINTK_FLAGS_DEFAULT 0 |
30 | unsigned int flags:8; | 30 | unsigned int flags:8; |
31 | char enabled; | ||
32 | } __attribute__((aligned(8))); | 31 | } __attribute__((aligned(8))); |
33 | 32 | ||
34 | 33 | ||
@@ -62,21 +61,20 @@ int __dynamic_netdev_dbg(struct _ddebug *descriptor, | |||
62 | .format = (fmt), \ | 61 | .format = (fmt), \ |
63 | .lineno = __LINE__, \ | 62 | .lineno = __LINE__, \ |
64 | .flags = _DPRINTK_FLAGS_DEFAULT, \ | 63 | .flags = _DPRINTK_FLAGS_DEFAULT, \ |
65 | .enabled = false, \ | ||
66 | } | 64 | } |
67 | 65 | ||
68 | #define dynamic_pr_debug(fmt, ...) \ | 66 | #define dynamic_pr_debug(fmt, ...) \ |
69 | do { \ | 67 | do { \ |
70 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ | 68 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ |
71 | if (unlikely(descriptor.enabled)) \ | 69 | if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \ |
72 | __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \ | 70 | __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \ |
73 | ##__VA_ARGS__); \ | 71 | ##__VA_ARGS__); \ |
74 | } while (0) | 72 | } while (0) |
75 | 73 | ||
76 | #define dynamic_dev_dbg(dev, fmt, ...) \ | 74 | #define dynamic_dev_dbg(dev, fmt, ...) \ |
77 | do { \ | 75 | do { \ |
78 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ | 76 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ |
79 | if (unlikely(descriptor.enabled)) \ | 77 | if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \ |
80 | __dynamic_dev_dbg(&descriptor, dev, fmt, \ | 78 | __dynamic_dev_dbg(&descriptor, dev, fmt, \ |
81 | ##__VA_ARGS__); \ | 79 | ##__VA_ARGS__); \ |
82 | } while (0) | 80 | } while (0) |
@@ -84,7 +82,7 @@ do { \ | |||
84 | #define dynamic_netdev_dbg(dev, fmt, ...) \ | 82 | #define dynamic_netdev_dbg(dev, fmt, ...) \ |
85 | do { \ | 83 | do { \ |
86 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ | 84 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ |
87 | if (unlikely(descriptor.enabled)) \ | 85 | if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \ |
88 | __dynamic_netdev_dbg(&descriptor, dev, fmt, \ | 86 | __dynamic_netdev_dbg(&descriptor, dev, fmt, \ |
89 | ##__VA_ARGS__); \ | 87 | ##__VA_ARGS__); \ |
90 | } while (0) | 88 | } while (0) |
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index e487d1379298..416c0794ddd3 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c | |||
@@ -151,10 +151,6 @@ static void ddebug_change(const struct ddebug_query *query, | |||
151 | if (newflags == dp->flags) | 151 | if (newflags == dp->flags) |
152 | continue; | 152 | continue; |
153 | dp->flags = newflags; | 153 | dp->flags = newflags; |
154 | if (newflags) | ||
155 | dp->enabled = 1; | ||
156 | else | ||
157 | dp->enabled = 0; | ||
158 | if (verbose) | 154 | if (verbose) |
159 | pr_info("changed %s:%d [%s]%s %s\n", | 155 | pr_info("changed %s:%d [%s]%s %s\n", |
160 | dp->filename, dp->lineno, | 156 | dp->filename, dp->lineno, |