提交 07613b0b 编写于 作者: J Jason Baron 提交者: Greg Kroah-Hartman

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: NJason Baron <jbaron@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: NAndrew Morton <akpm@google.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 27a90700
...@@ -54,35 +54,41 @@ extern int __dynamic_netdev_dbg(struct _ddebug *descriptor, ...@@ -54,35 +54,41 @@ extern int __dynamic_netdev_dbg(struct _ddebug *descriptor,
const char *fmt, ...) const char *fmt, ...)
__attribute__ ((format (printf, 3, 4))); __attribute__ ((format (printf, 3, 4)));
#define dynamic_pr_debug(fmt, ...) do { \ #define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \
static struct _ddebug descriptor \ static struct _ddebug __used __aligned(8) \
__used \ __attribute__((section("__verbose"))) name = { \
__attribute__((section("__verbose"), aligned(8))) = \ .modname = KBUILD_MODNAME, \
{ KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \ .function = __func__, \
_DPRINTK_FLAGS_DEFAULT }; \ .filename = __FILE__, \
if (unlikely(descriptor.enabled)) \ .format = (fmt), \
__dynamic_pr_debug(&descriptor, pr_fmt(fmt), ##__VA_ARGS__); \ .lineno = __LINE__, \
} while (0) .flags = _DPRINTK_FLAGS_DEFAULT, \
.enabled = false, \
#define dynamic_dev_dbg(dev, fmt, ...) do { \ }
static struct _ddebug descriptor \
__used \ #define dynamic_pr_debug(fmt, ...) \
__attribute__((section("__verbose"), aligned(8))) = \ do { \
{ KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \ DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
_DPRINTK_FLAGS_DEFAULT }; \ if (unlikely(descriptor.enabled)) \
if (unlikely(descriptor.enabled)) \ __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \
__dynamic_dev_dbg(&descriptor, dev, fmt, ##__VA_ARGS__); \ ##__VA_ARGS__); \
} while (0) } while (0)
#define dynamic_netdev_dbg(dev, fmt, ...) do { \ #define dynamic_dev_dbg(dev, fmt, ...) \
static struct _ddebug descriptor \ do { \
__used \ DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
__attribute__((section("__verbose"), aligned(8))) = \ if (unlikely(descriptor.enabled)) \
{ KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \ __dynamic_dev_dbg(&descriptor, dev, fmt, \
_DPRINTK_FLAGS_DEFAULT }; \ ##__VA_ARGS__); \
if (unlikely(descriptor.enabled)) \ } while (0)
__dynamic_netdev_dbg(&descriptor, dev, fmt, ##__VA_ARGS__);\
} while (0) #define dynamic_netdev_dbg(dev, fmt, ...) \
do { \
DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
if (unlikely(descriptor.enabled)) \
__dynamic_netdev_dbg(&descriptor, dev, fmt, \
##__VA_ARGS__); \
} while (0)
#else #else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册