crypto: stm32/hash: Defer probe management
Subsystems (2)
cover crypto: stm32/hash: Defer probe management
These patches manage properly the defer probe for STM32 Hash driver. It allows the driver to be probed later if clock, reset or dma return a defer error.
It also removes the error print messages in such cases.
Etienne Carriere (2):
crypto: stm32/hash - defer probe for reset controller
crypto: stm32/hash - defer probe for dma device
Lionel Debieve (1):
crypto: stm32/hash - don't print error on probe deferral
drivers/crypto/stm32/stm32-hash.c | 38 ++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 11 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/3 crypto: stm32/hash - defer probe for reset controller
From: Etienne Carriere <[email protected]>
Change stm32 HASH driver to defer its probe operation when reset controller device is registered but has not been probed yet.
--- drivers/crypto/stm32/stm32-hash.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/crypto/stm32/stm32-hash.c +7 -2
@@ -1482,7 +1482,12 @@ static int stm32_hash_probe(struct platform_device *pdev)pm_runtime_enable (dev); hdev->rst =devm_reset_control_get (&pdev->dev,NULL ); -if (!IS_ERR (hdev->rst)) { +if (IS_ERR (hdev->rst)) { +if (PTR_ERR (hdev->rst) == -EPROBE_DEFER ) { + ret = -EPROBE_DEFER ; + goto err_reset; + } + }else {reset_control_assert (hdev->rst);udelay (2 );reset_control_deassert (hdev->rst);
@@ -1535,7 +1540,7 @@ static int stm32_hash_probe(struct platform_device *pdev)if (hdev->dma_lch)dma_release_channel (hdev->dma_lch); - +err_reset:pm_runtime_disable (dev);pm_runtime_put_noidle (dev);
Signature · 1 line
2.17.1
PATCH 2/3 crypto: stm32/hash - defer probe for dma device
In reply to Lionel DebieveFrom: Etienne Carriere <[email protected]>
Change stm32 HASH driver to defer its probe operation when DMA channel device is registered but has not been probed yet.
--- drivers/crypto/stm32/stm32-hash.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)
drivers/crypto/stm32/stm32-hash.c +15 -7
@@ -507,6 +507,7 @@ static int stm32_hash_hmac_dma_send(struct stm32_hash_dev *hdev)static int stm32_hash_dma_init (struct stm32_hash_dev *hdev) {struct dma_slave_config dma_conf; +struct dma_chan *chan;int err;memset (&dma_conf,0 ,sizeof (dma_conf));
@@ -518,11 +519,11 @@ static int stm32_hash_dma_init(struct stm32_hash_dev *hdev) dma_conf.dst_maxburst = hdev->dma_maxburst; dma_conf.device_fc = false; - hdev->dma_lch =dma_request_chan (hdev->dev,"in" ); -if (IS_ERR (hdev->dma_lch)) { -dev_err (hdev->dev,"Couldn't acquire a slave DMA channel.\n" ); -return PTR_ERR (hdev->dma_lch); - } + chan =dma_request_chan (hdev->dev,"in" ); +if (IS_ERR (chan)) +return PTR_ERR (chan); + + hdev->dma_lch = chan; err =dmaengine_slave_config (hdev->dma_lch, &dma_conf);if (err) {
@@ -1498,8 +1499,15 @@ static int stm32_hash_probe(struct platform_device *pdev)platform_set_drvdata (pdev, hdev); ret =stm32_hash_dma_init (hdev); -if (ret) +switch (ret) { +case 0 : +break ; +case -ENOENT :dev_dbg (dev,"DMA mode not available\n" ); +break ; +default : + goto err_dma; + }spin_lock (&stm32_hash.lock);list_add_tail (&hdev->list, &stm32_hash.dev_list);
@@ -1537,7 +1545,7 @@ static int stm32_hash_probe(struct platform_device *pdev)spin_lock (&stm32_hash.lock);list_del (&hdev->list);spin_unlock (&stm32_hash.lock); - +err_dma:if (hdev->dma_lch)dma_release_channel (hdev->dma_lch); err_reset:
Signature · 1 line
2.17.1
PATCH 3/3 crypto: stm32/hash - don't print error on probe deferral
In reply to Lionel DebieveChange driver to not print an error message when the device probe is deferred for a clock resource.
--- drivers/crypto/stm32/stm32-hash.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/crypto/stm32/stm32-hash.c +5 -2
@@ -1464,8 +1464,11 @@ static int stm32_hash_probe(struct platform_device *pdev) hdev->clk =devm_clk_get (&pdev->dev,NULL );if (IS_ERR (hdev->clk)) { -dev_err (dev,"failed to get clock for hash (%lu)\n" , -PTR_ERR (hdev->clk)); +if (PTR_ERR (hdev->clk) != -EPROBE_DEFER ) { +dev_err (dev,"failed to get clock for hash (%lu)\n" , +PTR_ERR (hdev->clk)); + } +return PTR_ERR (hdev->clk); }
Signature · 1 line
2.17.1
Herbert Xu
maintainerQuoted 9 lines · Lionel Debieve
These patches manage properly the defer probe for STM32 Hash driver. It allows the driver to be probed later if clock, reset or dma return a defer error.
It also removes the error print messages in such cases.Etienne Carriere (2):
crypto: stm32/hash - defer probe for reset controller
crypto: stm32/hash - defer probe for dma device
Quoted 5 lines
Lionel Debieve (1):
crypto: stm32/hash - don't print error on probe deferraldrivers/crypto/stm32/stm32-hash.c | 38 ++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 11 deletions(-)
All applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt