diff options
-rw-r--r-- | include/linux/dynamic_debug.h | 18 | ||||
-rw-r--r-- | lib/dynamic_debug.c | 9 |
2 files changed, 8 insertions, 19 deletions
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index a90b3892074a..1c70028f81f9 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h | |||
@@ -44,34 +44,24 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n, | |||
44 | extern int ddebug_remove_module(const char *mod_name); | 44 | extern int ddebug_remove_module(const char *mod_name); |
45 | 45 | ||
46 | #define dynamic_pr_debug(fmt, ...) do { \ | 46 | #define dynamic_pr_debug(fmt, ...) do { \ |
47 | __label__ do_printk; \ | ||
48 | __label__ out; \ | ||
49 | static struct _ddebug descriptor \ | 47 | static struct _ddebug descriptor \ |
50 | __used \ | 48 | __used \ |
51 | __attribute__((section("__verbose"), aligned(8))) = \ | 49 | __attribute__((section("__verbose"), aligned(8))) = \ |
52 | { KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \ | 50 | { KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \ |
53 | _DPRINTK_FLAGS_DEFAULT }; \ | 51 | _DPRINTK_FLAGS_DEFAULT }; \ |
54 | JUMP_LABEL(&descriptor.enabled, do_printk); \ | 52 | if (unlikely(descriptor.enabled)) \ |
55 | goto out; \ | 53 | printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \ |
56 | do_printk: \ | ||
57 | printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \ | ||
58 | out: ; \ | ||
59 | } while (0) | 54 | } while (0) |
60 | 55 | ||
61 | 56 | ||
62 | #define dynamic_dev_dbg(dev, fmt, ...) do { \ | 57 | #define dynamic_dev_dbg(dev, fmt, ...) do { \ |
63 | __label__ do_printk; \ | ||
64 | __label__ out; \ | ||
65 | static struct _ddebug descriptor \ | 58 | static struct _ddebug descriptor \ |
66 | __used \ | 59 | __used \ |
67 | __attribute__((section("__verbose"), aligned(8))) = \ | 60 | __attribute__((section("__verbose"), aligned(8))) = \ |
68 | { KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \ | 61 | { KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \ |
69 | _DPRINTK_FLAGS_DEFAULT }; \ | 62 | _DPRINTK_FLAGS_DEFAULT }; \ |
70 | JUMP_LABEL(&descriptor.enabled, do_printk); \ | 63 | if (unlikely(descriptor.enabled)) \ |
71 | goto out; \ | 64 | dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \ |
72 | do_printk: \ | ||
73 | dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \ | ||
74 | out: ; \ | ||
75 | } while (0) | 65 | } while (0) |
76 | 66 | ||
77 | #else | 67 | #else |
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 3094318bfea7..b335acb43be2 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c | |||
@@ -141,11 +141,10 @@ static void ddebug_change(const struct ddebug_query *query, | |||
141 | else if (!dp->flags) | 141 | else if (!dp->flags) |
142 | dt->num_enabled++; | 142 | dt->num_enabled++; |
143 | dp->flags = newflags; | 143 | dp->flags = newflags; |
144 | if (newflags) { | 144 | if (newflags) |
145 | jump_label_enable(&dp->enabled); | 145 | dp->enabled = 1; |
146 | } else { | 146 | else |
147 | jump_label_disable(&dp->enabled); | 147 | dp->enabled = 0; |
148 | } | ||
149 | if (verbose) | 148 | if (verbose) |
150 | printk(KERN_INFO | 149 | printk(KERN_INFO |
151 | "ddebug: changed %s:%d [%s]%s %s\n", | 150 | "ddebug: changed %s:%d [%s]%s %s\n", |