diff options
author | Steffen Klassert <steffen.klassert@secunet.com> | 2010-07-27 01:16:33 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2010-07-31 07:53:05 -0400 |
commit | c57e842eff49b05c4642dd7cfb1e7aa62ab932fa (patch) | |
tree | eb8aaab8f88e937c16ecd88660d88fae21cb425a /crypto/pcrypt.c | |
parent | c635696c7c0fbc720698dbec34bb83e53df6a967 (diff) |
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>
Diffstat (limited to 'crypto/pcrypt.c')
-rw-r--r-- | crypto/pcrypt.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c index 55460839624e..77425530ee11 100644 --- a/crypto/pcrypt.c +++ b/crypto/pcrypt.c | |||
@@ -28,8 +28,7 @@ | |||
28 | #include <linux/kobject.h> | 28 | #include <linux/kobject.h> |
29 | #include <crypto/pcrypt.h> | 29 | #include <crypto/pcrypt.h> |
30 | 30 | ||
31 | struct pcrypt_instance { | 31 | struct padata_pcrypt { |
32 | const char *name; | ||
33 | struct padata_instance *pinst; | 32 | struct padata_instance *pinst; |
34 | struct workqueue_struct *wq; | 33 | struct workqueue_struct *wq; |
35 | 34 | ||
@@ -55,8 +54,8 @@ struct pcrypt_instance { | |||
55 | struct notifier_block nblock; | 54 | struct notifier_block nblock; |
56 | }; | 55 | }; |
57 | 56 | ||
58 | static struct pcrypt_instance pencrypt; | 57 | static struct padata_pcrypt pencrypt; |
59 | static struct pcrypt_instance pdecrypt; | 58 | static struct padata_pcrypt pdecrypt; |
60 | static struct kset *pcrypt_kset; | 59 | static struct kset *pcrypt_kset; |
61 | 60 | ||
62 | struct pcrypt_instance_ctx { | 61 | struct pcrypt_instance_ctx { |
@@ -70,7 +69,7 @@ struct pcrypt_aead_ctx { | |||
70 | }; | 69 | }; |
71 | 70 | ||
72 | static int pcrypt_do_parallel(struct padata_priv *padata, unsigned int *cb_cpu, | 71 | static int pcrypt_do_parallel(struct padata_priv *padata, unsigned int *cb_cpu, |
73 | struct pcrypt_instance *pcrypt) | 72 | struct padata_pcrypt *pcrypt) |
74 | { | 73 | { |
75 | unsigned int cpu_index, cpu, i; | 74 | unsigned int cpu_index, cpu, i; |
76 | struct pcrypt_cpumask *cpumask; | 75 | struct pcrypt_cpumask *cpumask; |
@@ -408,13 +407,13 @@ static void pcrypt_free(struct crypto_instance *inst) | |||
408 | static int pcrypt_cpumask_change_notify(struct notifier_block *self, | 407 | static int pcrypt_cpumask_change_notify(struct notifier_block *self, |
409 | unsigned long val, void *data) | 408 | unsigned long val, void *data) |
410 | { | 409 | { |
411 | struct pcrypt_instance *pcrypt; | 410 | struct padata_pcrypt *pcrypt; |
412 | struct pcrypt_cpumask *new_mask, *old_mask; | 411 | struct pcrypt_cpumask *new_mask, *old_mask; |
413 | 412 | ||
414 | if (!(val & PADATA_CPU_SERIAL)) | 413 | if (!(val & PADATA_CPU_SERIAL)) |
415 | return 0; | 414 | return 0; |
416 | 415 | ||
417 | pcrypt = container_of(self, struct pcrypt_instance, nblock); | 416 | pcrypt = container_of(self, struct padata_pcrypt, nblock); |
418 | new_mask = kmalloc(sizeof(*new_mask), GFP_KERNEL); | 417 | new_mask = kmalloc(sizeof(*new_mask), GFP_KERNEL); |
419 | if (!new_mask) | 418 | if (!new_mask) |
420 | return -ENOMEM; | 419 | return -ENOMEM; |
@@ -446,13 +445,12 @@ static int pcrypt_sysfs_add(struct padata_instance *pinst, const char *name) | |||
446 | return ret; | 445 | return ret; |
447 | } | 446 | } |
448 | 447 | ||
449 | static int __pcrypt_init_instance(struct pcrypt_instance *pcrypt, | 448 | static int pcrypt_init_padata(struct padata_pcrypt *pcrypt, |
450 | const char *name) | 449 | const char *name) |
451 | { | 450 | { |
452 | int ret = -ENOMEM; | 451 | int ret = -ENOMEM; |
453 | struct pcrypt_cpumask *mask; | 452 | struct pcrypt_cpumask *mask; |
454 | 453 | ||
455 | pcrypt->name = name; | ||
456 | pcrypt->wq = create_workqueue(name); | 454 | pcrypt->wq = create_workqueue(name); |
457 | if (!pcrypt->wq) | 455 | if (!pcrypt->wq) |
458 | goto err; | 456 | goto err; |
@@ -495,7 +493,7 @@ err: | |||
495 | return ret; | 493 | return ret; |
496 | } | 494 | } |
497 | 495 | ||
498 | static void __pcrypt_deinit_instance(struct pcrypt_instance *pcrypt) | 496 | static void pcrypt_fini_padata(struct padata_pcrypt *pcrypt) |
499 | { | 497 | { |
500 | kobject_put(&pcrypt->pinst->kobj); | 498 | kobject_put(&pcrypt->pinst->kobj); |
501 | free_cpumask_var(pcrypt->cb_cpumask->mask); | 499 | free_cpumask_var(pcrypt->cb_cpumask->mask); |
@@ -522,11 +520,11 @@ static int __init pcrypt_init(void) | |||
522 | if (!pcrypt_kset) | 520 | if (!pcrypt_kset) |
523 | goto err; | 521 | goto err; |
524 | 522 | ||
525 | err = __pcrypt_init_instance(&pencrypt, "pencrypt"); | 523 | err = pcrypt_init_padata(&pencrypt, "pencrypt"); |
526 | if (err) | 524 | if (err) |
527 | goto err_unreg_kset; | 525 | goto err_unreg_kset; |
528 | 526 | ||
529 | err = __pcrypt_init_instance(&pdecrypt, "pdecrypt"); | 527 | err = pcrypt_init_padata(&pdecrypt, "pdecrypt"); |
530 | if (err) | 528 | if (err) |
531 | goto err_deinit_pencrypt; | 529 | goto err_deinit_pencrypt; |
532 | 530 | ||
@@ -536,7 +534,7 @@ static int __init pcrypt_init(void) | |||
536 | return crypto_register_template(&pcrypt_tmpl); | 534 | return crypto_register_template(&pcrypt_tmpl); |
537 | 535 | ||
538 | err_deinit_pencrypt: | 536 | err_deinit_pencrypt: |
539 | __pcrypt_deinit_instance(&pencrypt); | 537 | pcrypt_fini_padata(&pencrypt); |
540 | err_unreg_kset: | 538 | err_unreg_kset: |
541 | kset_unregister(pcrypt_kset); | 539 | kset_unregister(pcrypt_kset); |
542 | err: | 540 | err: |
@@ -545,8 +543,8 @@ err: | |||
545 | 543 | ||
546 | static void __exit pcrypt_exit(void) | 544 | static void __exit pcrypt_exit(void) |
547 | { | 545 | { |
548 | __pcrypt_deinit_instance(&pencrypt); | 546 | pcrypt_fini_padata(&pencrypt); |
549 | __pcrypt_deinit_instance(&pdecrypt); | 547 | pcrypt_fini_padata(&pdecrypt); |
550 | 548 | ||
551 | kset_unregister(pcrypt_kset); | 549 | kset_unregister(pcrypt_kset); |
552 | crypto_unregister_template(&pcrypt_tmpl); | 550 | crypto_unregister_template(&pcrypt_tmpl); |