lkml.org 
[lkml]   [2021]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v4 18/20] crypto: qce: Defer probing if BAM dma channel is not yet initialized
Date
Since the Qualcomm qce crypto driver needs the BAM dma driver to be
setup first (to allow crypto operations), it makes sense to defer
the qce crypto driver probing in case the BAM dma driver is not yet
probed.

Move the code leg requesting dma channels earlier in the
probe() flow. This fixes the qce probe failure issues when both qce
and BMA dma are compiled as static part of the kernel.

Cc: Thara Gopinath <thara.gopinath@linaro.org>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org>
---
drivers/crypto/qce/core.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c
index cb8c77709e1e..c6f686126fc9 100644
--- a/drivers/crypto/qce/core.c
+++ b/drivers/crypto/qce/core.c
@@ -209,9 +209,19 @@ static int qce_crypto_probe(struct platform_device *pdev)
if (ret < 0)
return ret;

+ /* qce driver requires BAM dma driver to be setup first.
+ * In case the dma channel are not set yet, this check
+ * helps use to return -EPROBE_DEFER earlier.
+ */
+ ret = qce_dma_request(qce->dev, &qce->dma);
+ if (ret)
+ return ret;
+
qce->mem_path = of_icc_get(qce->dev, "memory");
- if (IS_ERR(qce->mem_path))
+ if (IS_ERR(qce->mem_path)) {
+ qce_dma_release(&qce->dma);
return PTR_ERR(qce->mem_path);
+ }

qce->core = devm_clk_get_optional(qce->dev, "core");
if (IS_ERR(qce->core)) {
@@ -247,10 +257,6 @@ static int qce_crypto_probe(struct platform_device *pdev)
if (ret)
goto err_clks_iface;

- ret = qce_dma_request(qce->dev, &qce->dma);
- if (ret)
- goto err_clks;
-
ret = qce_check_version(qce);
if (ret)
goto err_clks;
@@ -265,12 +271,10 @@ static int qce_crypto_probe(struct platform_device *pdev)

ret = qce_register_algs(qce);
if (ret)
- goto err_dma;
+ goto err_clks;

return 0;

-err_dma:
- qce_dma_release(&qce->dma);
err_clks:
clk_disable_unprepare(qce->bus);
err_clks_iface:
--
2.31.1
\
 
 \ /
  Last update: 2021-10-13 13:01    [W:1.871 / U:0.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site