aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/dynamic_debug.h
diff options
context:
space:
mode:
authorJason Baron <jbaron@redhat.com>2011-10-04 17:13:15 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-10-18 14:22:00 -0400
commit07613b0b5ef8570033aa806d1731dce599862223 (patch)
treee5f905c35d9f2ff89e3c0c5354e94fd2516fcc81 /include/linux/dynamic_debug.h
parent27a90700a4275c5178b883b65927affdafa5185c (diff)
dynamic_debug: consolidate repetitive struct _ddebug descriptor definitions
Replace the repetitive struct _ddebug descriptor definitions with a new DECLARE_DYNAMIC_DEBUG_META_DATA(name, fmt) macro. [akpm@linux-foundation.org: s/DECLARE/DEFINE/] Signed-off-by: Jason Baron <jbaron@redhat.com> Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Andrew Morton <akpm@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/dynamic_debug.h')
-rw-r--r--include/linux/dynamic_debug.h64
1 files changed, 35 insertions, 29 deletions
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index feaac1ee3001..13aae8087b56 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -54,35 +54,41 @@ extern int __dynamic_netdev_dbg(struct _ddebug *descriptor,
54 const char *fmt, ...) 54 const char *fmt, ...)
55 __attribute__ ((format (printf, 3, 4))); 55 __attribute__ ((format (printf, 3, 4)));
56 56
57#define dynamic_pr_debug(fmt, ...) do { \ 57#define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \
58 static struct _ddebug descriptor \ 58 static struct _ddebug __used __aligned(8) \
59 __used \ 59 __attribute__((section("__verbose"))) name = { \
60 __attribute__((section("__verbose"), aligned(8))) = \ 60 .modname = KBUILD_MODNAME, \
61 { KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \ 61 .function = __func__, \
62 _DPRINTK_FLAGS_DEFAULT }; \ 62 .filename = __FILE__, \
63 if (unlikely(descriptor.enabled)) \ 63 .format = (fmt), \
64 __dynamic_pr_debug(&descriptor, pr_fmt(fmt), ##__VA_ARGS__); \ 64 .lineno = __LINE__, \
65 } while (0) 65 .flags = _DPRINTK_FLAGS_DEFAULT, \
66 66 .enabled = false, \
67#define dynamic_dev_dbg(dev, fmt, ...) do { \ 67 }
68 static struct _ddebug descriptor \ 68
69 __used \ 69#define dynamic_pr_debug(fmt, ...) \
70 __attribute__((section("__verbose"), aligned(8))) = \ 70do { \
71 { KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \ 71 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
72 _DPRINTK_FLAGS_DEFAULT }; \ 72 if (unlikely(descriptor.enabled)) \
73 if (unlikely(descriptor.enabled)) \ 73 __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \
74 __dynamic_dev_dbg(&descriptor, dev, fmt, ##__VA_ARGS__); \ 74 ##__VA_ARGS__); \
75 } while (0) 75} while (0)
76 76
77#define dynamic_netdev_dbg(dev, fmt, ...) do { \ 77#define dynamic_dev_dbg(dev, fmt, ...) \
78 static struct _ddebug descriptor \ 78do { \
79 __used \ 79 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
80 __attribute__((section("__verbose"), aligned(8))) = \ 80 if (unlikely(descriptor.enabled)) \
81 { KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \ 81 __dynamic_dev_dbg(&descriptor, dev, fmt, \
82 _DPRINTK_FLAGS_DEFAULT }; \ 82 ##__VA_ARGS__); \
83 if (unlikely(descriptor.enabled)) \ 83} while (0)
84 __dynamic_netdev_dbg(&descriptor, dev, fmt, ##__VA_ARGS__);\ 84
85 } while (0) 85#define dynamic_netdev_dbg(dev, fmt, ...) \
86do { \
87 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
88 if (unlikely(descriptor.enabled)) \
89 __dynamic_netdev_dbg(&descriptor, dev, fmt, \
90 ##__VA_ARGS__); \
91} while (0)
86 92
87#else 93#else
88 94