summaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2023-11-21 14:44:36 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-12-06 04:41:48 +0100
commitbb5e44fb3be685ecb3feb120aca4269a92cc84cf (patch)
treedd0ec02549dcaccfacb521d6843f53b4f2890ff8 /drivers/base
parentdrivers: base: Implement weak arch_unregister_cpu() (diff)
downloadlinux-bb5e44fb3be685ecb3feb120aca4269a92cc84cf.tar.xz
linux-bb5e44fb3be685ecb3feb120aca4269a92cc84cf.zip
drivers: base: add arch_cpu_is_hotpluggable()
The differences between architecture specific implementations of arch_register_cpu() are down to whether the CPU is hotpluggable or not. Rather than overriding the weak version of arch_register_cpu(), provide a function that can be used to provide this detail instead. Reviewed-by: Shaoqin Huang <shahuang@redhat.com> Signed-off-by: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Gavin Shan <gshan@redhat.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/E1r5R3M-00CszH-6r@rmk-PC.armlinux.org.uk Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/cpu.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 58bb86091b34..221ffbeb1c9b 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -527,9 +527,18 @@ EXPORT_SYMBOL_GPL(cpu_is_hotpluggable);
#ifdef CONFIG_GENERIC_CPU_DEVICES
DEFINE_PER_CPU(struct cpu, cpu_devices);
+bool __weak arch_cpu_is_hotpluggable(int cpu)
+{
+ return false;
+}
+
int __weak arch_register_cpu(int cpu)
{
- return register_cpu(&per_cpu(cpu_devices, cpu), cpu);
+ struct cpu *c = &per_cpu(cpu_devices, cpu);
+
+ c->hotpluggable = arch_cpu_is_hotpluggable(cpu);
+
+ return register_cpu(c, cpu);
}
#ifdef CONFIG_HOTPLUG_CPU