Messages in this thread | | | Date | Tue, 10 Nov 2020 11:06:35 +0100 | From | Peter Zijlstra <> | Subject | Re: [RFC PATCH 1/7] static_call/x86: Add __static_call_returnl0() |
| |
On Tue, Nov 10, 2020 at 01:56:03AM +0100, Frederic Weisbecker wrote:
> diff --git a/include/linux/static_call.h b/include/linux/static_call.h > index 695da4c9b338..055544793430 100644 > --- a/include/linux/static_call.h > +++ b/include/linux/static_call.h > @@ -136,6 +136,9 @@ extern void arch_static_call_transform(void *site, void *tramp, void *func, bool > > #ifdef CONFIG_HAVE_STATIC_CALL_INLINE > > +extern int __static_call_return0(void); > +extern long __static_call_returnl0(void); > + > extern int __init static_call_init(void); > > struct static_call_mod { > @@ -187,6 +190,9 @@ extern int static_call_text_reserved(void *start, void *end); > > #elif defined(CONFIG_HAVE_STATIC_CALL) > > +extern int __static_call_return0(void); > +extern long __static_call_returnl0(void); > + > static inline int static_call_init(void) { return 0; } > > struct static_call_key { > @@ -234,6 +240,9 @@ static inline int static_call_text_reserved(void *start, void *end) > > #else /* Generic implementation */ > > +static inline int __static_call_return0(void) { return 0; } > +static inline long __static_call_returnl0(void) { return 0; } > + > static inline int static_call_init(void) { return 0; } > > struct static_call_key { > diff --git a/kernel/static_call.c b/kernel/static_call.c > index 84565c2a41b8..3cb371e71be6 100644 > --- a/kernel/static_call.c > +++ b/kernel/static_call.c > @@ -438,6 +438,16 @@ int __init static_call_init(void) > } > early_initcall(static_call_init); > > +int __static_call_return0(void) > +{ > + return 0; > +} > + > +long __static_call_returnl0(void) > +{ > + return 0; > +} > + > #ifdef CONFIG_STATIC_CALL_SELFTEST > > static int func_a(int x)
So yes, we need the out of line copy, but why do we need the int/long variants?
AFAICT we only need the long version and can cast it to whatever we need (provided the return value is no bigger than long).
| |