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
This commit is contained in:
committed by
Borislav Petkov
parent
5e21a3ecad
commit
b046664872
@@ -128,16 +128,6 @@ struct static_call_mod {
|
|||||||
struct static_call_site *sites;
|
struct static_call_site *sites;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct static_call_key {
|
|
||||||
void *func;
|
|
||||||
union {
|
|
||||||
/* bit 0: 0 = mods, 1 = sites */
|
|
||||||
unsigned long type;
|
|
||||||
struct static_call_mod *mods;
|
|
||||||
struct static_call_site *sites;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
/* For finding the key associated with a trampoline */
|
/* For finding the key associated with a trampoline */
|
||||||
struct static_call_tramp_key {
|
struct static_call_tramp_key {
|
||||||
s32 tramp;
|
s32 tramp;
|
||||||
@@ -187,10 +177,6 @@ extern long __static_call_return0(void);
|
|||||||
|
|
||||||
static inline int static_call_init(void) { return 0; }
|
static inline int static_call_init(void) { return 0; }
|
||||||
|
|
||||||
struct static_call_key {
|
|
||||||
void *func;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define __DEFINE_STATIC_CALL(name, _func, _func_init) \
|
#define __DEFINE_STATIC_CALL(name, _func, _func_init) \
|
||||||
DECLARE_STATIC_CALL(name, _func); \
|
DECLARE_STATIC_CALL(name, _func); \
|
||||||
struct static_call_key STATIC_CALL_KEY(name) = { \
|
struct static_call_key STATIC_CALL_KEY(name) = { \
|
||||||
@@ -243,10 +229,6 @@ static inline long __static_call_return0(void)
|
|||||||
|
|
||||||
static inline int static_call_init(void) { return 0; }
|
static inline int static_call_init(void) { return 0; }
|
||||||
|
|
||||||
struct static_call_key {
|
|
||||||
void *func;
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline long __static_call_return0(void)
|
static inline long __static_call_return0(void)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -58,11 +58,25 @@ struct static_call_site {
|
|||||||
__raw_static_call(name); \
|
__raw_static_call(name); \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
struct static_call_key {
|
||||||
|
void *func;
|
||||||
|
union {
|
||||||
|
/* bit 0: 0 = mods, 1 = sites */
|
||||||
|
unsigned long type;
|
||||||
|
struct static_call_mod *mods;
|
||||||
|
struct static_call_site *sites;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
#else /* !CONFIG_HAVE_STATIC_CALL_INLINE */
|
#else /* !CONFIG_HAVE_STATIC_CALL_INLINE */
|
||||||
|
|
||||||
#define __STATIC_CALL_ADDRESSABLE(name)
|
#define __STATIC_CALL_ADDRESSABLE(name)
|
||||||
#define __static_call(name) __raw_static_call(name)
|
#define __static_call(name) __raw_static_call(name)
|
||||||
|
|
||||||
|
struct static_call_key {
|
||||||
|
void *func;
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* CONFIG_HAVE_STATIC_CALL_INLINE */
|
#endif /* CONFIG_HAVE_STATIC_CALL_INLINE */
|
||||||
|
|
||||||
#ifdef MODULE
|
#ifdef MODULE
|
||||||
@@ -77,6 +91,10 @@ struct static_call_site {
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
struct static_call_key {
|
||||||
|
void *func;
|
||||||
|
};
|
||||||
|
|
||||||
#define static_call(name) \
|
#define static_call(name) \
|
||||||
((typeof(STATIC_CALL_TRAMP(name))*)(STATIC_CALL_KEY(name).func))
|
((typeof(STATIC_CALL_TRAMP(name))*)(STATIC_CALL_KEY(name).func))
|
||||||
|
|
||||||
|
|||||||
@@ -58,11 +58,25 @@ struct static_call_site {
|
|||||||
__raw_static_call(name); \
|
__raw_static_call(name); \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
struct static_call_key {
|
||||||
|
void *func;
|
||||||
|
union {
|
||||||
|
/* bit 0: 0 = mods, 1 = sites */
|
||||||
|
unsigned long type;
|
||||||
|
struct static_call_mod *mods;
|
||||||
|
struct static_call_site *sites;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
#else /* !CONFIG_HAVE_STATIC_CALL_INLINE */
|
#else /* !CONFIG_HAVE_STATIC_CALL_INLINE */
|
||||||
|
|
||||||
#define __STATIC_CALL_ADDRESSABLE(name)
|
#define __STATIC_CALL_ADDRESSABLE(name)
|
||||||
#define __static_call(name) __raw_static_call(name)
|
#define __static_call(name) __raw_static_call(name)
|
||||||
|
|
||||||
|
struct static_call_key {
|
||||||
|
void *func;
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* CONFIG_HAVE_STATIC_CALL_INLINE */
|
#endif /* CONFIG_HAVE_STATIC_CALL_INLINE */
|
||||||
|
|
||||||
#ifdef MODULE
|
#ifdef MODULE
|
||||||
@@ -77,6 +91,10 @@ struct static_call_site {
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
struct static_call_key {
|
||||||
|
void *func;
|
||||||
|
};
|
||||||
|
|
||||||
#define static_call(name) \
|
#define static_call(name) \
|
||||||
((typeof(STATIC_CALL_TRAMP(name))*)(STATIC_CALL_KEY(name).func))
|
((typeof(STATIC_CALL_TRAMP(name))*)(STATIC_CALL_KEY(name).func))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user