Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

static_call: Move struct static_call_key definition to static_call_types.h

Having the definition of static_call() in static_call_types.h makes
no sense as long struct static_call_key isn't defined there, as the
generic implementation of static_call() is referencing this structure.

So move the definition of struct static_call_key to static_call_types.h.

Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20210311142319.4723-3-jgross@suse.com

authored by

Juergen Gross and committed by
Borislav Petkov
b0466648 5e21a3ec

+36 -18
-18
include/linux/static_call.h
··· 128 128 struct static_call_site *sites; 129 129 }; 130 130 131 - struct static_call_key { 132 - void *func; 133 - union { 134 - /* bit 0: 0 = mods, 1 = sites */ 135 - unsigned long type; 136 - struct static_call_mod *mods; 137 - struct static_call_site *sites; 138 - }; 139 - }; 140 - 141 131 /* For finding the key associated with a trampoline */ 142 132 struct static_call_tramp_key { 143 133 s32 tramp; ··· 176 186 #elif defined(CONFIG_HAVE_STATIC_CALL) 177 187 178 188 static inline int static_call_init(void) { return 0; } 179 - 180 - struct static_call_key { 181 - void *func; 182 - }; 183 189 184 190 #define __DEFINE_STATIC_CALL(name, _func, _func_init) \ 185 191 DECLARE_STATIC_CALL(name, _func); \ ··· 228 242 #else /* Generic implementation */ 229 243 230 244 static inline int static_call_init(void) { return 0; } 231 - 232 - struct static_call_key { 233 - void *func; 234 - }; 235 245 236 246 static inline long __static_call_return0(void) 237 247 {
+18
include/linux/static_call_types.h
··· 58 58 __raw_static_call(name); \ 59 59 }) 60 60 61 + struct static_call_key { 62 + void *func; 63 + union { 64 + /* bit 0: 0 = mods, 1 = sites */ 65 + unsigned long type; 66 + struct static_call_mod *mods; 67 + struct static_call_site *sites; 68 + }; 69 + }; 70 + 61 71 #else /* !CONFIG_HAVE_STATIC_CALL_INLINE */ 62 72 63 73 #define __STATIC_CALL_ADDRESSABLE(name) 64 74 #define __static_call(name) __raw_static_call(name) 75 + 76 + struct static_call_key { 77 + void *func; 78 + }; 65 79 66 80 #endif /* CONFIG_HAVE_STATIC_CALL_INLINE */ 67 81 ··· 90 76 #define static_call(name) __static_call(name) 91 77 92 78 #else 79 + 80 + struct static_call_key { 81 + void *func; 82 + }; 93 83 94 84 #define static_call(name) \ 95 85 ((typeof(STATIC_CALL_TRAMP(name))*)(STATIC_CALL_KEY(name).func))
+18
tools/include/linux/static_call_types.h
··· 58 58 __raw_static_call(name); \ 59 59 }) 60 60 61 + struct static_call_key { 62 + void *func; 63 + union { 64 + /* bit 0: 0 = mods, 1 = sites */ 65 + unsigned long type; 66 + struct static_call_mod *mods; 67 + struct static_call_site *sites; 68 + }; 69 + }; 70 + 61 71 #else /* !CONFIG_HAVE_STATIC_CALL_INLINE */ 62 72 63 73 #define __STATIC_CALL_ADDRESSABLE(name) 64 74 #define __static_call(name) __raw_static_call(name) 75 + 76 + struct static_call_key { 77 + void *func; 78 + }; 65 79 66 80 #endif /* CONFIG_HAVE_STATIC_CALL_INLINE */ 67 81 ··· 90 76 #define static_call(name) __static_call(name) 91 77 92 78 #else 79 + 80 + struct static_call_key { 81 + void *func; 82 + }; 93 83 94 84 #define static_call(name) \ 95 85 ((typeof(STATIC_CALL_TRAMP(name))*)(STATIC_CALL_KEY(name).func))