diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-06-01 16:55:20 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-06-01 16:55:20 +0200 |
commit | f447b48f9e029847fd7b8ae82a16cf2cc8ec0036 (patch) | |
tree | 53dde4b77c28d6ca46556ebf59557a3b66750036 | |
parent | ff2533e77e6ee23161c7168becc8413a49661129 (diff) |
compat: remove padata hotplug code
It's different on different kernel versions, and we're not using it
anyway, so it's easiest to just get rid of it, rather than having
another ifdef maze.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | src/compat/padata/padata.c | 149 |
1 files changed, 0 insertions, 149 deletions
diff --git a/src/compat/padata/padata.c b/src/compat/padata/padata.c index 480c43f..25836db 100644 --- a/src/compat/padata/padata.c +++ b/src/compat/padata/padata.c @@ -677,131 +677,8 @@ void padata_stop(struct padata_instance *pinst) mutex_unlock(&pinst->lock); } -#ifdef CONFIG_HOTPLUG_CPU - -static int __padata_add_cpu(struct padata_instance *pinst, int cpu) -{ - struct parallel_data *pd; - - if (cpumask_test_cpu(cpu, cpu_online_mask)) { - pd = padata_alloc_pd(pinst, pinst->cpumask.pcpu, - pinst->cpumask.cbcpu); - if (!pd) - return -ENOMEM; - - padata_replace(pinst, pd); - - if (padata_validate_cpumask(pinst, pinst->cpumask.pcpu) && - padata_validate_cpumask(pinst, pinst->cpumask.cbcpu)) - __padata_start(pinst); - } - - return 0; -} - -static int __padata_remove_cpu(struct padata_instance *pinst, int cpu) -{ - struct parallel_data *pd = NULL; - - if (cpumask_test_cpu(cpu, cpu_online_mask)) { - - if (!padata_validate_cpumask(pinst, pinst->cpumask.pcpu) || - !padata_validate_cpumask(pinst, pinst->cpumask.cbcpu)) - __padata_stop(pinst); - - pd = padata_alloc_pd(pinst, pinst->cpumask.pcpu, - pinst->cpumask.cbcpu); - if (!pd) - return -ENOMEM; - - padata_replace(pinst, pd); - - cpumask_clear_cpu(cpu, pd->cpumask.cbcpu); - cpumask_clear_cpu(cpu, pd->cpumask.pcpu); - } - - return 0; -} - - /** - * padata_remove_cpu - remove a cpu from the one or both(serial and parallel) - * padata cpumasks. - * - * @pinst: padata instance - * @cpu: cpu to remove - * @mask: bitmask specifying from which cpumask @cpu should be removed - * The @mask may be any combination of the following flags: - * PADATA_CPU_SERIAL - serial cpumask - * PADATA_CPU_PARALLEL - parallel cpumask - */ -int padata_remove_cpu(struct padata_instance *pinst, int cpu, int mask) -{ - int err; - - if (!(mask & (PADATA_CPU_SERIAL | PADATA_CPU_PARALLEL))) - return -EINVAL; - - mutex_lock(&pinst->lock); - - get_online_cpus(); - if (mask & PADATA_CPU_SERIAL) - cpumask_clear_cpu(cpu, pinst->cpumask.cbcpu); - if (mask & PADATA_CPU_PARALLEL) - cpumask_clear_cpu(cpu, pinst->cpumask.pcpu); - - err = __padata_remove_cpu(pinst, cpu); - put_online_cpus(); - - mutex_unlock(&pinst->lock); - - return err; -} - -static inline int pinst_has_cpu(struct padata_instance *pinst, int cpu) -{ - return cpumask_test_cpu(cpu, pinst->cpumask.pcpu) || - cpumask_test_cpu(cpu, pinst->cpumask.cbcpu); -} - -static int padata_cpu_online(unsigned int cpu, struct hlist_node *node) -{ - struct padata_instance *pinst; - int ret; - - pinst = hlist_entry_safe(node, struct padata_instance, node); - if (!pinst_has_cpu(pinst, cpu)) - return 0; - - mutex_lock(&pinst->lock); - ret = __padata_add_cpu(pinst, cpu); - mutex_unlock(&pinst->lock); - return ret; -} - -static int padata_cpu_prep_down(unsigned int cpu, struct hlist_node *node) -{ - struct padata_instance *pinst; - int ret; - - pinst = hlist_entry_safe(node, struct padata_instance, node); - if (!pinst_has_cpu(pinst, cpu)) - return 0; - - mutex_lock(&pinst->lock); - ret = __padata_remove_cpu(pinst, cpu); - mutex_unlock(&pinst->lock); - return ret; -} - -static enum cpuhp_state hp_online; -#endif - static void __padata_free(struct padata_instance *pinst) { -#ifdef CONFIG_HOTPLUG_CPU - cpuhp_state_remove_instance_nocalls(hp_online, &pinst->node); -#endif - padata_stop(pinst); padata_free_pd(pinst->pd); free_cpumask_var(pinst->cpumask.pcpu); @@ -995,9 +872,6 @@ struct padata_instance *padata_alloc(struct workqueue_struct *wq, kobject_init(&pinst->kobj, &padata_attr_type); mutex_init(&pinst->lock); -#ifdef CONFIG_HOTPLUG_CPU - cpuhp_state_add_instance_nocalls(hp_online, &pinst->node); -#endif return pinst; err_free_masks: @@ -1019,26 +893,3 @@ void padata_free(struct padata_instance *pinst) { kobject_put(&pinst->kobj); } - -#ifdef CONFIG_HOTPLUG_CPU - -static __init int padata_driver_init(void) -{ - int ret; - - ret = cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN, "padata:online", - padata_cpu_online, - padata_cpu_prep_down); - if (ret < 0) - return ret; - hp_online = ret; - return 0; -} -module_init(padata_driver_init); - -static __exit void padata_driver_exit(void) -{ - cpuhp_remove_multi_state(hp_online); -} -module_exit(padata_driver_exit); -#endif |