[v2,04/11] static_call: Remove static_call.h dependency on cpu.h
Commit Message
Uninline __static_call_update() to remove static_call.h's dependency on
cpu.h. This will make it much easier to include static_call.h in common
header files like <linux/kernel.h>.
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
---
block/bio.c | 1 +
include/linux/static_call.h | 10 +---------
kernel/cgroup/cgroup.c | 1 +
kernel/static_call.c | 12 ++++++++++++
sound/soc/intel/avs/trace.c | 1 +
5 files changed, 16 insertions(+), 9 deletions(-)
@@ -19,6 +19,7 @@
#include <linux/sched/sysctl.h>
#include <linux/blk-crypto.h>
#include <linux/xarray.h>
+#include <linux/cpu.h>
#include <trace/events/block.h>
#include "blk.h"
@@ -132,7 +132,6 @@
*/
#include <linux/types.h>
-#include <linux/cpu.h>
#include <linux/static_call_types.h>
#ifdef CONFIG_HAVE_STATIC_CALL
@@ -246,14 +245,7 @@ static inline int static_call_init(void) { return 0; }
#define static_call_cond(name) (void)__static_call(name)
-static inline
-void __static_call_update(struct static_call_key *key, void *tramp, void *func)
-{
- cpus_read_lock();
- WRITE_ONCE(key->func, func);
- arch_static_call_transform(NULL, tramp, func, false);
- cpus_read_unlock();
-}
+extern void __static_call_update(struct static_call_key *key, void *tramp, void *func);
static inline int static_call_text_reserved(void *start, void *end)
{
@@ -58,6 +58,7 @@
#include <linux/fs_parser.h>
#include <linux/sched/cputime.h>
#include <linux/psi.h>
+#include <linux/cpu.h>
#include <net/sock.h>
#define CREATE_TRACE_POINTS
@@ -1,8 +1,20 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/static_call.h>
+#include <linux/cpu.h>
long __static_call_return0(void)
{
return 0;
}
EXPORT_SYMBOL_GPL(__static_call_return0);
+
+#ifndef CONFIG_HAVE_STATIC_CALL_INLINE
+void __static_call_update(struct static_call_key *key, void *tramp, void *func)
+{
+ cpus_read_lock();
+ WRITE_ONCE(key->func, func);
+ arch_static_call_transform(NULL, tramp, func, false);
+ cpus_read_unlock();
+}
+EXPORT_SYMBOL_GPL(__static_call_update);
+#endif
@@ -7,6 +7,7 @@
//
#include <linux/types.h>
+#include <asm/page.h>
#define CREATE_TRACE_POINTS
#include "trace.h"