jump label: Introduce static_branch() interface
[deliverable/linux.git] / arch / x86 / include / asm / jump_label.h
index 574dbc22893a9301914def19c5004b9ec1b851fe..f217cee8653329f88b666aa61c0266abaa3d25f0 100644 (file)
@@ -5,20 +5,24 @@
 
 #include <linux/types.h>
 #include <asm/nops.h>
+#include <asm/asm.h>
 
 #define JUMP_LABEL_NOP_SIZE 5
 
-# define JUMP_LABEL_INITIAL_NOP ".byte 0xe9 \n\t .long 0\n\t"
-
-# define JUMP_LABEL(key, label)                                        \
-       do {                                                    \
-               asm goto("1:"                                   \
-                       JUMP_LABEL_INITIAL_NOP                  \
-                       ".pushsection __jump_table,  \"aw\" \n\t"\
-                       _ASM_PTR "1b, %l[" #label "], %c0 \n\t" \
-                       ".popsection \n\t"                      \
-                       : :  "i" (key) :  : label);             \
-       } while (0)
+#define JUMP_LABEL_INITIAL_NOP ".byte 0xe9 \n\t .long 0\n\t"
+
+static __always_inline bool arch_static_branch(struct jump_label_key *key)
+{
+       asm goto("1:"
+               JUMP_LABEL_INITIAL_NOP
+               ".pushsection __jump_table,  \"aw\" \n\t"
+               _ASM_PTR "1b, %l[l_yes], %c0 \n\t"
+               ".popsection \n\t"
+               : :  "i" (key) : : l_yes);
+       return false;
+l_yes:
+       return true;
+}
 
 #endif /* __KERNEL__ */
 
This page took 0.023845 seconds and 5 git commands to generate.