Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1486701

[PATCH 2/2] dynamic_debug: Use updated jump label API

From Marc Zyngier <marc.zyngier@arm.com>
Newsgroups linux.kernel
Subject [PATCH 2/2] dynamic_debug: Use updated jump label API
Date 2016-09-19 19:30 +0200
Message-ID <sjayf-8kP-57@gated-at.bofh.it> (permalink)
References <sjaye-8kP-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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@arm.com>
---
 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

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 0/2] jump_labels: Embedding static keys inside structures Marc Zyngier <marc.zyngier@arm.com> - 2016-09-19 19:30 +0200
  [PATCH 1/2] jump_labels: Add API to deal with keys embedded in structures Marc Zyngier <marc.zyngier@arm.com> - 2016-09-19 19:30 +0200
    Re: [PATCH 1/2] jump_labels: Add API to deal with keys embedded in  structures Peter Zijlstra <peterz@infradead.org> - 2016-09-20 11:50 +0200
      Re: [PATCH 1/2] jump_labels: Add API to deal with keys embedded in  structures Marc Zyngier <marc.zyngier@arm.com> - 2016-09-20 11:50 +0200
      Re: [PATCH 1/2] jump_labels: Add API to deal with keys embedded in  structures Christoffer Dall <christoffer.dall@linaro.org> - 2016-09-20 14:30 +0200
        Re: [PATCH 1/2] jump_labels: Add API to deal with keys embedded in  structures Peter Zijlstra <peterz@infradead.org> - 2016-09-20 14:50 +0200
          Re: [PATCH 1/2] jump_labels: Add API to deal with keys embedded in  structures Christoffer Dall <christoffer.dall@linaro.org> - 2016-09-20 15:00 +0200
            Re: [PATCH 1/2] jump_labels: Add API to deal with keys embedded in  structures Peter Zijlstra <peterz@infradead.org> - 2016-09-22 09:50 +0200
  [PATCH 2/2] dynamic_debug: Use updated jump label API Marc Zyngier <marc.zyngier@arm.com> - 2016-09-19 19:30 +0200

csiph-web