Skip to content

Commit b046664

Browse files
jgross1suryasaimadhu
authored andcommitted
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
1 parent 5e21a3e commit b046664

3 files changed

Lines changed: 36 additions & 18 deletions

File tree

‎include/linux/static_call.h‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -128,16 +128,6 @@ struct static_call_mod {
128128
struct static_call_site *sites;
129129
};
130130

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-
141131
/* For finding the key associated with a trampoline */
142132
struct static_call_tramp_key {
143133
s32 tramp;
@@ -187,10 +177,6 @@ extern long __static_call_return0(void);
187177

188178
static inline int static_call_init(void) { return 0; }
189179

190-
struct static_call_key {
191-
void *func;
192-
};
193-
194180
#define __DEFINE_STATIC_CALL(name, _func, _func_init) \
195181
DECLARE_STATIC_CALL(name, _func); \
196182
struct static_call_key STATIC_CALL_KEY(name) = { \
@@ -243,10 +229,6 @@ static inline long __static_call_return0(void)
243229

244230
static inline int static_call_init(void) { return 0; }
245231

246-
struct static_call_key {
247-
void *func;
248-
};
249-
250232
static inline long __static_call_return0(void)
251233
{
252234
return 0;

‎include/linux/static_call_types.h‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,25 @@ struct static_call_site {
5858
__raw_static_call(name); \
5959
})
6060

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+
6171
#else /* !CONFIG_HAVE_STATIC_CALL_INLINE */
6272

6373
#define __STATIC_CALL_ADDRESSABLE(name)
6474
#define __static_call(name) __raw_static_call(name)
6575

76+
struct static_call_key {
77+
void *func;
78+
};
79+
6680
#endif /* CONFIG_HAVE_STATIC_CALL_INLINE */
6781

6882
#ifdef MODULE
@@ -77,6 +91,10 @@ struct static_call_site {
7791

7892
#else
7993

94+
struct static_call_key {
95+
void *func;
96+
};
97+
8098
#define static_call(name) \
8199
((typeof(STATIC_CALL_TRAMP(name))*)(STATIC_CALL_KEY(name).func))
82100

‎tools/include/linux/static_call_types.h‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,25 @@ struct static_call_site {
5858
__raw_static_call(name); \
5959
})
6060

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+
6171
#else /* !CONFIG_HAVE_STATIC_CALL_INLINE */
6272

6373
#define __STATIC_CALL_ADDRESSABLE(name)
6474
#define __static_call(name) __raw_static_call(name)
6575

76+
struct static_call_key {
77+
void *func;
78+
};
79+
6680
#endif /* CONFIG_HAVE_STATIC_CALL_INLINE */
6781

6882
#ifdef MODULE
@@ -77,6 +91,10 @@ struct static_call_site {
7791

7892
#else
7993

94+
struct static_call_key {
95+
void *func;
96+
};
97+
8098
#define static_call(name) \
8199
((typeof(STATIC_CALL_TRAMP(name))*)(STATIC_CALL_KEY(name).func))
82100

0 commit comments

Comments
 (0)