1 From 93fbe7c21a64d22ac057fc9e8eed5967f5d0bd88 Mon Sep 17 00:00:00 2001
2 From: Andrey Smirnov <andrew.smirnov@gmail.com>
3 Date: Tue, 22 Oct 2019 08:30:09 -0700
4 Subject: [PATCH] crypto: caam - use devres to remove debugfs
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 Use devres to remove debugfs and drop corresponding
10 debugfs_remove_recursive() call.
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 eceb5daf9ebaa564a65eb2d9d5a4682a33747300)
24 drivers/crypto/caam/ctrl.c | 21 ++++++++++++++-------
25 drivers/crypto/caam/intern.h | 1 -
26 2 files changed, 14 insertions(+), 8 deletions(-)
28 --- a/drivers/crypto/caam/ctrl.c
29 +++ b/drivers/crypto/caam/ctrl.c
30 @@ -327,11 +327,6 @@ static int caam_remove(struct platform_d
31 if (!ctrlpriv->mc_en && ctrlpriv->rng4_sh_init)
32 deinstantiate_rng(ctrldev, ctrlpriv->rng4_sh_init);
34 - /* Shut down debug views */
35 -#ifdef CONFIG_DEBUG_FS
36 - debugfs_remove_recursive(ctrlpriv->dfs_root);
42 @@ -563,6 +558,13 @@ static int init_clocks(struct device *de
43 return devm_add_action_or_reset(dev, disable_clocks, ctrlpriv);
46 +#ifdef CONFIG_DEBUG_FS
47 +static void caam_remove_debugfs(void *root)
49 + debugfs_remove_recursive(root);
53 /* Probe routine for CAAM top (controller) level */
54 static int caam_probe(struct platform_device *pdev)
56 @@ -575,6 +577,7 @@ static int caam_probe(struct platform_de
57 struct caam_drv_private *ctrlpriv;
58 #ifdef CONFIG_DEBUG_FS
59 struct caam_perfmon *perfmon;
60 + struct dentry *dfs_root;
62 u32 scfgr, comp_params;
64 @@ -726,8 +729,12 @@ static int caam_probe(struct platform_de
66 perfmon = (struct caam_perfmon __force *)&ctrl->perfmon;
68 - ctrlpriv->dfs_root = debugfs_create_dir(dev_name(dev), NULL);
69 - ctrlpriv->ctl = debugfs_create_dir("ctl", ctrlpriv->dfs_root);
70 + dfs_root = debugfs_create_dir(dev_name(dev), NULL);
71 + ret = devm_add_action_or_reset(dev, caam_remove_debugfs, dfs_root);
75 + ctrlpriv->ctl = debugfs_create_dir("ctl", dfs_root);
78 /* Check to see if (DPAA 1.x) QI present. If so, enable */
79 --- a/drivers/crypto/caam/intern.h
80 +++ b/drivers/crypto/caam/intern.h
81 @@ -102,7 +102,6 @@ struct caam_drv_private {
82 * variables at runtime.
84 #ifdef CONFIG_DEBUG_FS
85 - struct dentry *dfs_root;
86 struct dentry *ctl; /* controller dir */
87 struct debugfs_blob_wrapper ctl_kek_wrap, ctl_tkek_wrap, ctl_tdsk_wrap;