e3e9859037917b1b762f5f341e46482c0cdb9192
[openwrt/staging/ansuel.git] /
1 From 4c8a49854130da0117a0fdb858551824919a2389 Mon Sep 17 00:00:00 2001
2 From: Ingo Molnar <mingo@kernel.org>
3 Date: Tue, 27 Feb 2024 09:58:15 +0100
4 Subject: [PATCH] smp: Avoid 'setup_max_cpus' namespace collision/shadowing
5
6 bringup_nonboot_cpus() gets passed the 'setup_max_cpus'
7 variable in init/main.c - which is also the name of the parameter,
8 shadowing the name.
9
10 To reduce confusion and to allow the 'setup_max_cpus' value
11 to be #defined in the <linux/smp.h> header, use the 'max_cpus'
12 name for the function parameter name.
13
14 Signed-off-by: Ingo Molnar <mingo@kernel.org>
15 Cc: Thomas Gleixner <tglx@linutronix.de>
16 Cc: linux-kernel@vger.kernel.org
17 ---
18 include/linux/cpu.h | 2 +-
19 kernel/cpu.c | 6 +++---
20 2 files changed, 4 insertions(+), 4 deletions(-)
21
22 --- a/include/linux/cpu.h
23 +++ b/include/linux/cpu.h
24 @@ -109,7 +109,7 @@ void notify_cpu_starting(unsigned int cp
25 extern void cpu_maps_update_begin(void);
26 extern void cpu_maps_update_done(void);
27 int bringup_hibernate_cpu(unsigned int sleep_cpu);
28 -void bringup_nonboot_cpus(unsigned int setup_max_cpus);
29 +void bringup_nonboot_cpus(unsigned int max_cpus);
30
31 #else /* CONFIG_SMP */
32 #define cpuhp_tasks_frozen 0
33 --- a/kernel/cpu.c
34 +++ b/kernel/cpu.c
35 @@ -1905,14 +1905,14 @@ static bool __init cpuhp_bringup_cpus_pa
36 static inline bool cpuhp_bringup_cpus_parallel(unsigned int ncpus) { return false; }
37 #endif /* CONFIG_HOTPLUG_PARALLEL */
38
39 -void __init bringup_nonboot_cpus(unsigned int setup_max_cpus)
40 +void __init bringup_nonboot_cpus(unsigned int max_cpus)
41 {
42 /* Try parallel bringup optimization if enabled */
43 - if (cpuhp_bringup_cpus_parallel(setup_max_cpus))
44 + if (cpuhp_bringup_cpus_parallel(max_cpus))
45 return;
46
47 /* Full per CPU serialized bringup */
48 - cpuhp_bringup_mask(cpu_present_mask, setup_max_cpus, CPUHP_ONLINE);
49 + cpuhp_bringup_mask(cpu_present_mask, max_cpus, CPUHP_ONLINE);
50 }
51
52 #ifdef CONFIG_PM_SLEEP_SMP