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

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>

authored by

Russell King (Oracle) and committed by
Greg Kroah-Hartman
bb5e44fb 866ec300

+11 -1
+10 -1
drivers/base/cpu.c
··· 527 527 #ifdef CONFIG_GENERIC_CPU_DEVICES 528 528 DEFINE_PER_CPU(struct cpu, cpu_devices); 529 529 530 + bool __weak arch_cpu_is_hotpluggable(int cpu) 531 + { 532 + return false; 533 + } 534 + 530 535 int __weak arch_register_cpu(int cpu) 531 536 { 532 - return register_cpu(&per_cpu(cpu_devices, cpu), cpu); 537 + struct cpu *c = &per_cpu(cpu_devices, cpu); 538 + 539 + c->hotpluggable = arch_cpu_is_hotpluggable(cpu); 540 + 541 + return register_cpu(c, cpu); 533 542 } 534 543 535 544 #ifdef CONFIG_HOTPLUG_CPU
+1
include/linux/cpu.h
··· 80 80 struct device *cpu_device_create(struct device *parent, void *drvdata, 81 81 const struct attribute_group **groups, 82 82 const char *fmt, ...); 83 + extern bool arch_cpu_is_hotpluggable(int cpu); 83 84 extern int arch_register_cpu(int cpu); 84 85 extern void arch_unregister_cpu(int cpu); 85 86 #ifdef CONFIG_HOTPLUG_CPU