2022-05-28 20:23:18

by Yue Zou

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

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 <[email protected]>
Signed-off-by: Yue Zou <[email protected]>
---
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



2022-06-03 00:55:10

by Thomas Gleixner

[permalink] [raw]
Subject: Re: [PATCH -next] smp: Move stub from main.c into smp.h

On Sat, May 28 2022 at 11:11, Yue Zou wrote:
> #else /* !SMP */
>
> +static const unsigned int setup_max_cpus = NR_CPUS;

This will cause a 'defined but not used warning' for all files which
include smp.h, except for init/main.c

Thanks,

tglx