summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Morse <james.morse@arm.com>2022-07-07 17:36:25 +0100
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2023-08-29 15:30:11 +0100
commit65c32d8db03c370daa6666e8c010dc606b8be3e4 (patch)
treed48a5cb6deca93ec85e9450926883fa42cdddfba
parentb317b96c8eca88c80b4d7958cbf9b78cff9e846d (diff)
drivers: base: Implement weak arch_unregister_cpu()
Add arch_unregister_cpu() to allow the ACPI machinery to call unregister_cpu(). This is enough for arm64, but needs to be overridden by x86 and ia64 who need to do more work. CC: Jean-Philippe Brucker <jean-philippe@linaro.org> Signed-off-by: James Morse <james.morse@arm.com> --- Changes since v1: * Added CONFIG_HOTPLUG_CPU ifdeffery around unregister_cpu Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
-rw-r--r--arch/ia64/include/asm/cpu.h4
-rw-r--r--arch/loongarch/include/asm/cpu.h6
-rw-r--r--arch/x86/include/asm/cpu.h1
-rw-r--r--drivers/base/cpu.c9
4 files changed, 8 insertions, 12 deletions
diff --git a/arch/ia64/include/asm/cpu.h b/arch/ia64/include/asm/cpu.h
index 6e9786c6ec98..3b36c6a382bb 100644
--- a/arch/ia64/include/asm/cpu.h
+++ b/arch/ia64/include/asm/cpu.h
@@ -9,8 +9,4 @@
DECLARE_PER_CPU(int, cpu_state);
-#ifdef CONFIG_HOTPLUG_CPU
-extern void arch_unregister_cpu(int);
-#endif
-
#endif /* _ASM_IA64_CPU_H_ */
diff --git a/arch/loongarch/include/asm/cpu.h b/arch/loongarch/include/asm/cpu.h
index 3d977732538b..48b9f7168bcc 100644
--- a/arch/loongarch/include/asm/cpu.h
+++ b/arch/loongarch/include/asm/cpu.h
@@ -128,10 +128,4 @@ enum cpu_type_enum {
#define LOONGARCH_CPU_HYPERVISOR BIT_ULL(CPU_FEATURE_HYPERVISOR)
#define LOONGARCH_CPU_PTW BIT_ULL(CPU_FEATURE_PTW)
-#if !defined(__ASSEMBLY__)
-#ifdef CONFIG_HOTPLUG_CPU
-extern void arch_unregister_cpu(int);
-#endif
-#endif /* ! __ASSEMBLY__ */
-
#endif /* _ASM_CPU_H */
diff --git a/arch/x86/include/asm/cpu.h b/arch/x86/include/asm/cpu.h
index f349c94510e8..91867a6a9f8e 100644
--- a/arch/x86/include/asm/cpu.h
+++ b/arch/x86/include/asm/cpu.h
@@ -24,7 +24,6 @@ static inline void prefill_possible_map(void) {}
#endif /* CONFIG_SMP */
#ifdef CONFIG_HOTPLUG_CPU
-extern void arch_unregister_cpu(int);
extern void soft_restart_cpu(void);
#endif
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 84b716821ab8..f572d1f182fc 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -499,7 +499,14 @@ int __weak arch_register_cpu(int cpu)
{
return register_cpu(&per_cpu(cpu_devices, cpu), cpu);
}
-#endif
+
+#ifdef CONFIG_HOTPLUG_CPU
+void __weak arch_unregister_cpu(int num)
+{
+ unregister_cpu(&per_cpu(cpu_devices, num));
+}
+#endif /* CONFIG_HOTPLUG_CPU */
+#endif /* CONFIG_GENERIC_CPU_DEVICES */
static void __init cpu_dev_register_generic(void)
{