Skip to content

Commit eceb5da

Browse files
ndreysherbertx
authored andcommitted
crypto: caam - use devres to remove debugfs
Use devres to remove debugfs and drop corresponding debugfs_remove_recursive() call. Signed-off-by: Andrey Smirnov <[email protected]> Reviewed-by: Horia Geantă <[email protected]> Cc: Chris Healy <[email protected]> Cc: Lucas Stach <[email protected]> Cc: Horia Geantă <[email protected]> Cc: Herbert Xu <[email protected]> Cc: Iuliana Prodan <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Herbert Xu <[email protected]>
1 parent 66e93b2 commit eceb5da

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

drivers/crypto/caam/ctrl.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -327,11 +327,6 @@ static int caam_remove(struct platform_device *pdev)
327327
if (!ctrlpriv->mc_en && ctrlpriv->rng4_sh_init)
328328
deinstantiate_rng(ctrldev, ctrlpriv->rng4_sh_init);
329329

330-
/* Shut down debug views */
331-
#ifdef CONFIG_DEBUG_FS
332-
debugfs_remove_recursive(ctrlpriv->dfs_root);
333-
#endif
334-
335330
return 0;
336331
}
337332

@@ -563,6 +558,13 @@ static int init_clocks(struct device *dev, const struct caam_imx_data *data)
563558
return devm_add_action_or_reset(dev, disable_clocks, ctrlpriv);
564559
}
565560

561+
#ifdef CONFIG_DEBUG_FS
562+
static void caam_remove_debugfs(void *root)
563+
{
564+
debugfs_remove_recursive(root);
565+
}
566+
#endif
567+
566568
/* Probe routine for CAAM top (controller) level */
567569
static int caam_probe(struct platform_device *pdev)
568570
{
@@ -575,6 +577,7 @@ static int caam_probe(struct platform_device *pdev)
575577
struct caam_drv_private *ctrlpriv;
576578
#ifdef CONFIG_DEBUG_FS
577579
struct caam_perfmon *perfmon;
580+
struct dentry *dfs_root;
578581
#endif
579582
u32 scfgr, comp_params;
580583
u8 rng_vid;
@@ -728,8 +731,12 @@ static int caam_probe(struct platform_device *pdev)
728731
*/
729732
perfmon = (struct caam_perfmon __force *)&ctrl->perfmon;
730733

731-
ctrlpriv->dfs_root = debugfs_create_dir(dev_name(dev), NULL);
732-
ctrlpriv->ctl = debugfs_create_dir("ctl", ctrlpriv->dfs_root);
734+
dfs_root = debugfs_create_dir(dev_name(dev), NULL);
735+
ret = devm_add_action_or_reset(dev, caam_remove_debugfs, dfs_root);
736+
if (ret)
737+
return ret;
738+
739+
ctrlpriv->ctl = debugfs_create_dir("ctl", dfs_root);
733740
#endif
734741

735742
/* Check to see if (DPAA 1.x) QI present. If so, enable */

drivers/crypto/caam/intern.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ struct caam_drv_private {
102102
* variables at runtime.
103103
*/
104104
#ifdef CONFIG_DEBUG_FS
105-
struct dentry *dfs_root;
106105
struct dentry *ctl; /* controller dir */
107106
struct debugfs_blob_wrapper ctl_kek_wrap, ctl_tkek_wrap, ctl_tdsk_wrap;
108107
#endif

0 commit comments

Comments
 (0)