Commit e2cb2f1c2ccf19914e941859c07558ba5f8a4610

Authored by Steffen Klassert
Committed by Herbert Xu
1 parent df2071bd08

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>

Showing 1 changed file with 7 additions and 6 deletions Side-by-side Diff

... ... @@ -570,6 +570,7 @@
570 570 }
571 571 EXPORT_SYMBOL(padata_stop);
572 572  
  573 +#ifdef CONFIG_HOTPLUG_CPU
573 574 static int padata_cpu_callback(struct notifier_block *nfb,
574 575 unsigned long action, void *hcpu)
575 576 {
... ... @@ -621,6 +622,7 @@
621 622  
622 623 return NOTIFY_OK;
623 624 }
  625 +#endif
624 626  
625 627 /*
626 628 * padata_alloc - allocate and initialize a padata instance
... ... @@ -631,7 +633,6 @@
631 633 struct padata_instance *padata_alloc(const struct cpumask *cpumask,
632 634 struct workqueue_struct *wq)
633 635 {
634   - int err;
635 636 struct padata_instance *pinst;
636 637 struct parallel_data *pd;
637 638  
638 639  
639 640  
... ... @@ -654,18 +655,16 @@
654 655  
655 656 pinst->flags = 0;
656 657  
  658 +#ifdef CONFIG_HOTPLUG_CPU
657 659 pinst->cpu_notifier.notifier_call = padata_cpu_callback;
658 660 pinst->cpu_notifier.priority = 0;
659   - err = register_hotcpu_notifier(&pinst->cpu_notifier);
660   - if (err)
661   - goto err_free_cpumask;
  661 + register_hotcpu_notifier(&pinst->cpu_notifier);
  662 +#endif
662 663  
663 664 mutex_init(&pinst->lock);
664 665  
665 666 return pinst;
666 667  
667   -err_free_cpumask:
668   - free_cpumask_var(pinst->cpumask);
669 668 err_free_pd:
670 669 padata_free_pd(pd);
671 670 err_free_inst:
672 671  
... ... @@ -689,7 +688,9 @@
689 688 while (atomic_read(&pinst->pd->refcnt) != 0)
690 689 yield();
691 690  
  691 +#ifdef CONFIG_HOTPLUG_CPU
692 692 unregister_hotcpu_notifier(&pinst->cpu_notifier);
  693 +#endif
693 694 padata_free_pd(pinst->pd);
694 695 free_cpumask_var(pinst->cpumask);
695 696 kfree(pinst);