Skip to content

Commit f414de2

Browse files
ndreysherbertx
authored andcommitted
crypto: caam - use devres to de-initialize QI
Use devres to de-initialize the QI and drop explicit de-initialization code in caam_remove(). 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 e57acaf commit f414de2

File tree

4 files changed

+7
-19
lines changed

4 files changed

+7
-19
lines changed

drivers/crypto/caam/ctrl.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -332,11 +332,6 @@ static int caam_remove(struct platform_device *pdev)
332332
/* Remove platform devices under the crypto node */
333333
of_platform_depopulate(ctrldev);
334334

335-
#ifdef CONFIG_CAAM_QI
336-
if (ctrlpriv->qi_init)
337-
caam_qi_shutdown(ctrldev);
338-
#endif
339-
340335
return 0;
341336
}
342337

@@ -769,7 +764,7 @@ static int caam_probe(struct platform_device *pdev)
769764
ret = of_platform_populate(nprop, caam_match, NULL, dev);
770765
if (ret) {
771766
dev_err(dev, "JR platform devices creation error\n");
772-
goto shutdown_qi;
767+
return ret;
773768
}
774769

775770
ring = 0;
@@ -930,13 +925,6 @@ static int caam_probe(struct platform_device *pdev)
930925
caam_remove:
931926
caam_remove(pdev);
932927
return ret;
933-
934-
shutdown_qi:
935-
#ifdef CONFIG_CAAM_QI
936-
if (ctrlpriv->qi_init)
937-
caam_qi_shutdown(dev);
938-
#endif
939-
return ret;
940928
}
941929

942930
static struct platform_driver caam_driver = {

drivers/crypto/caam/intern.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,6 @@ struct caam_drv_private {
8181
*/
8282
u8 total_jobrs; /* Total Job Rings in device */
8383
u8 qi_present; /* Nonzero if QI present in device */
84-
#ifdef CONFIG_CAAM_QI
85-
u8 qi_init; /* Nonzero if QI has been initialized */
86-
#endif
8784
u8 mc_en; /* Nonzero if MC f/w is active */
8885
int secvio_irq; /* Security violation interrupt number */
8986
int virt_en; /* Virtualization enabled in CAAM */

drivers/crypto/caam/qi.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,9 +500,10 @@ void caam_drv_ctx_rel(struct caam_drv_ctx *drv_ctx)
500500
}
501501
EXPORT_SYMBOL(caam_drv_ctx_rel);
502502

503-
void caam_qi_shutdown(struct device *qidev)
503+
static void caam_qi_shutdown(void *data)
504504
{
505505
int i;
506+
struct device *qidev = data;
506507
struct caam_qi_priv *priv = &qipriv;
507508
const cpumask_t *cpus = qman_affine_cpus();
508509

@@ -761,7 +762,10 @@ int caam_qi_init(struct platform_device *caam_pdev)
761762
&times_congested, &caam_fops_u64_ro);
762763
#endif
763764

764-
ctrlpriv->qi_init = 1;
765+
err = devm_add_action_or_reset(qidev, caam_qi_shutdown, ctrlpriv);
766+
if (err)
767+
return err;
768+
765769
dev_info(qidev, "Linux CAAM Queue I/F driver initialised\n");
766770
return 0;
767771
}

drivers/crypto/caam/qi.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ int caam_drv_ctx_update(struct caam_drv_ctx *drv_ctx, u32 *sh_desc);
147147
void caam_drv_ctx_rel(struct caam_drv_ctx *drv_ctx);
148148

149149
int caam_qi_init(struct platform_device *pdev);
150-
void caam_qi_shutdown(struct device *dev);
151150

152151
/**
153152
* qi_cache_alloc - Allocate buffers from CAAM-QI cache

0 commit comments

Comments
 (0)