Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: 9411/1: Switch over to GENERIC_CPU_DEVICES using arch_register_cpu()

Currently, almost all architectures have switched to GENERIC_CPU_DEVICES,
except for arm32. Also switch over to GENERIC_CPU_DEVICES, and provide an
arch_register_cpu() that populates the hotpluggable flag for arm32.

The struct cpu in struct cpuinfo_arm is never used directly, remove
it to use the one GENERIC_CPU_DEVICES provides.

This also has the effect of moving the registration of CPUs from subsys to
driver core initialisation, prior to any initcalls running.

Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

authored by

Jinjie Ruan and committed by
Russell King (Oracle)
609face0 89a906df

+5 -12
+1
arch/arm/Kconfig
··· 64 64 select GENERIC_CLOCKEVENTS_BROADCAST if SMP 65 65 select GENERIC_IRQ_IPI if SMP 66 66 select GENERIC_CPU_AUTOPROBE 67 + select GENERIC_CPU_DEVICES 67 68 select GENERIC_EARLY_IOREMAP 68 69 select GENERIC_IDLE_POLL_SETUP 69 70 select GENERIC_IRQ_MULTI_HANDLER
-1
arch/arm/include/asm/cpu.h
··· 11 11 #include <linux/cpu.h> 12 12 13 13 struct cpuinfo_arm { 14 - struct cpu cpu; 15 14 u32 cpuid; 16 15 #ifdef CONFIG_SMP 17 16 unsigned int loops_per_jiffy;
+4 -11
arch/arm/kernel/setup.c
··· 1201 1201 mdesc->init_early(); 1202 1202 } 1203 1203 1204 - 1205 - static int __init topology_init(void) 1204 + int arch_register_cpu(int num) 1206 1205 { 1207 - int cpu; 1206 + struct cpu *cpu = &per_cpu(cpu_devices, num); 1208 1207 1209 - for_each_possible_cpu(cpu) { 1210 - struct cpuinfo_arm *cpuinfo = &per_cpu(cpu_data, cpu); 1211 - cpuinfo->cpu.hotpluggable = platform_can_hotplug_cpu(cpu); 1212 - register_cpu(&cpuinfo->cpu, cpu); 1213 - } 1214 - 1215 - return 0; 1208 + cpu->hotpluggable = platform_can_hotplug_cpu(num); 1209 + return register_cpu(cpu, num); 1216 1210 } 1217 - subsys_initcall(topology_init); 1218 1211 1219 1212 #ifdef CONFIG_HAVE_PROC_CPU 1220 1213 static int __init proc_cpu_init(void)