Commit 350ef051 authored by Daniel Jordan's avatar Daniel Jordan Committed by Herbert Xu

padata: remove stop function

padata_stop() has two callers and is unnecessary in both cases.  When
pcrypt calls it before padata_free(), it's being unloaded so there are
no outstanding padata jobs[0].  When __padata_free() calls it, it's
either along the same path or else pcrypt initialization failed, which
of course means there are also no outstanding jobs.

Removing it simplifies padata and saves text.

[0] https://lore.kernel.org/linux-crypto/20191119225017.mjrak2fwa5vccazl@gondor.apana.org.au/Signed-off-by: default avatarDaniel Jordan <daniel.m.jordan@oracle.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Cc: linux-crypto@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent bd25b488
...@@ -31,18 +31,7 @@ padata_instance structure for overall control of how jobs are to be run:: ...@@ -31,18 +31,7 @@ padata_instance structure for overall control of how jobs are to be run::
'name' simply identifies the instance. 'name' simply identifies the instance.
There are functions for enabling and disabling the instance:: Then, complete padata initialization by allocating a padata_shell::
int padata_start(struct padata_instance *pinst);
void padata_stop(struct padata_instance *pinst);
These functions are setting or clearing the "PADATA_INIT" flag; if that flag is
not set, other functions will refuse to work. padata_start() returns zero on
success (flag set) or -EINVAL if the padata cpumask contains no active CPU
(flag not set). padata_stop() clears the flag and blocks until the padata
instance is unused.
Finally, complete padata initialization by allocating a padata_shell::
struct padata_shell *padata_alloc_shell(struct padata_instance *pinst); struct padata_shell *padata_alloc_shell(struct padata_instance *pinst);
...@@ -155,11 +144,10 @@ submitted. ...@@ -155,11 +144,10 @@ submitted.
Destroying Destroying
---------- ----------
Cleaning up a padata instance predictably involves calling the three free Cleaning up a padata instance predictably involves calling the two free
functions that correspond to the allocation in reverse:: functions that correspond to the allocation in reverse::
void padata_free_shell(struct padata_shell *ps); void padata_free_shell(struct padata_shell *ps);
void padata_stop(struct padata_instance *pinst);
void padata_free(struct padata_instance *pinst); void padata_free(struct padata_instance *pinst);
It is the user's responsibility to ensure all outstanding jobs are complete It is the user's responsibility to ensure all outstanding jobs are complete
......
...@@ -327,12 +327,6 @@ static int pcrypt_init_padata(struct padata_instance **pinst, const char *name) ...@@ -327,12 +327,6 @@ static int pcrypt_init_padata(struct padata_instance **pinst, const char *name)
return ret; return ret;
} }
static void pcrypt_fini_padata(struct padata_instance *pinst)
{
padata_stop(pinst);
padata_free(pinst);
}
static struct crypto_template pcrypt_tmpl = { static struct crypto_template pcrypt_tmpl = {
.name = "pcrypt", .name = "pcrypt",
.create = pcrypt_create, .create = pcrypt_create,
...@@ -358,7 +352,7 @@ static int __init pcrypt_init(void) ...@@ -358,7 +352,7 @@ static int __init pcrypt_init(void)
return crypto_register_template(&pcrypt_tmpl); return crypto_register_template(&pcrypt_tmpl);
err_deinit_pencrypt: err_deinit_pencrypt:
pcrypt_fini_padata(pencrypt); padata_free(pencrypt);
err_unreg_kset: err_unreg_kset:
kset_unregister(pcrypt_kset); kset_unregister(pcrypt_kset);
err: err:
...@@ -369,8 +363,8 @@ static void __exit pcrypt_exit(void) ...@@ -369,8 +363,8 @@ static void __exit pcrypt_exit(void)
{ {
crypto_unregister_template(&pcrypt_tmpl); crypto_unregister_template(&pcrypt_tmpl);
pcrypt_fini_padata(pencrypt); padata_free(pencrypt);
pcrypt_fini_padata(pdecrypt); padata_free(pdecrypt);
kset_unregister(pcrypt_kset); kset_unregister(pcrypt_kset);
} }
......
...@@ -204,5 +204,4 @@ extern void padata_do_serial(struct padata_priv *padata); ...@@ -204,5 +204,4 @@ extern void padata_do_serial(struct padata_priv *padata);
extern void __init padata_do_multithreaded(struct padata_mt_job *job); extern void __init padata_do_multithreaded(struct padata_mt_job *job);
extern int padata_set_cpumask(struct padata_instance *pinst, int cpumask_type, extern int padata_set_cpumask(struct padata_instance *pinst, int cpumask_type,
cpumask_var_t cpumask); cpumask_var_t cpumask);
extern void padata_stop(struct padata_instance *pinst);
#endif #endif
...@@ -789,19 +789,6 @@ int padata_set_cpumask(struct padata_instance *pinst, int cpumask_type, ...@@ -789,19 +789,6 @@ int padata_set_cpumask(struct padata_instance *pinst, int cpumask_type,
} }
EXPORT_SYMBOL(padata_set_cpumask); EXPORT_SYMBOL(padata_set_cpumask);
/**
* padata_stop - stop the parallel processing
*
* @pinst: padata instance to stop
*/
void padata_stop(struct padata_instance *pinst)
{
mutex_lock(&pinst->lock);
__padata_stop(pinst);
mutex_unlock(&pinst->lock);
}
EXPORT_SYMBOL(padata_stop);
#ifdef CONFIG_HOTPLUG_CPU #ifdef CONFIG_HOTPLUG_CPU
static int __padata_add_cpu(struct padata_instance *pinst, int cpu) static int __padata_add_cpu(struct padata_instance *pinst, int cpu)
...@@ -883,7 +870,6 @@ static void __padata_free(struct padata_instance *pinst) ...@@ -883,7 +870,6 @@ static void __padata_free(struct padata_instance *pinst)
WARN_ON(!list_empty(&pinst->pslist)); WARN_ON(!list_empty(&pinst->pslist));
padata_stop(pinst);
free_cpumask_var(pinst->rcpumask.cbcpu); free_cpumask_var(pinst->rcpumask.cbcpu);
free_cpumask_var(pinst->rcpumask.pcpu); free_cpumask_var(pinst->rcpumask.pcpu);
free_cpumask_var(pinst->cpumask.pcpu); free_cpumask_var(pinst->cpumask.pcpu);
......
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