summaryrefslogtreecommitdiff
path: root/drivers/crypto
diff options
context:
space:
mode:
authorChunhai Guo <guochunhai@vivo.com>2024-08-23 03:52:12 -0600
committerHerbert Xu <herbert@gondor.apana.org.au>2024-08-30 18:23:43 +0800
commit407f8cf8e6875fc8fb3c0cda193f310340122060 (patch)
tree815f1df71f9f3f312ef78b558676d05008a341f2 /drivers/crypto
parenteb7bb0b56b41e9dd73d340159b8a0ce743352014 (diff)
crypto: img-hash - use devm_clk_get_enabled() helpers
Simplify the code by replacing devm_clk_get() and clk_prepare_enable() with devm_clk_get_enabled(), which also avoids the call to clk_disable_unprepare(). Signed-off-by: Chunhai Guo <guochunhai@vivo.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/img-hash.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/drivers/crypto/img-hash.c b/drivers/crypto/img-hash.c
index d269036bdaa3..7e93159c3b6b 100644
--- a/drivers/crypto/img-hash.c
+++ b/drivers/crypto/img-hash.c
@@ -987,31 +987,23 @@ static int img_hash_probe(struct platform_device *pdev)
}
dev_dbg(dev, "using IRQ channel %d\n", irq);
- hdev->hash_clk = devm_clk_get(&pdev->dev, "hash");
+ hdev->hash_clk = devm_clk_get_enabled(&pdev->dev, "hash");
if (IS_ERR(hdev->hash_clk)) {
dev_err(dev, "clock initialization failed.\n");
err = PTR_ERR(hdev->hash_clk);
goto res_err;
}
- hdev->sys_clk = devm_clk_get(&pdev->dev, "sys");
+ hdev->sys_clk = devm_clk_get_enabled(&pdev->dev, "sys");
if (IS_ERR(hdev->sys_clk)) {
dev_err(dev, "clock initialization failed.\n");
err = PTR_ERR(hdev->sys_clk);
goto res_err;
}
- err = clk_prepare_enable(hdev->hash_clk);
- if (err)
- goto res_err;
-
- err = clk_prepare_enable(hdev->sys_clk);
- if (err)
- goto clk_err;
-
err = img_hash_dma_init(hdev);
if (err)
- goto dma_err;
+ goto res_err;
dev_dbg(dev, "using %s for DMA transfers\n",
dma_chan_name(hdev->dma_lch));
@@ -1032,10 +1024,6 @@ err_algs:
list_del(&hdev->list);
spin_unlock(&img_hash.lock);
dma_release_channel(hdev->dma_lch);
-dma_err:
- clk_disable_unprepare(hdev->sys_clk);
-clk_err:
- clk_disable_unprepare(hdev->hash_clk);
res_err:
tasklet_kill(&hdev->done_task);
tasklet_kill(&hdev->dma_task);
@@ -1058,9 +1046,6 @@ static void img_hash_remove(struct platform_device *pdev)
tasklet_kill(&hdev->dma_task);
dma_release_channel(hdev->dma_lch);
-
- clk_disable_unprepare(hdev->hash_clk);
- clk_disable_unprepare(hdev->sys_clk);
}
#ifdef CONFIG_PM_SLEEP