* [PATCH 0/2] crypto: atmel-sha - fix resource management @ 2016-02-05 12:45 Cyrille Pitchen 2016-02-05 12:45 ` [PATCH 1/2] crypto: atmel-sha: fix atmel_sha_remove() Cyrille Pitchen ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: Cyrille Pitchen @ 2016-02-05 12:45 UTC (permalink / raw) To: linux-arm-kernel Hi all, these two small patches fix resource release and clock management in atomic context. Best regards, Cyrille Cyrille Pitchen (2): crypto: atmel-sha: fix atmel_sha_remove() crypto: atmel-sha - remove calls of clk_prepare() from atomic contexts drivers/crypto/atmel-sha.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) -- 1.8.2.2 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] crypto: atmel-sha: fix atmel_sha_remove() 2016-02-05 12:45 [PATCH 0/2] crypto: atmel-sha - fix resource management Cyrille Pitchen @ 2016-02-05 12:45 ` Cyrille Pitchen 2016-02-05 12:45 ` [PATCH 2/2] crypto: atmel-sha - remove calls of clk_prepare() from atomic contexts Cyrille Pitchen 2016-02-06 7:49 ` [PATCH 0/2] crypto: atmel-sha - fix resource management Herbert Xu 2 siblings, 0 replies; 4+ messages in thread From: Cyrille Pitchen @ 2016-02-05 12:45 UTC (permalink / raw) To: linux-arm-kernel Since atmel_sha_probe() uses devm_xxx functions to allocate resources, atmel_sha_remove() should no longer explicitly release them. Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com> Fixes: b0e8b3417a62 ("crypto: atmel - use devm_xxx() managed function") --- drivers/crypto/atmel-sha.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c index 63b09e01075c..b827c99b17c1 100644 --- a/drivers/crypto/atmel-sha.c +++ b/drivers/crypto/atmel-sha.c @@ -1611,13 +1611,6 @@ static int atmel_sha_remove(struct platform_device *pdev) if (sha_dd->caps.has_dma) atmel_sha_dma_cleanup(sha_dd); - iounmap(sha_dd->io_base); - - clk_put(sha_dd->iclk); - - if (sha_dd->irq >= 0) - free_irq(sha_dd->irq, sha_dd); - return 0; } -- 1.8.2.2 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] crypto: atmel-sha - remove calls of clk_prepare() from atomic contexts 2016-02-05 12:45 [PATCH 0/2] crypto: atmel-sha - fix resource management Cyrille Pitchen 2016-02-05 12:45 ` [PATCH 1/2] crypto: atmel-sha: fix atmel_sha_remove() Cyrille Pitchen @ 2016-02-05 12:45 ` Cyrille Pitchen 2016-02-06 7:49 ` [PATCH 0/2] crypto: atmel-sha - fix resource management Herbert Xu 2 siblings, 0 replies; 4+ messages in thread From: Cyrille Pitchen @ 2016-02-05 12:45 UTC (permalink / raw) To: linux-arm-kernel 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(). Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com> Reported-by: Matthias Mayr <matthias.mayr@student.kit.edu> --- drivers/crypto/atmel-sha.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c index b827c99b17c1..f8407dc7dd38 100644 --- a/drivers/crypto/atmel-sha.c +++ b/drivers/crypto/atmel-sha.c @@ -846,7 +846,7 @@ static void atmel_sha_finish_req(struct ahash_request *req, int err) dd->flags &= ~(SHA_FLAGS_BUSY | SHA_FLAGS_FINAL | SHA_FLAGS_CPU | SHA_FLAGS_DMA_READY | SHA_FLAGS_OUTPUT_READY); - clk_disable_unprepare(dd->iclk); + clk_disable(dd->iclk); if (req->base.complete) req->base.complete(&req->base, err); @@ -859,7 +859,7 @@ static int atmel_sha_hw_init(struct atmel_sha_dev *dd) { int err; - err = clk_prepare_enable(dd->iclk); + err = clk_enable(dd->iclk); if (err) return err; @@ -886,7 +886,7 @@ static void atmel_sha_hw_version_init(struct atmel_sha_dev *dd) dev_info(dd->dev, "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, @@ -1536,6 +1536,10 @@ static int atmel_sha_probe(struct platform_device *pdev) goto res_err; } + err = clk_prepare(sha_dd->iclk); + if (err) + goto res_err; + atmel_sha_hw_version_init(sha_dd); atmel_sha_get_cap(sha_dd); @@ -1547,12 +1551,12 @@ static int atmel_sha_probe(struct platform_device *pdev) if (IS_ERR(pdata)) { dev_err(&pdev->dev, "platform data not available\n"); err = PTR_ERR(pdata); - goto res_err; + goto iclk_unprepare; } } if (!pdata->dma_slave) { err = -ENXIO; - goto res_err; + goto iclk_unprepare; } err = atmel_sha_dma_init(sha_dd, pdata); if (err) @@ -1583,6 +1587,8 @@ err_algs: if (sha_dd->caps.has_dma) atmel_sha_dma_cleanup(sha_dd); err_sha_dma: +iclk_unprepare: + clk_unprepare(sha_dd->iclk); res_err: tasklet_kill(&sha_dd->queue_task); tasklet_kill(&sha_dd->done_task); @@ -1611,6 +1617,8 @@ static int atmel_sha_remove(struct platform_device *pdev) if (sha_dd->caps.has_dma) atmel_sha_dma_cleanup(sha_dd); + clk_unprepare(sha_dd->iclk); + return 0; } -- 1.8.2.2 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 0/2] crypto: atmel-sha - fix resource management 2016-02-05 12:45 [PATCH 0/2] crypto: atmel-sha - fix resource management Cyrille Pitchen 2016-02-05 12:45 ` [PATCH 1/2] crypto: atmel-sha: fix atmel_sha_remove() Cyrille Pitchen 2016-02-05 12:45 ` [PATCH 2/2] crypto: atmel-sha - remove calls of clk_prepare() from atomic contexts Cyrille Pitchen @ 2016-02-06 7:49 ` Herbert Xu 2 siblings, 0 replies; 4+ messages in thread From: Herbert Xu @ 2016-02-06 7:49 UTC (permalink / raw) To: linux-arm-kernel On Fri, Feb 05, 2016 at 01:45:11PM +0100, Cyrille Pitchen wrote: > Hi all, > > these two small patches fix resource release and clock management in > atomic context. Applied to crypto. -- Email: Herbert Xu <herbert@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-02-06 7:49 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-02-05 12:45 [PATCH 0/2] crypto: atmel-sha - fix resource management Cyrille Pitchen 2016-02-05 12:45 ` [PATCH 1/2] crypto: atmel-sha: fix atmel_sha_remove() Cyrille Pitchen 2016-02-05 12:45 ` [PATCH 2/2] crypto: atmel-sha - remove calls of clk_prepare() from atomic contexts Cyrille Pitchen 2016-02-06 7:49 ` [PATCH 0/2] crypto: atmel-sha - fix resource management Herbert Xu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).