aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorSteffen Klassert <steffen.klassert@secunet.com>2010-04-29 08:40:10 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2010-05-02 23:32:11 -0400
commite2cb2f1c2ccf19914e941859c07558ba5f8a4610 (patch)
tree48abe8d63bb72052da1dd974ebe967a36e9e4af3 /kernel
parentdf2071bd081408318d659cd14a9cf6ff23d874c9 (diff)
padata: cpu hotplug code should depend on CONFIG_HOTPLUG_CPU
This patch makes the padata cpu hotplug code dependend on CONFIG_HOTPLUG_CPU. Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/padata.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/kernel/padata.c b/kernel/padata.c
index 5b44d0fa358e..1209a17b9718 100644
--- a/kernel/padata.c
+++ b/kernel/padata.c
@@ -570,6 +570,7 @@ void padata_stop(struct padata_instance *pinst)
570} 570}
571EXPORT_SYMBOL(padata_stop); 571EXPORT_SYMBOL(padata_stop);
572 572
573#ifdef CONFIG_HOTPLUG_CPU
573static int padata_cpu_callback(struct notifier_block *nfb, 574static int padata_cpu_callback(struct notifier_block *nfb,
574 unsigned long action, void *hcpu) 575 unsigned long action, void *hcpu)
575{ 576{
@@ -621,6 +622,7 @@ static int padata_cpu_callback(struct notifier_block *nfb,
621 622
622 return NOTIFY_OK; 623 return NOTIFY_OK;
623} 624}
625#endif
624 626
625/* 627/*
626 * padata_alloc - allocate and initialize a padata instance 628 * padata_alloc - allocate and initialize a padata instance
@@ -631,7 +633,6 @@ static int padata_cpu_callback(struct notifier_block *nfb,
631struct padata_instance *padata_alloc(const struct cpumask *cpumask, 633struct padata_instance *padata_alloc(const struct cpumask *cpumask,
632 struct workqueue_struct *wq) 634 struct workqueue_struct *wq)
633{ 635{
634 int err;
635 struct padata_instance *pinst; 636 struct padata_instance *pinst;
636 struct parallel_data *pd; 637 struct parallel_data *pd;
637 638
@@ -654,18 +655,16 @@ struct padata_instance *padata_alloc(const struct cpumask *cpumask,
654 655
655 pinst->flags = 0; 656 pinst->flags = 0;
656 657
658#ifdef CONFIG_HOTPLUG_CPU
657 pinst->cpu_notifier.notifier_call = padata_cpu_callback; 659 pinst->cpu_notifier.notifier_call = padata_cpu_callback;
658 pinst->cpu_notifier.priority = 0; 660 pinst->cpu_notifier.priority = 0;
659 err = register_hotcpu_notifier(&pinst->cpu_notifier); 661 register_hotcpu_notifier(&pinst->cpu_notifier);
660 if (err) 662#endif
661 goto err_free_cpumask;
662 663
663 mutex_init(&pinst->lock); 664 mutex_init(&pinst->lock);
664 665
665 return pinst; 666 return pinst;
666 667
667err_free_cpumask:
668 free_cpumask_var(pinst->cpumask);
669err_free_pd: 668err_free_pd:
670 padata_free_pd(pd); 669 padata_free_pd(pd);
671err_free_inst: 670err_free_inst:
@@ -689,7 +688,9 @@ void padata_free(struct padata_instance *pinst)
689 while (atomic_read(&pinst->pd->refcnt) != 0) 688 while (atomic_read(&pinst->pd->refcnt) != 0)
690 yield(); 689 yield();
691 690
691#ifdef CONFIG_HOTPLUG_CPU
692 unregister_hotcpu_notifier(&pinst->cpu_notifier); 692 unregister_hotcpu_notifier(&pinst->cpu_notifier);
693#endif
693 padata_free_pd(pinst->pd); 694 padata_free_pd(pinst->pd);
694 free_cpumask_var(pinst->cpumask); 695 free_cpumask_var(pinst->cpumask);
695 kfree(pinst); 696 kfree(pinst);