Skip to content

Commit c57e842

Browse files
klassertherbertx
authored andcommitted
crypto: pcrypt - Rename pcrypt_instance
In the crypto-layer an instance refers usually to a crypto instance. The struct pcrypt_instance is not related to a crypto instance. It rather contains the padata informations, so we rename it to padata_pcrypt. The functions that handle this struct are renamed accordingly. Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent c635696 commit c57e842

1 file changed

Lines changed: 14 additions & 16 deletions

File tree

‎crypto/pcrypt.c‎

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
#include <linux/kobject.h>
2929
#include <crypto/pcrypt.h>
3030

31-
struct pcrypt_instance {
32-
const char *name;
31+
struct padata_pcrypt {
3332
struct padata_instance *pinst;
3433
struct workqueue_struct *wq;
3534

@@ -55,8 +54,8 @@ struct pcrypt_instance {
5554
struct notifier_block nblock;
5655
};
5756

58-
static struct pcrypt_instance pencrypt;
59-
static struct pcrypt_instance pdecrypt;
57+
static struct padata_pcrypt pencrypt;
58+
static struct padata_pcrypt pdecrypt;
6059
static struct kset *pcrypt_kset;
6160

6261
struct pcrypt_instance_ctx {
@@ -70,7 +69,7 @@ struct pcrypt_aead_ctx {
7069
};
7170

7271
static int pcrypt_do_parallel(struct padata_priv *padata, unsigned int *cb_cpu,
73-
struct pcrypt_instance *pcrypt)
72+
struct padata_pcrypt *pcrypt)
7473
{
7574
unsigned int cpu_index, cpu, i;
7675
struct pcrypt_cpumask *cpumask;
@@ -408,13 +407,13 @@ static void pcrypt_free(struct crypto_instance *inst)
408407
static int pcrypt_cpumask_change_notify(struct notifier_block *self,
409408
unsigned long val, void *data)
410409
{
411-
struct pcrypt_instance *pcrypt;
410+
struct padata_pcrypt *pcrypt;
412411
struct pcrypt_cpumask *new_mask, *old_mask;
413412

414413
if (!(val & PADATA_CPU_SERIAL))
415414
return 0;
416415

417-
pcrypt = container_of(self, struct pcrypt_instance, nblock);
416+
pcrypt = container_of(self, struct padata_pcrypt, nblock);
418417
new_mask = kmalloc(sizeof(*new_mask), GFP_KERNEL);
419418
if (!new_mask)
420419
return -ENOMEM;
@@ -446,13 +445,12 @@ static int pcrypt_sysfs_add(struct padata_instance *pinst, const char *name)
446445
return ret;
447446
}
448447

449-
static int __pcrypt_init_instance(struct pcrypt_instance *pcrypt,
450-
const char *name)
448+
static int pcrypt_init_padata(struct padata_pcrypt *pcrypt,
449+
const char *name)
451450
{
452451
int ret = -ENOMEM;
453452
struct pcrypt_cpumask *mask;
454453

455-
pcrypt->name = name;
456454
pcrypt->wq = create_workqueue(name);
457455
if (!pcrypt->wq)
458456
goto err;
@@ -495,7 +493,7 @@ static int __pcrypt_init_instance(struct pcrypt_instance *pcrypt,
495493
return ret;
496494
}
497495

498-
static void __pcrypt_deinit_instance(struct pcrypt_instance *pcrypt)
496+
static void pcrypt_fini_padata(struct padata_pcrypt *pcrypt)
499497
{
500498
kobject_put(&pcrypt->pinst->kobj);
501499
free_cpumask_var(pcrypt->cb_cpumask->mask);
@@ -522,11 +520,11 @@ static int __init pcrypt_init(void)
522520
if (!pcrypt_kset)
523521
goto err;
524522

525-
err = __pcrypt_init_instance(&pencrypt, "pencrypt");
523+
err = pcrypt_init_padata(&pencrypt, "pencrypt");
526524
if (err)
527525
goto err_unreg_kset;
528526

529-
err = __pcrypt_init_instance(&pdecrypt, "pdecrypt");
527+
err = pcrypt_init_padata(&pdecrypt, "pdecrypt");
530528
if (err)
531529
goto err_deinit_pencrypt;
532530

@@ -536,7 +534,7 @@ static int __init pcrypt_init(void)
536534
return crypto_register_template(&pcrypt_tmpl);
537535

538536
err_deinit_pencrypt:
539-
__pcrypt_deinit_instance(&pencrypt);
537+
pcrypt_fini_padata(&pencrypt);
540538
err_unreg_kset:
541539
kset_unregister(pcrypt_kset);
542540
err:
@@ -545,8 +543,8 @@ static int __init pcrypt_init(void)
545543

546544
static void __exit pcrypt_exit(void)
547545
{
548-
__pcrypt_deinit_instance(&pencrypt);
549-
__pcrypt_deinit_instance(&pdecrypt);
546+
pcrypt_fini_padata(&pencrypt);
547+
pcrypt_fini_padata(&pdecrypt);
550548

551549
kset_unregister(pcrypt_kset);
552550
crypto_unregister_template(&pcrypt_tmpl);

0 commit comments

Comments
 (0)