]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - include/linux/jump_label.h
Merge remote-tracking branch 'cgroup/for-next'
[karo-tx-linux.git] / include / linux / jump_label.h
index f1094238ab2a0f0fddeb40e3c7aadde7c2a89015..8dde55974f186bca7c1488866aaacdd805c347b3 100644 (file)
@@ -214,11 +214,6 @@ static inline int jump_label_apply_nops(struct module *mod)
 #define STATIC_KEY_INIT STATIC_KEY_INIT_FALSE
 #define jump_label_enabled static_key_enabled
 
-static inline bool static_key_enabled(struct static_key *key)
-{
-       return static_key_count(key) > 0;
-}
-
 static inline void static_key_enable(struct static_key *key)
 {
        int count = static_key_count(key);
@@ -265,6 +260,17 @@ struct static_key_false {
 #define DEFINE_STATIC_KEY_FALSE(name)  \
        struct static_key_false name = STATIC_KEY_FALSE_INIT
 
+extern bool ____wrong_branch_error(void);
+
+#define static_key_enabled(x)                                                  \
+({                                                                             \
+       if (!__builtin_types_compatible_p(typeof(*x), struct static_key) &&     \
+           !__builtin_types_compatible_p(typeof(*x), struct static_key_true) &&\
+           !__builtin_types_compatible_p(typeof(*x), struct static_key_false)) \
+               ____wrong_branch_error();                                       \
+       static_key_count((struct static_key *)x) > 0;                           \
+})
+
 #ifdef HAVE_JUMP_LABEL
 
 /*
@@ -323,8 +329,6 @@ struct static_key_false {
  * See jump_label_type() / jump_label_init_type().
  */
 
-extern bool ____wrong_branch_error(void);
-
 #define static_branch_likely(x)                                                        \
 ({                                                                             \
        bool branch;                                                            \