[RFC PATCH 1/2] static_call: fix out-of-line static call implementation

From: Edward Cree
Date: Wed Dec 12 2018 - 12:50:12 EST


Actually call __static_call_update() from static_call_update(), and fix the
former so it can actually compile. Also make it update key.func.

Signed-off-by: Edward Cree <ecree@xxxxxxxxxxxxxx>
---
include/linux/static_call.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linux/static_call.h b/include/linux/static_call.h
index 6daff586c97d..38d6c1e4c85d 100644
--- a/include/linux/static_call.h
+++ b/include/linux/static_call.h
@@ -153,16 +153,18 @@ struct static_call_key {

#define static_call(key, args...) STATIC_CALL_TRAMP(key)(args)

-#define __static_call_update(key, func) \
+#define __static_call_update(key, _func) \
({ \
cpus_read_lock(); \
- arch_static_call_transform(NULL, key->tramp, func); \
+ arch_static_call_transform(NULL, key.tramp, _func); \
+ WRITE_ONCE(key.func, _func); \
cpus_read_unlock(); \
})

#define static_call_update(key, func) \
({ \
BUILD_BUG_ON(!__same_type(func, STATIC_CALL_TRAMP(key))); \
+ __static_call_update(key, func); \
})

#define EXPORT_STATIC_CALL(key) \