Commit 80b5184c authored by Akinobu Mita's avatar Akinobu Mita Committed by Linus Torvalds

kernel/: convert cpu notifier to return encapsulate errno value

By the previous modification, the cpu notifier can return encapsulate
errno value.  This converts the cpu notifiers for kernel/*.c
Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ad84bb5b
...@@ -659,7 +659,7 @@ static int padata_cpu_callback(struct notifier_block *nfb, ...@@ -659,7 +659,7 @@ static int padata_cpu_callback(struct notifier_block *nfb,
err = __padata_add_cpu(pinst, cpu); err = __padata_add_cpu(pinst, cpu);
mutex_unlock(&pinst->lock); mutex_unlock(&pinst->lock);
if (err) if (err)
return NOTIFY_BAD; return notifier_from_errno(err);
break; break;
case CPU_DOWN_PREPARE: case CPU_DOWN_PREPARE:
...@@ -670,7 +670,7 @@ static int padata_cpu_callback(struct notifier_block *nfb, ...@@ -670,7 +670,7 @@ static int padata_cpu_callback(struct notifier_block *nfb,
err = __padata_remove_cpu(pinst, cpu); err = __padata_remove_cpu(pinst, cpu);
mutex_unlock(&pinst->lock); mutex_unlock(&pinst->lock);
if (err) if (err)
return NOTIFY_BAD; return notifier_from_errno(err);
break; break;
case CPU_UP_CANCELED: case CPU_UP_CANCELED:
......
...@@ -372,7 +372,7 @@ static int __cpuinit profile_cpu_callback(struct notifier_block *info, ...@@ -372,7 +372,7 @@ static int __cpuinit profile_cpu_callback(struct notifier_block *info,
GFP_KERNEL | __GFP_ZERO, GFP_KERNEL | __GFP_ZERO,
0); 0);
if (!page) if (!page)
return NOTIFY_BAD; return notifier_from_errno(-ENOMEM);
per_cpu(cpu_profile_hits, cpu)[1] = page_address(page); per_cpu(cpu_profile_hits, cpu)[1] = page_address(page);
} }
if (!per_cpu(cpu_profile_hits, cpu)[0]) { if (!per_cpu(cpu_profile_hits, cpu)[0]) {
...@@ -388,7 +388,7 @@ static int __cpuinit profile_cpu_callback(struct notifier_block *info, ...@@ -388,7 +388,7 @@ static int __cpuinit profile_cpu_callback(struct notifier_block *info,
page = virt_to_page(per_cpu(cpu_profile_hits, cpu)[1]); page = virt_to_page(per_cpu(cpu_profile_hits, cpu)[1]);
per_cpu(cpu_profile_hits, cpu)[1] = NULL; per_cpu(cpu_profile_hits, cpu)[1] = NULL;
__free_page(page); __free_page(page);
return NOTIFY_BAD; return notifier_from_errno(-ENOMEM);
case CPU_ONLINE: case CPU_ONLINE:
case CPU_ONLINE_FROZEN: case CPU_ONLINE_FROZEN:
if (prof_cpu_mask != NULL) if (prof_cpu_mask != NULL)
......
...@@ -539,7 +539,7 @@ static int __cpuinit relay_hotcpu_callback(struct notifier_block *nb, ...@@ -539,7 +539,7 @@ static int __cpuinit relay_hotcpu_callback(struct notifier_block *nb,
"relay_hotcpu_callback: cpu %d buffer " "relay_hotcpu_callback: cpu %d buffer "
"creation failed\n", hotcpu); "creation failed\n", hotcpu);
mutex_unlock(&relay_channels_mutex); mutex_unlock(&relay_channels_mutex);
return NOTIFY_BAD; return notifier_from_errno(-ENOMEM);
} }
} }
mutex_unlock(&relay_channels_mutex); mutex_unlock(&relay_channels_mutex);
......
...@@ -52,7 +52,7 @@ hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu) ...@@ -52,7 +52,7 @@ hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu)
case CPU_UP_PREPARE_FROZEN: case CPU_UP_PREPARE_FROZEN:
if (!zalloc_cpumask_var_node(&cfd->cpumask, GFP_KERNEL, if (!zalloc_cpumask_var_node(&cfd->cpumask, GFP_KERNEL,
cpu_to_node(cpu))) cpu_to_node(cpu)))
return NOTIFY_BAD; return notifier_from_errno(-ENOMEM);
break; break;
#ifdef CONFIG_HOTPLUG_CPU #ifdef CONFIG_HOTPLUG_CPU
......
...@@ -808,7 +808,7 @@ static int __cpuinit cpu_callback(struct notifier_block *nfb, ...@@ -808,7 +808,7 @@ static int __cpuinit cpu_callback(struct notifier_block *nfb,
p = kthread_create(run_ksoftirqd, hcpu, "ksoftirqd/%d", hotcpu); p = kthread_create(run_ksoftirqd, hcpu, "ksoftirqd/%d", hotcpu);
if (IS_ERR(p)) { if (IS_ERR(p)) {
printk("ksoftirqd for %i failed\n", hotcpu); printk("ksoftirqd for %i failed\n", hotcpu);
return NOTIFY_BAD; return notifier_from_errno(PTR_ERR(p));
} }
kthread_bind(p, hotcpu); kthread_bind(p, hotcpu);
per_cpu(ksoftirqd, hotcpu) = p; per_cpu(ksoftirqd, hotcpu) = p;
......
...@@ -1680,11 +1680,14 @@ static int __cpuinit timer_cpu_notify(struct notifier_block *self, ...@@ -1680,11 +1680,14 @@ static int __cpuinit timer_cpu_notify(struct notifier_block *self,
unsigned long action, void *hcpu) unsigned long action, void *hcpu)
{ {
long cpu = (long)hcpu; long cpu = (long)hcpu;
int err;
switch(action) { switch(action) {
case CPU_UP_PREPARE: case CPU_UP_PREPARE:
case CPU_UP_PREPARE_FROZEN: case CPU_UP_PREPARE_FROZEN:
if (init_timers_cpu(cpu) < 0) err = init_timers_cpu(cpu);
return NOTIFY_BAD; if (err < 0)
return notifier_from_errno(err);
break; break;
#ifdef CONFIG_HOTPLUG_CPU #ifdef CONFIG_HOTPLUG_CPU
case CPU_DEAD: case CPU_DEAD:
......
...@@ -1110,7 +1110,7 @@ static int __devinit workqueue_cpu_callback(struct notifier_block *nfb, ...@@ -1110,7 +1110,7 @@ static int __devinit workqueue_cpu_callback(struct notifier_block *nfb,
unsigned int cpu = (unsigned long)hcpu; unsigned int cpu = (unsigned long)hcpu;
struct cpu_workqueue_struct *cwq; struct cpu_workqueue_struct *cwq;
struct workqueue_struct *wq; struct workqueue_struct *wq;
int ret = NOTIFY_OK; int err = 0;
action &= ~CPU_TASKS_FROZEN; action &= ~CPU_TASKS_FROZEN;
...@@ -1124,12 +1124,13 @@ static int __devinit workqueue_cpu_callback(struct notifier_block *nfb, ...@@ -1124,12 +1124,13 @@ static int __devinit workqueue_cpu_callback(struct notifier_block *nfb,
switch (action) { switch (action) {
case CPU_UP_PREPARE: case CPU_UP_PREPARE:
if (!create_workqueue_thread(cwq, cpu)) err = create_workqueue_thread(cwq, cpu);
if (!err)
break; break;
printk(KERN_ERR "workqueue [%s] for %i failed\n", printk(KERN_ERR "workqueue [%s] for %i failed\n",
wq->name, cpu); wq->name, cpu);
action = CPU_UP_CANCELED; action = CPU_UP_CANCELED;
ret = NOTIFY_BAD; err = -ENOMEM;
goto undo; goto undo;
case CPU_ONLINE: case CPU_ONLINE:
...@@ -1150,7 +1151,7 @@ static int __devinit workqueue_cpu_callback(struct notifier_block *nfb, ...@@ -1150,7 +1151,7 @@ static int __devinit workqueue_cpu_callback(struct notifier_block *nfb,
cpumask_clear_cpu(cpu, cpu_populated_map); cpumask_clear_cpu(cpu, cpu_populated_map);
} }
return ret; return notifier_from_errno(err);
} }
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
......
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