diff options
author | Steffen Klassert <steffen.klassert@secunet.com> | 2010-07-07 09:32:02 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2010-07-14 08:29:29 -0400 |
commit | 83f619f3c8abb82cac9158cf23c656ec5c184607 (patch) | |
tree | 552107eeccfdb89eeb2d387280dd487a737299e0 | |
parent | 33e54450683c5e970ac007489d7921ba792d093c (diff) |
padata: make padata_do_parallel to return zero on success
To return -EINPROGRESS on success in padata_do_parallel was
considered to be odd. This patch changes this to return zero
on success. Also the only user of padata, pcrypt is adapted to
convert a return of zero to -EINPROGRESS within the crypto layer.
This also removes the pcrypt fallback if padata_do_parallel
was called on a not running padata instance as we can't handle it
anymore. This fallback was unused, so it's save to remove it.
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | crypto/pcrypt.c | 18 | ||||
-rw-r--r-- | kernel/padata.c | 11 |
2 files changed, 11 insertions, 18 deletions
diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c index 71ae2b2ae33b..6036b6de9079 100644 --- a/crypto/pcrypt.c +++ b/crypto/pcrypt.c | |||
@@ -143,10 +143,8 @@ static int pcrypt_aead_encrypt(struct aead_request *req) | |||
143 | aead_request_set_assoc(creq, req->assoc, req->assoclen); | 143 | aead_request_set_assoc(creq, req->assoc, req->assoclen); |
144 | 144 | ||
145 | err = pcrypt_do_parallel(padata, &ctx->cb_cpu, pcrypt_enc_padata); | 145 | err = pcrypt_do_parallel(padata, &ctx->cb_cpu, pcrypt_enc_padata); |
146 | if (err) | 146 | if (!err) |
147 | return err; | 147 | return -EINPROGRESS; |
148 | else | ||
149 | err = crypto_aead_encrypt(creq); | ||
150 | 148 | ||
151 | return err; | 149 | return err; |
152 | } | 150 | } |
@@ -187,10 +185,8 @@ static int pcrypt_aead_decrypt(struct aead_request *req) | |||
187 | aead_request_set_assoc(creq, req->assoc, req->assoclen); | 185 | aead_request_set_assoc(creq, req->assoc, req->assoclen); |
188 | 186 | ||
189 | err = pcrypt_do_parallel(padata, &ctx->cb_cpu, pcrypt_dec_padata); | 187 | err = pcrypt_do_parallel(padata, &ctx->cb_cpu, pcrypt_dec_padata); |
190 | if (err) | 188 | if (!err) |
191 | return err; | 189 | return -EINPROGRESS; |
192 | else | ||
193 | err = crypto_aead_decrypt(creq); | ||
194 | 190 | ||
195 | return err; | 191 | return err; |
196 | } | 192 | } |
@@ -233,10 +229,8 @@ static int pcrypt_aead_givencrypt(struct aead_givcrypt_request *req) | |||
233 | aead_givcrypt_set_giv(creq, req->giv, req->seq); | 229 | aead_givcrypt_set_giv(creq, req->giv, req->seq); |
234 | 230 | ||
235 | err = pcrypt_do_parallel(padata, &ctx->cb_cpu, pcrypt_enc_padata); | 231 | err = pcrypt_do_parallel(padata, &ctx->cb_cpu, pcrypt_enc_padata); |
236 | if (err) | 232 | if (!err) |
237 | return err; | 233 | return -EINPROGRESS; |
238 | else | ||
239 | err = crypto_aead_givencrypt(creq); | ||
240 | 234 | ||
241 | return err; | 235 | return err; |
242 | } | 236 | } |
diff --git a/kernel/padata.c b/kernel/padata.c index 57ec4eb5f2e3..ae8defcf0622 100644 --- a/kernel/padata.c +++ b/kernel/padata.c | |||
@@ -111,10 +111,13 @@ int padata_do_parallel(struct padata_instance *pinst, | |||
111 | 111 | ||
112 | pd = rcu_dereference(pinst->pd); | 112 | pd = rcu_dereference(pinst->pd); |
113 | 113 | ||
114 | err = 0; | 114 | err = -EINVAL; |
115 | if (!(pinst->flags & PADATA_INIT)) | 115 | if (!(pinst->flags & PADATA_INIT)) |
116 | goto out; | 116 | goto out; |
117 | 117 | ||
118 | if (!cpumask_test_cpu(cb_cpu, pd->cpumask)) | ||
119 | goto out; | ||
120 | |||
118 | err = -EBUSY; | 121 | err = -EBUSY; |
119 | if ((pinst->flags & PADATA_RESET)) | 122 | if ((pinst->flags & PADATA_RESET)) |
120 | goto out; | 123 | goto out; |
@@ -122,11 +125,7 @@ int padata_do_parallel(struct padata_instance *pinst, | |||
122 | if (atomic_read(&pd->refcnt) >= MAX_OBJ_NUM) | 125 | if (atomic_read(&pd->refcnt) >= MAX_OBJ_NUM) |
123 | goto out; | 126 | goto out; |
124 | 127 | ||
125 | err = -EINVAL; | 128 | err = 0; |
126 | if (!cpumask_test_cpu(cb_cpu, pd->cpumask)) | ||
127 | goto out; | ||
128 | |||
129 | err = -EINPROGRESS; | ||
130 | atomic_inc(&pd->refcnt); | 129 | atomic_inc(&pd->refcnt); |
131 | padata->pd = pd; | 130 | padata->pd = pd; |
132 | padata->cb_cpu = cb_cpu; | 131 | padata->cb_cpu = cb_cpu; |