diff mbox series

[v2] crypto: caam/qi - execute library only on DPAA 1.x

Message ID 20190805124955.11751-1-horia.geanta@nxp.com (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series [v2] crypto: caam/qi - execute library only on DPAA 1.x | expand

Commit Message

Horia Geanta Aug. 5, 2019, 12:49 p.m. UTC
In the process of turning caam/qi into a library, the check of
MCFGR[QI] bit has been inadvertently dropped.
Fix the condition for DPAA 1.x QI detection, which should be:
MCFGR[QI] && !MCFGR[DPAA2]

A check in the library exit point is currently not needed,
since the list of registered algorithms is empty.

While here, silence the library initialization abort - since jr.c
calls it unconditionally.

Fixes: 1b46c90c8e00 ("crypto: caam - convert top level drivers to libraries")
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
---
v2: dropped check at library exit point

 drivers/crypto/caam/caamalg_qi.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Herbert Xu Aug. 15, 2019, 12:05 p.m. UTC | #1
On Mon, Aug 05, 2019 at 03:49:55PM +0300, Horia Geantă wrote:
> In the process of turning caam/qi into a library, the check of
> MCFGR[QI] bit has been inadvertently dropped.
> Fix the condition for DPAA 1.x QI detection, which should be:
> MCFGR[QI] && !MCFGR[DPAA2]
> 
> A check in the library exit point is currently not needed,
> since the list of registered algorithms is empty.
> 
> While here, silence the library initialization abort - since jr.c
> calls it unconditionally.
> 
> Fixes: 1b46c90c8e00 ("crypto: caam - convert top level drivers to libraries")
> Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
> ---
> v2: dropped check at library exit point
> 
>  drivers/crypto/caam/caamalg_qi.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)

Patch applied.  Thanks.
diff mbox series

Patch

diff --git a/drivers/crypto/caam/caamalg_qi.c b/drivers/crypto/caam/caamalg_qi.c
index 32f0f8a72067..d470724bcddf 100644
--- a/drivers/crypto/caam/caamalg_qi.c
+++ b/drivers/crypto/caam/caamalg_qi.c
@@ -2523,10 +2523,9 @@  int caam_qi_algapi_init(struct device *ctrldev)
 	unsigned int md_limit = SHA512_DIGEST_SIZE;
 	bool registered = false;
 
-	if (caam_dpaa2) {
-		dev_info(ctrldev, "caam/qi frontend driver not suitable for DPAA 2.x, aborting...\n");
-		return -ENODEV;
-	}
+	/* Make sure this runs only on (DPAA 1.x) QI */
+	if (!priv->qi_present || caam_dpaa2)
+		return 0;
 
 	/*
 	 * Register crypto algorithms the device supports.