[PATCH 2/2] dynamic_debug: Use updated jump label API
From: Marc Zyngier
Date: Mon Sep 19 2016 - 13:21:41 EST
Now that we have brand new DECLARE_STATIC_KEY_TRUE/FALSE and
INIT_STATIC_KEY_TRUE/FALSE as first class APIs, convert the
dynamic_debug infrastructure to use it.
Signed-off-by: Marc Zyngier <marc.zyngier@xxxxxxx>
---
include/linux/dynamic_debug.h | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index 546d680..a180dd1 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -39,8 +39,8 @@ struct _ddebug {
unsigned int flags:8;
#ifdef HAVE_JUMP_LABEL
union {
- struct static_key_true dd_key_true;
- struct static_key_false dd_key_false;
+ DECLARE_STATIC_KEY_TRUE(dd_key_true);
+ DECLARE_STATIC_KEY_FALSE(dd_key_false);
} key;
#endif
} __attribute__((aligned(8)));
@@ -70,7 +70,7 @@ void __dynamic_netdev_dbg(struct _ddebug *descriptor,
const struct net_device *dev,
const char *fmt, ...);
-#define DEFINE_DYNAMIC_DEBUG_METADATA_KEY(name, fmt, key, init) \
+#define DEFINE_DYNAMIC_DEBUG_METADATA_KEY(name, fmt, dd_key_init) \
static struct _ddebug __aligned(8) \
__attribute__((section("__verbose"))) name = { \
.modname = KBUILD_MODNAME, \
@@ -79,24 +79,22 @@ void __dynamic_netdev_dbg(struct _ddebug *descriptor,
.format = (fmt), \
.lineno = __LINE__, \
.flags = _DPRINTK_FLAGS_DEFAULT, \
- dd_key_init(key, init) \
+ dd_key_init \
}
#ifdef HAVE_JUMP_LABEL
-#define dd_key_init(key, init) key = (init)
-
#ifdef DEBUG
#define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \
- DEFINE_DYNAMIC_DEBUG_METADATA_KEY(name, fmt, .key.dd_key_true, \
- (STATIC_KEY_TRUE_INIT))
+ DEFINE_DYNAMIC_DEBUG_METADATA_KEY(name, fmt, \
+ INIT_STATIC_KEY_TRUE(.key.dd_key_true))
#define DYNAMIC_DEBUG_BRANCH(descriptor) \
static_branch_likely(&descriptor.key.dd_key_true)
#else
#define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \
- DEFINE_DYNAMIC_DEBUG_METADATA_KEY(name, fmt, .key.dd_key_false, \
- (STATIC_KEY_FALSE_INIT))
+ DEFINE_DYNAMIC_DEBUG_METADATA_KEY(name, fmt, \
+ INIT_STATIC_KEY_FALSE(.key.dd_key_false))
#define DYNAMIC_DEBUG_BRANCH(descriptor) \
static_branch_unlikely(&descriptor.key.dd_key_false)
@@ -104,10 +102,10 @@ void __dynamic_netdev_dbg(struct _ddebug *descriptor,
#else
-#define dd_key_init(key, init)
+#define dd_key_do_nothing
#define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \
- DEFINE_DYNAMIC_DEBUG_METADATA_KEY(name, fmt, 0, 0)
+ DEFINE_DYNAMIC_DEBUG_METADATA_KEY(name, fmt, dd_key_do_nothing)
#ifdef DEBUG
#define DYNAMIC_DEBUG_BRANCH(descriptor) \
--
2.1.4