Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 39751
b: refs/heads/master
c: bd5349c
h: refs/heads/master
i:
  39749: 46ba3d6
  39747: 1c9fa90
  39743: 7224036
v: v3
  • Loading branch information
Neil Brown authored and Linus Torvalds committed Oct 17, 2006
1 parent 9be3468 commit db04d17
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bea493a031fe3337f4fe5479e8e865513828ea76
refs/heads/master: bd5349cfd2b9bbb10a3dbcd3fe5cbaabe0b2ab9e
24 changes: 15 additions & 9 deletions trunk/kernel/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
static DEFINE_MUTEX(cpu_add_remove_lock);
static DEFINE_MUTEX(cpu_bitmask_lock);

static __cpuinitdata BLOCKING_NOTIFIER_HEAD(cpu_chain);
static __cpuinitdata RAW_NOTIFIER_HEAD(cpu_chain);

/* If set, cpu_up and cpu_down will return -EBUSY and do nothing.
* Should always be manipulated under cpu_add_remove_lock
Expand Down Expand Up @@ -68,7 +68,11 @@ EXPORT_SYMBOL_GPL(unlock_cpu_hotplug);
/* Need to know about CPUs going up/down? */
int __cpuinit register_cpu_notifier(struct notifier_block *nb)
{
return blocking_notifier_chain_register(&cpu_chain, nb);
int ret;
mutex_lock(&cpu_add_remove_lock);
ret = raw_notifier_chain_register(&cpu_chain, nb);
mutex_unlock(&cpu_add_remove_lock);
return ret;
}

#ifdef CONFIG_HOTPLUG_CPU
Expand All @@ -77,7 +81,9 @@ EXPORT_SYMBOL(register_cpu_notifier);

void unregister_cpu_notifier(struct notifier_block *nb)
{
blocking_notifier_chain_unregister(&cpu_chain, nb);
mutex_lock(&cpu_add_remove_lock);
raw_notifier_chain_unregister(&cpu_chain, nb);
mutex_unlock(&cpu_add_remove_lock);
}
EXPORT_SYMBOL(unregister_cpu_notifier);

Expand Down Expand Up @@ -126,7 +132,7 @@ static int _cpu_down(unsigned int cpu)
if (!cpu_online(cpu))
return -EINVAL;

err = blocking_notifier_call_chain(&cpu_chain, CPU_DOWN_PREPARE,
err = raw_notifier_call_chain(&cpu_chain, CPU_DOWN_PREPARE,
(void *)(long)cpu);
if (err == NOTIFY_BAD) {
printk("%s: attempt to take down CPU %u failed\n",
Expand All @@ -146,7 +152,7 @@ static int _cpu_down(unsigned int cpu)

if (IS_ERR(p)) {
/* CPU didn't die: tell everyone. Can't complain. */
if (blocking_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED,
if (raw_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED,
(void *)(long)cpu) == NOTIFY_BAD)
BUG();

Expand All @@ -169,7 +175,7 @@ static int _cpu_down(unsigned int cpu)
put_cpu();

/* CPU is completely dead: tell everyone. Too late to complain. */
if (blocking_notifier_call_chain(&cpu_chain, CPU_DEAD,
if (raw_notifier_call_chain(&cpu_chain, CPU_DEAD,
(void *)(long)cpu) == NOTIFY_BAD)
BUG();

Expand Down Expand Up @@ -206,7 +212,7 @@ static int __devinit _cpu_up(unsigned int cpu)
if (cpu_online(cpu) || !cpu_present(cpu))
return -EINVAL;

ret = blocking_notifier_call_chain(&cpu_chain, CPU_UP_PREPARE, hcpu);
ret = raw_notifier_call_chain(&cpu_chain, CPU_UP_PREPARE, hcpu);
if (ret == NOTIFY_BAD) {
printk("%s: attempt to bring up CPU %u failed\n",
__FUNCTION__, cpu);
Expand All @@ -223,11 +229,11 @@ static int __devinit _cpu_up(unsigned int cpu)
BUG_ON(!cpu_online(cpu));

/* Now call notifier in preparation. */
blocking_notifier_call_chain(&cpu_chain, CPU_ONLINE, hcpu);
raw_notifier_call_chain(&cpu_chain, CPU_ONLINE, hcpu);

out_notify:
if (ret != 0)
blocking_notifier_call_chain(&cpu_chain,
raw_notifier_call_chain(&cpu_chain,
CPU_UP_CANCELED, hcpu);

return ret;
Expand Down

0 comments on commit db04d17

Please sign in to comment.