aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/api.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2006-05-27 19:05:24 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2006-09-20 21:16:29 -0400
commit72fa491912689ca69dd15f4266945d2c2f2819f8 (patch)
treec117b6ccdd08c73694261aac0b7f43fdf27c861c /crypto/api.c
parenteaf44088ff467410dd15a033fef118888002ffe6 (diff)
[CRYPTO] api: Rename crypto_alg_get to crypto_mod_get
The functions crypto_alg_get and crypto_alg_put operates on the crypto modules rather than the algorithms. Therefore it makes sense to call them crypto_mod_get and crypto_alg_put respectively. This is needed because we need to have real algorithm reference counters for parameterised algorithms as they can be unregistered from below by when their parameter algorithms are themselves unregistered. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'crypto/api.c')
-rw-r--r--crypto/api.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/crypto/api.c b/crypto/api.c
index c11ec1fd4f18..8c2743a05f90 100644
--- a/crypto/api.c
+++ b/crypto/api.c
@@ -29,12 +29,12 @@
29LIST_HEAD(crypto_alg_list); 29LIST_HEAD(crypto_alg_list);
30DECLARE_RWSEM(crypto_alg_sem); 30DECLARE_RWSEM(crypto_alg_sem);
31 31
32static inline int crypto_alg_get(struct crypto_alg *alg) 32static inline int crypto_mod_get(struct crypto_alg *alg)
33{ 33{
34 return try_module_get(alg->cra_module); 34 return try_module_get(alg->cra_module);
35} 35}
36 36
37static inline void crypto_alg_put(struct crypto_alg *alg) 37static inline void crypto_mod_put(struct crypto_alg *alg)
38{ 38{
39 module_put(alg->cra_module); 39 module_put(alg->cra_module);
40} 40}
@@ -57,12 +57,12 @@ static struct crypto_alg *crypto_alg_lookup(const char *name)
57 if (!exact && !(fuzzy && q->cra_priority > best)) 57 if (!exact && !(fuzzy && q->cra_priority > best))
58 continue; 58 continue;
59 59
60 if (unlikely(!crypto_alg_get(q))) 60 if (unlikely(!crypto_mod_get(q)))
61 continue; 61 continue;
62 62
63 best = q->cra_priority; 63 best = q->cra_priority;
64 if (alg) 64 if (alg)
65 crypto_alg_put(alg); 65 crypto_mod_put(alg);
66 alg = q; 66 alg = q;
67 67
68 if (exact) 68 if (exact)
@@ -202,7 +202,7 @@ out_free_tfm:
202 kfree(tfm); 202 kfree(tfm);
203 tfm = NULL; 203 tfm = NULL;
204out_put: 204out_put:
205 crypto_alg_put(alg); 205 crypto_mod_put(alg);
206out: 206out:
207 return tfm; 207 return tfm;
208} 208}
@@ -221,7 +221,7 @@ void crypto_free_tfm(struct crypto_tfm *tfm)
221 if (alg->cra_exit) 221 if (alg->cra_exit)
222 alg->cra_exit(tfm); 222 alg->cra_exit(tfm);
223 crypto_exit_ops(tfm); 223 crypto_exit_ops(tfm);
224 crypto_alg_put(alg); 224 crypto_mod_put(alg);
225 memset(tfm, 0, size); 225 memset(tfm, 0, size);
226 kfree(tfm); 226 kfree(tfm);
227} 227}
@@ -305,7 +305,7 @@ int crypto_alg_available(const char *name, u32 flags)
305 struct crypto_alg *alg = crypto_alg_mod_lookup(name); 305 struct crypto_alg *alg = crypto_alg_mod_lookup(name);
306 306
307 if (alg) { 307 if (alg) {
308 crypto_alg_put(alg); 308 crypto_mod_put(alg);
309 ret = 1; 309 ret = 1;
310 } 310 }
311 311