Re: [PATCH 1/4] dynamic_debug: consolidate repetitive struct_ddebug descriptor definitions

From: Andrew Morton
Date: Thu Sep 08 2011 - 19:54:01 EST


On Tue, 30 Aug 2011 14:28:41 -0400
Jason Baron <jbaron@xxxxxxxxxx> wrote:

> Replace the repetitive struct _ddebug descriptor definitions with
> a new DECLARE_DYNAMIC_DEBUG_META_DATA(name, fmt) macro.
>
> ...
>
> +#define DECLARE_DYNAMIC_DEBUG_METADATA(name, fmt) \
> + static struct _ddebug __used __aligned(8) \
> + __attribute__((section("__verbose"))) name = { \
> + .modname = KBUILD_MODNAME, \
> + .function = __func__, \
> + .filename = __FILE__, \
> + .format = (fmt), \
> + .lineno = __LINE__, \
> + .flags = _DPRINTK_FLAGS_DEFAULT, \
> + .enabled = false, \
> + }

<anal>That macro implements a definition, not a declaration</anal>

--- a/include/linux/dynamic_debug.h~dynamic_debug-consolidate-repetitive-struct-_ddebug-descriptor-definitions-fix
+++ a/include/linux/dynamic_debug.h
@@ -54,7 +54,7 @@ extern int __dynamic_netdev_dbg(struct _
const char *fmt, ...)
__attribute__ ((format (printf, 3, 4)));

-#define DECLARE_DYNAMIC_DEBUG_METADATA(name, fmt) \
+#define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \
static struct _ddebug __used __aligned(8) \
__attribute__((section("__verbose"))) name = { \
.modname = KBUILD_MODNAME, \
@@ -68,7 +68,7 @@ extern int __dynamic_netdev_dbg(struct _

#define dynamic_pr_debug(fmt, ...) \
do { \
- DECLARE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
+ DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
if (unlikely(descriptor.enabled)) \
__dynamic_pr_debug(&descriptor, pr_fmt(fmt), \
##__VA_ARGS__); \
@@ -76,7 +76,7 @@ do { \

#define dynamic_dev_dbg(dev, fmt, ...) \
do { \
- DECLARE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
+ DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
if (unlikely(descriptor.enabled)) \
__dynamic_dev_dbg(&descriptor, dev, fmt, \
##__VA_ARGS__); \
@@ -84,7 +84,7 @@ do { \

#define dynamic_netdev_dbg(dev, fmt, ...) \
do { \
- DECLARE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
+ DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
if (unlikely(descriptor.enabled)) \
__dynamic_netdev_dbg(&descriptor, dev, fmt, \
##__VA_ARGS__); \
_

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/