Commit be6b5a35 authored by Chandra Seetharaman's avatar Chandra Seetharaman Committed by Linus Torvalds

[PATCH] cpu hotplug: use hotplug version of registration in late inits

Use hotplug version of register_cpu_notifier in late init functions.
Signed-off-by: default avatarChandra Seetharaman <sekharan@us.ibm.com>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Andi Kleen <ak@muc.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 7c7165c9
...@@ -759,7 +759,7 @@ static int __cpuinit cache_sysfs_init(void) ...@@ -759,7 +759,7 @@ static int __cpuinit cache_sysfs_init(void)
if (num_cache_leaves == 0) if (num_cache_leaves == 0)
return 0; return 0;
register_cpu_notifier(&cacheinfo_cpu_notifier); register_hotcpu_notifier(&cacheinfo_cpu_notifier);
for_each_online_cpu(i) { for_each_online_cpu(i) {
cacheinfo_cpu_callback(&cacheinfo_cpu_notifier, CPU_ONLINE, cacheinfo_cpu_callback(&cacheinfo_cpu_notifier, CPU_ONLINE,
......
...@@ -958,9 +958,9 @@ remove_palinfo_proc_entries(unsigned int hcpu) ...@@ -958,9 +958,9 @@ remove_palinfo_proc_entries(unsigned int hcpu)
} }
} }
static int __cpuinit palinfo_cpu_callback(struct notifier_block *nfb, #ifdef CONFIG_HOTPLUG_CPU
unsigned long action, static int palinfo_cpu_callback(struct notifier_block *nfb,
void *hcpu) unsigned long action, void *hcpu)
{ {
unsigned int hotcpu = (unsigned long)hcpu; unsigned int hotcpu = (unsigned long)hcpu;
...@@ -968,20 +968,19 @@ static int __cpuinit palinfo_cpu_callback(struct notifier_block *nfb, ...@@ -968,20 +968,19 @@ static int __cpuinit palinfo_cpu_callback(struct notifier_block *nfb,
case CPU_ONLINE: case CPU_ONLINE:
create_palinfo_proc_entries(hotcpu); create_palinfo_proc_entries(hotcpu);
break; break;
#ifdef CONFIG_HOTPLUG_CPU
case CPU_DEAD: case CPU_DEAD:
remove_palinfo_proc_entries(hotcpu); remove_palinfo_proc_entries(hotcpu);
break; break;
#endif
} }
return NOTIFY_OK; return NOTIFY_OK;
} }
static struct notifier_block __cpuinitdata palinfo_cpu_notifier = static struct notifier_block palinfo_cpu_notifier =
{ {
.notifier_call = palinfo_cpu_callback, .notifier_call = palinfo_cpu_callback,
.priority = 0, .priority = 0,
}; };
#endif
static int __init static int __init
palinfo_init(void) palinfo_init(void)
...@@ -1020,7 +1019,7 @@ palinfo_exit(void) ...@@ -1020,7 +1019,7 @@ palinfo_exit(void)
/* /*
* Unregister from cpu notifier callbacks * Unregister from cpu notifier callbacks
*/ */
unregister_cpu_notifier(&palinfo_cpu_notifier); unregister_hotcpu_notifier(&palinfo_cpu_notifier);
} }
module_init(palinfo_init); module_init(palinfo_init);
......
...@@ -435,7 +435,7 @@ static int __cpuinit cache_sysfs_init(void) ...@@ -435,7 +435,7 @@ static int __cpuinit cache_sysfs_init(void)
(void *)(long)i); (void *)(long)i);
} }
register_cpu_notifier(&cache_cpu_notifier); register_hotcpu_notifier(&cache_cpu_notifier);
return 0; return 0;
} }
......
...@@ -617,7 +617,8 @@ appldata_offline_cpu(int cpu) ...@@ -617,7 +617,8 @@ appldata_offline_cpu(int cpu)
spin_unlock(&appldata_timer_lock); spin_unlock(&appldata_timer_lock);
} }
static int __cpuinit #ifdef CONFIG_HOTPLUG_CPU
static int
appldata_cpu_notify(struct notifier_block *self, appldata_cpu_notify(struct notifier_block *self,
unsigned long action, void *hcpu) unsigned long action, void *hcpu)
{ {
...@@ -625,20 +626,19 @@ appldata_cpu_notify(struct notifier_block *self, ...@@ -625,20 +626,19 @@ appldata_cpu_notify(struct notifier_block *self,
case CPU_ONLINE: case CPU_ONLINE:
appldata_online_cpu((long) hcpu); appldata_online_cpu((long) hcpu);
break; break;
#ifdef CONFIG_HOTPLUG_CPU
case CPU_DEAD: case CPU_DEAD:
appldata_offline_cpu((long) hcpu); appldata_offline_cpu((long) hcpu);
break; break;
#endif
default: default:
break; break;
} }
return NOTIFY_OK; return NOTIFY_OK;
} }
static struct notifier_block __devinitdata appldata_nb = { static struct notifier_block appldata_nb = {
.notifier_call = appldata_cpu_notify, .notifier_call = appldata_cpu_notify,
}; };
#endif
/* /*
* appldata_init() * appldata_init()
...@@ -662,7 +662,7 @@ static int __init appldata_init(void) ...@@ -662,7 +662,7 @@ static int __init appldata_init(void)
appldata_online_cpu(i); appldata_online_cpu(i);
/* Register cpu hotplug notifier */ /* Register cpu hotplug notifier */
register_cpu_notifier(&appldata_nb); register_hotcpu_notifier(&appldata_nb);
appldata_sysctl_header = register_sysctl_table(appldata_dir_table, 1); appldata_sysctl_header = register_sysctl_table(appldata_dir_table, 1);
#ifdef MODULE #ifdef MODULE
......
...@@ -615,7 +615,7 @@ static __cpuinit int mce_create_device(unsigned int cpu) ...@@ -615,7 +615,7 @@ static __cpuinit int mce_create_device(unsigned int cpu)
} }
#ifdef CONFIG_HOTPLUG_CPU #ifdef CONFIG_HOTPLUG_CPU
static __cpuinit void mce_remove_device(unsigned int cpu) static void mce_remove_device(unsigned int cpu)
{ {
int i; int i;
...@@ -626,10 +626,9 @@ static __cpuinit void mce_remove_device(unsigned int cpu) ...@@ -626,10 +626,9 @@ static __cpuinit void mce_remove_device(unsigned int cpu)
sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_check_interval); sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_check_interval);
sysdev_unregister(&per_cpu(device_mce,cpu)); sysdev_unregister(&per_cpu(device_mce,cpu));
} }
#endif
/* Get notified when a cpu comes on/off. Be hotplug friendly. */ /* Get notified when a cpu comes on/off. Be hotplug friendly. */
static __cpuinit int static int
mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
{ {
unsigned int cpu = (unsigned long)hcpu; unsigned int cpu = (unsigned long)hcpu;
...@@ -638,18 +637,17 @@ mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) ...@@ -638,18 +637,17 @@ mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
case CPU_ONLINE: case CPU_ONLINE:
mce_create_device(cpu); mce_create_device(cpu);
break; break;
#ifdef CONFIG_HOTPLUG_CPU
case CPU_DEAD: case CPU_DEAD:
mce_remove_device(cpu); mce_remove_device(cpu);
break; break;
#endif
} }
return NOTIFY_OK; return NOTIFY_OK;
} }
static struct notifier_block __cpuinitdata mce_cpu_notifier = { static struct notifier_block mce_cpu_notifier = {
.notifier_call = mce_cpu_callback, .notifier_call = mce_cpu_callback,
}; };
#endif
static __init int mce_init_device(void) static __init int mce_init_device(void)
{ {
...@@ -664,7 +662,7 @@ static __init int mce_init_device(void) ...@@ -664,7 +662,7 @@ static __init int mce_init_device(void)
mce_create_device(i); mce_create_device(i);
} }
register_cpu_notifier(&mce_cpu_notifier); register_hotcpu_notifier(&mce_cpu_notifier);
misc_register(&mce_log_device); misc_register(&mce_log_device);
return err; return err;
} }
......
...@@ -558,7 +558,7 @@ static __cpuinit int threshold_create_device(unsigned int cpu) ...@@ -558,7 +558,7 @@ static __cpuinit int threshold_create_device(unsigned int cpu)
* of shared sysfs dir/files, and rest of the cores will be symlinked to it. * of shared sysfs dir/files, and rest of the cores will be symlinked to it.
*/ */
static __cpuinit void deallocate_threshold_block(unsigned int cpu, static void deallocate_threshold_block(unsigned int cpu,
unsigned int bank) unsigned int bank)
{ {
struct threshold_block *pos = NULL; struct threshold_block *pos = NULL;
...@@ -578,7 +578,7 @@ static __cpuinit void deallocate_threshold_block(unsigned int cpu, ...@@ -578,7 +578,7 @@ static __cpuinit void deallocate_threshold_block(unsigned int cpu,
per_cpu(threshold_banks, cpu)[bank]->blocks = NULL; per_cpu(threshold_banks, cpu)[bank]->blocks = NULL;
} }
static __cpuinit void threshold_remove_bank(unsigned int cpu, int bank) static void threshold_remove_bank(unsigned int cpu, int bank)
{ {
int i = 0; int i = 0;
struct threshold_bank *b; struct threshold_bank *b;
...@@ -618,7 +618,7 @@ static __cpuinit void threshold_remove_bank(unsigned int cpu, int bank) ...@@ -618,7 +618,7 @@ static __cpuinit void threshold_remove_bank(unsigned int cpu, int bank)
per_cpu(threshold_banks, cpu)[bank] = NULL; per_cpu(threshold_banks, cpu)[bank] = NULL;
} }
static __cpuinit void threshold_remove_device(unsigned int cpu) static void threshold_remove_device(unsigned int cpu)
{ {
unsigned int bank; unsigned int bank;
...@@ -629,14 +629,8 @@ static __cpuinit void threshold_remove_device(unsigned int cpu) ...@@ -629,14 +629,8 @@ static __cpuinit void threshold_remove_device(unsigned int cpu)
} }
} }
#else /* !CONFIG_HOTPLUG_CPU */
static void threshold_remove_device(unsigned int cpu)
{
}
#endif
/* get notified when a cpu comes on/off */ /* get notified when a cpu comes on/off */
static int __cpuinit threshold_cpu_callback(struct notifier_block *nfb, static int threshold_cpu_callback(struct notifier_block *nfb,
unsigned long action, void *hcpu) unsigned long action, void *hcpu)
{ {
/* cpu was unsigned int to begin with */ /* cpu was unsigned int to begin with */
...@@ -659,9 +653,10 @@ static int __cpuinit threshold_cpu_callback(struct notifier_block *nfb, ...@@ -659,9 +653,10 @@ static int __cpuinit threshold_cpu_callback(struct notifier_block *nfb,
return NOTIFY_OK; return NOTIFY_OK;
} }
static struct notifier_block threshold_cpu_notifier __cpuinitdata = { static struct notifier_block threshold_cpu_notifier = {
.notifier_call = threshold_cpu_callback, .notifier_call = threshold_cpu_callback,
}; };
#endif /* CONFIG_HOTPLUG_CPU */
static __init int threshold_init_device(void) static __init int threshold_init_device(void)
{ {
...@@ -673,7 +668,7 @@ static __init int threshold_init_device(void) ...@@ -673,7 +668,7 @@ static __init int threshold_init_device(void)
if (err) if (err)
return err; return err;
} }
register_cpu_notifier(&threshold_cpu_notifier); register_hotcpu_notifier(&threshold_cpu_notifier);
return 0; return 0;
} }
......
...@@ -139,7 +139,7 @@ static int __cpuinit topology_sysfs_init(void) ...@@ -139,7 +139,7 @@ static int __cpuinit topology_sysfs_init(void)
(void *)(long)i); (void *)(long)i);
} }
register_cpu_notifier(&topology_cpu_notifier); register_hotcpu_notifier(&topology_cpu_notifier);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment