aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuan Kang <Yuan.Kang@freescale.com>2012-06-22 20:48:44 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2012-06-27 02:42:04 -0400
commit8009a383f28e853df1a1b08d405ccf67ba860fcc (patch)
tree6a4c5ecdfb870fa7067ab892bc576f769198d23d
parent6ec47334935ffbc3eccc227ed22ab716be9942f1 (diff)
crypto: caam - remove jr register/deregister
remove caam_jr_register and caam_jr_deregister to allow sharing of job rings. Signed-off-by: Yuan Kang <Yuan.Kang@freescale.com> Signed-off-by: Kim Phillips <kim.phillips@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--drivers/crypto/caam/caamalg.c30
-rw-r--r--drivers/crypto/caam/intern.h2
2 files changed, 2 insertions, 30 deletions
diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c
index d0f8df1dcec3..a4e266f928c2 100644
--- a/drivers/crypto/caam/caamalg.c
+++ b/drivers/crypto/caam/caamalg.c
@@ -2228,7 +2228,7 @@ static int caam_cra_init(struct crypto_tfm *tfm)
2228 * distribute tfms across job rings to ensure in-order 2228 * distribute tfms across job rings to ensure in-order
2229 * crypto request processing per tfm 2229 * crypto request processing per tfm
2230 */ 2230 */
2231 ctx->jrdev = priv->algapi_jr[(tgt_jr / 2) % priv->num_jrs_for_algapi]; 2231 ctx->jrdev = priv->jrdev[(tgt_jr / 2) % priv->total_jobrs];
2232 2232
2233 /* copy descriptor header template value */ 2233 /* copy descriptor header template value */
2234 ctx->class1_alg_type = OP_TYPE_CLASS1_ALG | caam_alg->class1_alg_type; 2234 ctx->class1_alg_type = OP_TYPE_CLASS1_ALG | caam_alg->class1_alg_type;
@@ -2265,7 +2265,6 @@ static void __exit caam_algapi_exit(void)
2265 struct device *ctrldev; 2265 struct device *ctrldev;
2266 struct caam_drv_private *priv; 2266 struct caam_drv_private *priv;
2267 struct caam_crypto_alg *t_alg, *n; 2267 struct caam_crypto_alg *t_alg, *n;
2268 int i, err;
2269 2268
2270 dev_node = of_find_compatible_node(NULL, NULL, "fsl,sec-v4.0"); 2269 dev_node = of_find_compatible_node(NULL, NULL, "fsl,sec-v4.0");
2271 if (!dev_node) { 2270 if (!dev_node) {
@@ -2290,13 +2289,6 @@ static void __exit caam_algapi_exit(void)
2290 list_del(&t_alg->entry); 2289 list_del(&t_alg->entry);
2291 kfree(t_alg); 2290 kfree(t_alg);
2292 } 2291 }
2293
2294 for (i = 0; i < priv->total_jobrs; i++) {
2295 err = caam_jr_deregister(priv->algapi_jr[i]);
2296 if (err < 0)
2297 break;
2298 }
2299 kfree(priv->algapi_jr);
2300} 2292}
2301 2293
2302static struct caam_crypto_alg *caam_alg_alloc(struct device *ctrldev, 2294static struct caam_crypto_alg *caam_alg_alloc(struct device *ctrldev,
@@ -2349,7 +2341,7 @@ static int __init caam_algapi_init(void)
2349{ 2341{
2350 struct device_node *dev_node; 2342 struct device_node *dev_node;
2351 struct platform_device *pdev; 2343 struct platform_device *pdev;
2352 struct device *ctrldev, **jrdev; 2344 struct device *ctrldev;
2353 struct caam_drv_private *priv; 2345 struct caam_drv_private *priv;
2354 int i = 0, err = 0; 2346 int i = 0, err = 0;
2355 2347
@@ -2370,24 +2362,6 @@ static int __init caam_algapi_init(void)
2370 2362
2371 INIT_LIST_HEAD(&priv->alg_list); 2363 INIT_LIST_HEAD(&priv->alg_list);
2372 2364
2373 jrdev = kmalloc(sizeof(*jrdev) * priv->total_jobrs, GFP_KERNEL);
2374 if (!jrdev)
2375 return -ENOMEM;
2376
2377 for (i = 0; i < priv->total_jobrs; i++) {
2378 err = caam_jr_register(ctrldev, &jrdev[i]);
2379 if (err < 0)
2380 break;
2381 }
2382 if (err < 0 && i == 0) {
2383 dev_err(ctrldev, "algapi error in job ring registration: %d\n",
2384 err);
2385 kfree(jrdev);
2386 return err;
2387 }
2388
2389 priv->num_jrs_for_algapi = i;
2390 priv->algapi_jr = jrdev;
2391 atomic_set(&priv->tfm_count, -1); 2365 atomic_set(&priv->tfm_count, -1);
2392 2366
2393 /* register crypto algorithms the device supports */ 2367 /* register crypto algorithms the device supports */
diff --git a/drivers/crypto/caam/intern.h b/drivers/crypto/caam/intern.h
index a34be01b0b29..462be99d9a3c 100644
--- a/drivers/crypto/caam/intern.h
+++ b/drivers/crypto/caam/intern.h
@@ -86,8 +86,6 @@ struct caam_drv_private {
86 86
87 /* which jr allocated to scatterlist crypto */ 87 /* which jr allocated to scatterlist crypto */
88 atomic_t tfm_count ____cacheline_aligned; 88 atomic_t tfm_count ____cacheline_aligned;
89 int num_jrs_for_algapi;
90 struct device **algapi_jr;
91 /* list of registered crypto algorithms (mk generic context handle?) */ 89 /* list of registered crypto algorithms (mk generic context handle?) */
92 struct list_head alg_list; 90 struct list_head alg_list;
93 91