[PATCH -next] smp: Move stub from main.c into smp.h

Yue Zou
2022-05-28T10:50:24Z

Move the stubs in init/main.c for !CONFIG_SMP to smp.h
since these definitions for CONFIG_SMP are in smp.h already.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yue Zou <zouyue3@huawei.com>
---
include/linux/smp.h | 4 ++++
init/main.c | 5 -----
2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/include/linux/smp.h b/include/linux/smp.h
index a80ab58ae3f1..bc42f6f8415a 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -183,6 +183,10 @@ static inline int get_boot_cpu_id(void)

#else /* !SMP */

+static const unsigned int setup_max_cpus = NR_CPUS;
+static inline void setup_nr_cpu_ids(void) { }
+static inline void smp_prepare_cpus(unsigned int maxcpus) { }
+
static inline void smp_send_stop(void) { }

/*
diff --git a/init/main.c b/init/main.c
index 0f452ae3b20f..3c432b28c78f 100644
--- a/init/main.c
+++ b/init/main.c
@@ -602,11 +602,6 @@ static int __init rdinit_setup(char *str)
}
__setup("rdinit=", rdinit_setup);

-#ifndef CONFIG_SMP
-static const unsigned int setup_max_cpus = NR_CPUS;
-static inline void setup_nr_cpu_ids(void) { }
-static inline void smp_prepare_cpus(unsigned int maxcpus) { }
-#endif

/*
* We need to store the untouched command line for future reference.
--
2.25.1