Skip to content

Commit 350ef05

Browse files
danieljordan10herbertx
authored andcommitted
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: Daniel 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: Herbert Xu <herbert@gondor.apana.org.au>
1 parent bd25b48 commit 350ef05

4 files changed

Lines changed: 5 additions & 38 deletions

File tree

‎Documentation/core-api/padata.rst‎

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,7 @@ padata_instance structure for overall control of how jobs are to be run::
3131

3232
'name' simply identifies the instance.
3333

34-
There are functions for enabling and disabling the instance::
35-
36-
int padata_start(struct padata_instance *pinst);
37-
void padata_stop(struct padata_instance *pinst);
38-
39-
These functions are setting or clearing the "PADATA_INIT" flag; if that flag is
40-
not set, other functions will refuse to work. padata_start() returns zero on
41-
success (flag set) or -EINVAL if the padata cpumask contains no active CPU
42-
(flag not set). padata_stop() clears the flag and blocks until the padata
43-
instance is unused.
44-
45-
Finally, complete padata initialization by allocating a padata_shell::
34+
Then, complete padata initialization by allocating a padata_shell::
4635

4736
struct padata_shell *padata_alloc_shell(struct padata_instance *pinst);
4837

@@ -155,11 +144,10 @@ submitted.
155144
Destroying
156145
----------
157146

158-
Cleaning up a padata instance predictably involves calling the three free
147+
Cleaning up a padata instance predictably involves calling the two free
159148
functions that correspond to the allocation in reverse::
160149

161150
void padata_free_shell(struct padata_shell *ps);
162-
void padata_stop(struct padata_instance *pinst);
163151
void padata_free(struct padata_instance *pinst);
164152

165153
It is the user's responsibility to ensure all outstanding jobs are complete

‎crypto/pcrypt.c‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -327,12 +327,6 @@ static int pcrypt_init_padata(struct padata_instance **pinst, const char *name)
327327
return ret;
328328
}
329329

330-
static void pcrypt_fini_padata(struct padata_instance *pinst)
331-
{
332-
padata_stop(pinst);
333-
padata_free(pinst);
334-
}
335-
336330
static struct crypto_template pcrypt_tmpl = {
337331
.name = "pcrypt",
338332
.create = pcrypt_create,
@@ -358,7 +352,7 @@ static int __init pcrypt_init(void)
358352
return crypto_register_template(&pcrypt_tmpl);
359353

360354
err_deinit_pencrypt:
361-
pcrypt_fini_padata(pencrypt);
355+
padata_free(pencrypt);
362356
err_unreg_kset:
363357
kset_unregister(pcrypt_kset);
364358
err:
@@ -369,8 +363,8 @@ static void __exit pcrypt_exit(void)
369363
{
370364
crypto_unregister_template(&pcrypt_tmpl);
371365

372-
pcrypt_fini_padata(pencrypt);
373-
pcrypt_fini_padata(pdecrypt);
366+
padata_free(pencrypt);
367+
padata_free(pdecrypt);
374368

375369
kset_unregister(pcrypt_kset);
376370
}

‎include/linux/padata.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,5 +204,4 @@ extern void padata_do_serial(struct padata_priv *padata);
204204
extern void __init padata_do_multithreaded(struct padata_mt_job *job);
205205
extern int padata_set_cpumask(struct padata_instance *pinst, int cpumask_type,
206206
cpumask_var_t cpumask);
207-
extern void padata_stop(struct padata_instance *pinst);
208207
#endif

‎kernel/padata.c‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -789,19 +789,6 @@ int padata_set_cpumask(struct padata_instance *pinst, int cpumask_type,
789789
}
790790
EXPORT_SYMBOL(padata_set_cpumask);
791791

792-
/**
793-
* padata_stop - stop the parallel processing
794-
*
795-
* @pinst: padata instance to stop
796-
*/
797-
void padata_stop(struct padata_instance *pinst)
798-
{
799-
mutex_lock(&pinst->lock);
800-
__padata_stop(pinst);
801-
mutex_unlock(&pinst->lock);
802-
}
803-
EXPORT_SYMBOL(padata_stop);
804-
805792
#ifdef CONFIG_HOTPLUG_CPU
806793

807794
static int __padata_add_cpu(struct padata_instance *pinst, int cpu)
@@ -883,7 +870,6 @@ static void __padata_free(struct padata_instance *pinst)
883870

884871
WARN_ON(!list_empty(&pinst->pslist));
885872

886-
padata_stop(pinst);
887873
free_cpumask_var(pinst->rcpumask.cbcpu);
888874
free_cpumask_var(pinst->rcpumask.pcpu);
889875
free_cpumask_var(pinst->cpumask.pcpu);

0 commit comments

Comments
 (0)