static_call: Provide DEFINE_STATIC_CALL_RET0()
authorFrederic Weisbecker <frederic@kernel.org>
Mon, 18 Jan 2021 14:12:17 +0000 (15:12 +0100)
committerIngo Molnar <mingo@kernel.org>
Wed, 17 Feb 2021 13:08:51 +0000 (14:08 +0100)
commit29fd01944b7273bb630c649a2104b7f9e4ef3fa6
tree5ca11e02c8d27cd794d1a0d1b6e221dfb004d2ad
parent3f2a8fc4b15de18644e8a80a09edda168676e22c
static_call: Provide DEFINE_STATIC_CALL_RET0()

DECLARE_STATIC_CALL() must pass the original function targeted for a
given static call. But DEFINE_STATIC_CALL() may want to initialize it as
off. In this case we can't pass NULL (for functions without return value)
or __static_call_return0 (for functions returning a value) directly
to DEFINE_STATIC_CALL() as that may trigger a static call redeclaration
with a different function prototype. Type casts neither can work around
that as they don't get along with typeof().

The proper way to do that for functions that don't return a value is
to use DEFINE_STATIC_CALL_NULL(). But functions returning a actual value
don't have an equivalent yet.

Provide DEFINE_STATIC_CALL_RET0() to solve this situation.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lkml.kernel.org/r/20210118141223.123667-3-frederic@kernel.org
include/linux/static_call.h