diff options
author | Steffen Klassert <steffen.klassert@secunet.com> | 2010-07-27 01:18:46 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2010-07-31 07:53:06 -0400 |
commit | d3f64e46aa21dd86a239274d218ec286461bfa68 (patch) | |
tree | fe57ebde6e9007ba0fad7b315fde217d195e8c04 /crypto | |
parent | c57e842eff49b05c4642dd7cfb1e7aa62ab932fa (diff) |
crypto: pcrypt - Update pcrypt cpumask according to the padata cpumask notifier
The padata cpumask change notifier passes a padata_cpumask to the
notifier chain. So we use this cpumask instead of asking padata for
the cpumask.
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/pcrypt.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c index 77425530ee1..de3078215fe 100644 --- a/crypto/pcrypt.c +++ b/crypto/pcrypt.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/notifier.h> | 27 | #include <linux/notifier.h> |
28 | #include <linux/kobject.h> | 28 | #include <linux/kobject.h> |
29 | #include <linux/cpu.h> | ||
29 | #include <crypto/pcrypt.h> | 30 | #include <crypto/pcrypt.h> |
30 | 31 | ||
31 | struct padata_pcrypt { | 32 | struct padata_pcrypt { |
@@ -409,6 +410,7 @@ static int pcrypt_cpumask_change_notify(struct notifier_block *self, | |||
409 | { | 410 | { |
410 | struct padata_pcrypt *pcrypt; | 411 | struct padata_pcrypt *pcrypt; |
411 | struct pcrypt_cpumask *new_mask, *old_mask; | 412 | struct pcrypt_cpumask *new_mask, *old_mask; |
413 | struct padata_cpumask *cpumask = (struct padata_cpumask *)data; | ||
412 | 414 | ||
413 | if (!(val & PADATA_CPU_SERIAL)) | 415 | if (!(val & PADATA_CPU_SERIAL)) |
414 | return 0; | 416 | return 0; |
@@ -424,7 +426,7 @@ static int pcrypt_cpumask_change_notify(struct notifier_block *self, | |||
424 | 426 | ||
425 | old_mask = pcrypt->cb_cpumask; | 427 | old_mask = pcrypt->cb_cpumask; |
426 | 428 | ||
427 | padata_get_cpumask(pcrypt->pinst, PADATA_CPU_SERIAL, new_mask->mask); | 429 | cpumask_copy(new_mask->mask, cpumask->cbcpu); |
428 | rcu_assign_pointer(pcrypt->cb_cpumask, new_mask); | 430 | rcu_assign_pointer(pcrypt->cb_cpumask, new_mask); |
429 | synchronize_rcu_bh(); | 431 | synchronize_rcu_bh(); |
430 | 432 | ||
@@ -451,6 +453,8 @@ static int pcrypt_init_padata(struct padata_pcrypt *pcrypt, | |||
451 | int ret = -ENOMEM; | 453 | int ret = -ENOMEM; |
452 | struct pcrypt_cpumask *mask; | 454 | struct pcrypt_cpumask *mask; |
453 | 455 | ||
456 | get_online_cpus(); | ||
457 | |||
454 | pcrypt->wq = create_workqueue(name); | 458 | pcrypt->wq = create_workqueue(name); |
455 | if (!pcrypt->wq) | 459 | if (!pcrypt->wq) |
456 | goto err; | 460 | goto err; |
@@ -467,7 +471,7 @@ static int pcrypt_init_padata(struct padata_pcrypt *pcrypt, | |||
467 | goto err_free_padata; | 471 | goto err_free_padata; |
468 | } | 472 | } |
469 | 473 | ||
470 | padata_get_cpumask(pcrypt->pinst, PADATA_CPU_SERIAL, mask->mask); | 474 | cpumask_and(mask->mask, cpu_possible_mask, cpu_active_mask); |
471 | rcu_assign_pointer(pcrypt->cb_cpumask, mask); | 475 | rcu_assign_pointer(pcrypt->cb_cpumask, mask); |
472 | 476 | ||
473 | pcrypt->nblock.notifier_call = pcrypt_cpumask_change_notify; | 477 | pcrypt->nblock.notifier_call = pcrypt_cpumask_change_notify; |
@@ -479,7 +483,10 @@ static int pcrypt_init_padata(struct padata_pcrypt *pcrypt, | |||
479 | if (ret) | 483 | if (ret) |
480 | goto err_unregister_notifier; | 484 | goto err_unregister_notifier; |
481 | 485 | ||
486 | put_online_cpus(); | ||
487 | |||
482 | return ret; | 488 | return ret; |
489 | |||
483 | err_unregister_notifier: | 490 | err_unregister_notifier: |
484 | padata_unregister_cpumask_notifier(pcrypt->pinst, &pcrypt->nblock); | 491 | padata_unregister_cpumask_notifier(pcrypt->pinst, &pcrypt->nblock); |
485 | err_free_cpumask: | 492 | err_free_cpumask: |
@@ -490,6 +497,8 @@ err_free_padata: | |||
490 | err_destroy_workqueue: | 497 | err_destroy_workqueue: |
491 | destroy_workqueue(pcrypt->wq); | 498 | destroy_workqueue(pcrypt->wq); |
492 | err: | 499 | err: |
500 | put_online_cpus(); | ||
501 | |||
493 | return ret; | 502 | return ret; |
494 | } | 503 | } |
495 | 504 | ||