1 From 7200bc3a88315a59e7094bf111c7816f0298923f Mon Sep 17 00:00:00 2001
2 From: Andrey Smirnov <andrew.smirnov@gmail.com>
3 Date: Tue, 22 Oct 2019 08:30:12 -0700
4 Subject: [PATCH] crypto: caam - use devres to populate platform devices
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 Use devres to de-initialize the RNG and drop explicit de-initialization
10 code in caam_remove().
12 Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
13 Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
14 Cc: Chris Healy <cphealy@gmail.com>
15 Cc: Lucas Stach <l.stach@pengutronix.de>
16 Cc: Horia Geantă <horia.geanta@nxp.com>
17 Cc: Herbert Xu <herbert@gondor.apana.org.au>
18 Cc: Iuliana Prodan <iuliana.prodan@nxp.com>
19 Cc: linux-crypto@vger.kernel.org
20 Cc: linux-kernel@vger.kernel.org
21 Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
22 (cherry picked from commit 1a1c4f004444ebb962a02b7fc6d534e0f2ed9acb)
24 drivers/crypto/caam/ctrl.c | 26 +++-----------------------
25 1 file changed, 3 insertions(+), 23 deletions(-)
27 --- a/drivers/crypto/caam/ctrl.c
28 +++ b/drivers/crypto/caam/ctrl.c
29 @@ -321,20 +321,6 @@ static int instantiate_rng(struct device
33 -static int caam_remove(struct platform_device *pdev)
35 - struct device *ctrldev;
36 - struct caam_drv_private *ctrlpriv;
38 - ctrldev = &pdev->dev;
39 - ctrlpriv = dev_get_drvdata(ctrldev);
41 - /* Remove platform devices under the crypto node */
42 - of_platform_depopulate(ctrldev);
48 * kick_trng - sets the various parameters for enabling the initialization
49 * of the RNG4 block in CAAM
50 @@ -759,7 +745,7 @@ static int caam_probe(struct platform_de
54 - ret = of_platform_populate(nprop, caam_match, NULL, dev);
55 + ret = devm_of_platform_populate(dev);
57 dev_err(dev, "JR platform devices creation error\n");
59 @@ -781,8 +767,7 @@ static int caam_probe(struct platform_de
60 /* If no QI and no rings specified, quit and go home */
61 if ((!ctrlpriv->qi_present) && (!ctrlpriv->total_jobrs)) {
62 dev_err(dev, "no queues configured, terminating\n");
68 if (ctrlpriv->era < 10)
69 @@ -845,7 +830,7 @@ static int caam_probe(struct platform_de
70 } while ((ret == -EAGAIN) && (ent_delay < RTSDCTL_ENT_DLY_MAX));
72 dev_err(dev, "failed to instantiate RNG");
77 * Set handles init'ed by this module as the complement of the
78 @@ -919,10 +904,6 @@ static int caam_probe(struct platform_de
79 &ctrlpriv->ctl_tdsk_wrap);
88 static struct platform_driver caam_driver = {
89 @@ -931,7 +912,6 @@ static struct platform_driver caam_drive
90 .of_match_table = caam_match,
93 - .remove = caam_remove,
96 module_platform_driver(caam_driver);