diff options
Diffstat (limited to 'drivers/crypto/caam/caamrng.c')
-rw-r--r-- | drivers/crypto/caam/caamrng.c | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/drivers/crypto/caam/caamrng.c b/drivers/crypto/caam/caamrng.c index d1939a9539c0..28486b19fc36 100644 --- a/drivers/crypto/caam/caamrng.c +++ b/drivers/crypto/caam/caamrng.c | |||
@@ -273,34 +273,23 @@ static struct hwrng caam_rng = { | |||
273 | 273 | ||
274 | static void __exit caam_rng_exit(void) | 274 | static void __exit caam_rng_exit(void) |
275 | { | 275 | { |
276 | caam_jr_free(rng_ctx.jrdev); | ||
276 | hwrng_unregister(&caam_rng); | 277 | hwrng_unregister(&caam_rng); |
277 | } | 278 | } |
278 | 279 | ||
279 | static int __init caam_rng_init(void) | 280 | static int __init caam_rng_init(void) |
280 | { | 281 | { |
281 | struct device_node *dev_node; | 282 | struct device *dev; |
282 | struct platform_device *pdev; | ||
283 | struct device *ctrldev; | ||
284 | struct caam_drv_private *priv; | ||
285 | |||
286 | dev_node = of_find_compatible_node(NULL, NULL, "fsl,sec-v4.0"); | ||
287 | if (!dev_node) { | ||
288 | dev_node = of_find_compatible_node(NULL, NULL, "fsl,sec4.0"); | ||
289 | if (!dev_node) | ||
290 | return -ENODEV; | ||
291 | } | ||
292 | |||
293 | pdev = of_find_device_by_node(dev_node); | ||
294 | if (!pdev) | ||
295 | return -ENODEV; | ||
296 | 283 | ||
297 | ctrldev = &pdev->dev; | 284 | dev = caam_jr_alloc(); |
298 | priv = dev_get_drvdata(ctrldev); | 285 | if (IS_ERR(dev)) { |
299 | of_node_put(dev_node); | 286 | pr_err("Job Ring Device allocation for transform failed\n"); |
287 | return PTR_ERR(dev); | ||
288 | } | ||
300 | 289 | ||
301 | caam_init_rng(&rng_ctx, priv->jrdev[0]); | 290 | caam_init_rng(&rng_ctx, dev); |
302 | 291 | ||
303 | dev_info(priv->jrdev[0], "registering rng-caam\n"); | 292 | dev_info(dev, "registering rng-caam\n"); |
304 | return hwrng_register(&caam_rng); | 293 | return hwrng_register(&caam_rng); |
305 | } | 294 | } |
306 | 295 | ||