diff options
Diffstat (limited to 'kernel/padata.c')
-rw-r--r-- | kernel/padata.c | 13 |
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 | } |
571 | EXPORT_SYMBOL(padata_stop); | 571 | EXPORT_SYMBOL(padata_stop); |
572 | 572 | ||
573 | #ifdef CONFIG_HOTPLUG_CPU | ||
573 | static int padata_cpu_callback(struct notifier_block *nfb, | 574 | static 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, | |||
631 | struct padata_instance *padata_alloc(const struct cpumask *cpumask, | 633 | struct 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 | ||
667 | err_free_cpumask: | ||
668 | free_cpumask_var(pinst->cpumask); | ||
669 | err_free_pd: | 668 | err_free_pd: |
670 | padata_free_pd(pd); | 669 | padata_free_pd(pd); |
671 | err_free_inst: | 670 | err_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); |