Commit c033042a authored by Cyrille Pitchen's avatar Cyrille Pitchen Committed by Herbert Xu

crypto: atmel-sha - remove calls of clk_prepare() from atomic contexts

clk_prepare()/clk_unprepare() must not be called within atomic context.

This patch calls clk_prepare() once for all from atmel_sha_probe() and
clk_unprepare() from atmel_sha_remove().

Then calls of clk_prepare_enable()/clk_disable_unprepare() were replaced
by calls of clk_enable()/clk_disable().

Cc: stable@vger.kernel.org
Signed-off-by: default avatarCyrille Pitchen <cyrille.pitchen@atmel.com>
Reported-by: default avatarMatthias Mayr <matthias.mayr@student.kit.edu>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent d961436c
...@@ -782,7 +782,7 @@ static void atmel_sha_finish_req(struct ahash_request *req, int err) ...@@ -782,7 +782,7 @@ static void atmel_sha_finish_req(struct ahash_request *req, int err)
dd->flags &= ~(SHA_FLAGS_BUSY | SHA_FLAGS_FINAL | SHA_FLAGS_CPU | dd->flags &= ~(SHA_FLAGS_BUSY | SHA_FLAGS_FINAL | SHA_FLAGS_CPU |
SHA_FLAGS_DMA_READY | SHA_FLAGS_OUTPUT_READY); SHA_FLAGS_DMA_READY | SHA_FLAGS_OUTPUT_READY);
clk_disable_unprepare(dd->iclk); clk_disable(dd->iclk);
if (req->base.complete) if (req->base.complete)
req->base.complete(&req->base, err); req->base.complete(&req->base, err);
...@@ -795,7 +795,7 @@ static int atmel_sha_hw_init(struct atmel_sha_dev *dd) ...@@ -795,7 +795,7 @@ static int atmel_sha_hw_init(struct atmel_sha_dev *dd)
{ {
int err; int err;
err = clk_prepare_enable(dd->iclk); err = clk_enable(dd->iclk);
if (err) if (err)
return err; return err;
...@@ -822,7 +822,7 @@ static void atmel_sha_hw_version_init(struct atmel_sha_dev *dd) ...@@ -822,7 +822,7 @@ static void atmel_sha_hw_version_init(struct atmel_sha_dev *dd)
dev_info(dd->dev, dev_info(dd->dev,
"version: 0x%x\n", dd->hw_version); "version: 0x%x\n", dd->hw_version);
clk_disable_unprepare(dd->iclk); clk_disable(dd->iclk);
} }
static int atmel_sha_handle_queue(struct atmel_sha_dev *dd, static int atmel_sha_handle_queue(struct atmel_sha_dev *dd,
...@@ -1410,6 +1410,10 @@ static int atmel_sha_probe(struct platform_device *pdev) ...@@ -1410,6 +1410,10 @@ static int atmel_sha_probe(struct platform_device *pdev)
goto res_err; goto res_err;
} }
err = clk_prepare(sha_dd->iclk);
if (err)
goto res_err;
atmel_sha_hw_version_init(sha_dd); atmel_sha_hw_version_init(sha_dd);
atmel_sha_get_cap(sha_dd); atmel_sha_get_cap(sha_dd);
...@@ -1421,12 +1425,12 @@ static int atmel_sha_probe(struct platform_device *pdev) ...@@ -1421,12 +1425,12 @@ static int atmel_sha_probe(struct platform_device *pdev)
if (IS_ERR(pdata)) { if (IS_ERR(pdata)) {
dev_err(&pdev->dev, "platform data not available\n"); dev_err(&pdev->dev, "platform data not available\n");
err = PTR_ERR(pdata); err = PTR_ERR(pdata);
goto res_err; goto iclk_unprepare;
} }
} }
if (!pdata->dma_slave) { if (!pdata->dma_slave) {
err = -ENXIO; err = -ENXIO;
goto res_err; goto iclk_unprepare;
} }
err = atmel_sha_dma_init(sha_dd, pdata); err = atmel_sha_dma_init(sha_dd, pdata);
if (err) if (err)
...@@ -1457,6 +1461,8 @@ static int atmel_sha_probe(struct platform_device *pdev) ...@@ -1457,6 +1461,8 @@ static int atmel_sha_probe(struct platform_device *pdev)
if (sha_dd->caps.has_dma) if (sha_dd->caps.has_dma)
atmel_sha_dma_cleanup(sha_dd); atmel_sha_dma_cleanup(sha_dd);
err_sha_dma: err_sha_dma:
iclk_unprepare:
clk_unprepare(sha_dd->iclk);
res_err: res_err:
tasklet_kill(&sha_dd->done_task); tasklet_kill(&sha_dd->done_task);
sha_dd_err: sha_dd_err:
...@@ -1483,6 +1489,8 @@ static int atmel_sha_remove(struct platform_device *pdev) ...@@ -1483,6 +1489,8 @@ static int atmel_sha_remove(struct platform_device *pdev)
if (sha_dd->caps.has_dma) if (sha_dd->caps.has_dma)
atmel_sha_dma_cleanup(sha_dd); atmel_sha_dma_cleanup(sha_dd);
clk_unprepare(sha_dd->iclk);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment