|
@@ -221,7 +221,7 @@ static struct device_attribute cpu_core_attrs[] = {
|
|
|
|
|
|
static DEFINE_PER_CPU(struct cpu, cpu_devices);
|
|
static DEFINE_PER_CPU(struct cpu, cpu_devices);
|
|
|
|
|
|
-static void register_cpu_online(unsigned int cpu)
|
|
|
|
|
|
+static int register_cpu_online(unsigned int cpu)
|
|
{
|
|
{
|
|
struct cpu *c = &per_cpu(cpu_devices, cpu);
|
|
struct cpu *c = &per_cpu(cpu_devices, cpu);
|
|
struct device *s = &c->dev;
|
|
struct device *s = &c->dev;
|
|
@@ -231,11 +231,12 @@ static void register_cpu_online(unsigned int cpu)
|
|
device_create_file(s, &cpu_core_attrs[i]);
|
|
device_create_file(s, &cpu_core_attrs[i]);
|
|
|
|
|
|
register_mmu_stats(s);
|
|
register_mmu_stats(s);
|
|
|
|
+ return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-#ifdef CONFIG_HOTPLUG_CPU
|
|
|
|
-static void unregister_cpu_online(unsigned int cpu)
|
|
|
|
|
|
+static int unregister_cpu_online(unsigned int cpu)
|
|
{
|
|
{
|
|
|
|
+#ifdef CONFIG_HOTPLUG_CPU
|
|
struct cpu *c = &per_cpu(cpu_devices, cpu);
|
|
struct cpu *c = &per_cpu(cpu_devices, cpu);
|
|
struct device *s = &c->dev;
|
|
struct device *s = &c->dev;
|
|
int i;
|
|
int i;
|
|
@@ -243,33 +244,10 @@ static void unregister_cpu_online(unsigned int cpu)
|
|
unregister_mmu_stats(s);
|
|
unregister_mmu_stats(s);
|
|
for (i = 0; i < ARRAY_SIZE(cpu_core_attrs); i++)
|
|
for (i = 0; i < ARRAY_SIZE(cpu_core_attrs); i++)
|
|
device_remove_file(s, &cpu_core_attrs[i]);
|
|
device_remove_file(s, &cpu_core_attrs[i]);
|
|
-}
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
-static int sysfs_cpu_notify(struct notifier_block *self,
|
|
|
|
- unsigned long action, void *hcpu)
|
|
|
|
-{
|
|
|
|
- unsigned int cpu = (unsigned int)(long)hcpu;
|
|
|
|
-
|
|
|
|
- switch (action) {
|
|
|
|
- case CPU_ONLINE:
|
|
|
|
- case CPU_ONLINE_FROZEN:
|
|
|
|
- register_cpu_online(cpu);
|
|
|
|
- break;
|
|
|
|
-#ifdef CONFIG_HOTPLUG_CPU
|
|
|
|
- case CPU_DEAD:
|
|
|
|
- case CPU_DEAD_FROZEN:
|
|
|
|
- unregister_cpu_online(cpu);
|
|
|
|
- break;
|
|
|
|
#endif
|
|
#endif
|
|
- }
|
|
|
|
- return NOTIFY_OK;
|
|
|
|
|
|
+ return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-static struct notifier_block sysfs_cpu_nb = {
|
|
|
|
- .notifier_call = sysfs_cpu_notify,
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
static void __init check_mmu_stats(void)
|
|
static void __init check_mmu_stats(void)
|
|
{
|
|
{
|
|
unsigned long dummy1, err;
|
|
unsigned long dummy1, err;
|
|
@@ -294,26 +272,21 @@ static void register_nodes(void)
|
|
|
|
|
|
static int __init topology_init(void)
|
|
static int __init topology_init(void)
|
|
{
|
|
{
|
|
- int cpu;
|
|
|
|
|
|
+ int cpu, ret;
|
|
|
|
|
|
register_nodes();
|
|
register_nodes();
|
|
|
|
|
|
check_mmu_stats();
|
|
check_mmu_stats();
|
|
|
|
|
|
- cpu_notifier_register_begin();
|
|
|
|
-
|
|
|
|
for_each_possible_cpu(cpu) {
|
|
for_each_possible_cpu(cpu) {
|
|
struct cpu *c = &per_cpu(cpu_devices, cpu);
|
|
struct cpu *c = &per_cpu(cpu_devices, cpu);
|
|
|
|
|
|
register_cpu(c, cpu);
|
|
register_cpu(c, cpu);
|
|
- if (cpu_online(cpu))
|
|
|
|
- register_cpu_online(cpu);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- __register_cpu_notifier(&sysfs_cpu_nb);
|
|
|
|
-
|
|
|
|
- cpu_notifier_register_done();
|
|
|
|
-
|
|
|
|
|
|
+ ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "sparc/topology:online",
|
|
|
|
+ register_cpu_online, unregister_cpu_online);
|
|
|
|
+ WARN_ON(ret < 0);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|