All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Toromanoff <nicolas.toromanoff@foss.st.com>
To: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S . Miller" <davem@davemloft.net>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>
Cc: Marek Vasut <marex@denx.de>,
	Nicolas Toromanoff <nicolas.toromanoff@foss.st.com>,
	Ard Biesheuvel <ardb@kernel.org>, <linux-crypto@vger.kernel.org>,
	<linux-stm32@st-md-mailman.stormreply.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>,
	Etienne Carriere <etienne.carriere@foss.st.com>
Subject: [PATCH v4 1/9] crypto: stm32/cryp - defer probe for reset controller
Date: Tue, 30 Nov 2021 08:54:53 +0100	[thread overview]
Message-ID: <20211130075501.21958-2-nicolas.toromanoff@foss.st.com> (raw)
In-Reply-To: <20211130075501.21958-1-nicolas.toromanoff@foss.st.com>

From: Etienne Carriere <etienne.carriere@foss.st.com>

Change stm32 CRYP driver to defer its probe operation when
reset controller device is registered but has not been probed yet.

Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
Signed-off-by: Nicolas Toromanoff <nicolas.toromanoff@foss.st.com>
---
 drivers/crypto/stm32/stm32-cryp.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/stm32/stm32-cryp.c b/drivers/crypto/stm32/stm32-cryp.c
index 7389a0536ff0..dcdd313485de 100644
--- a/drivers/crypto/stm32/stm32-cryp.c
+++ b/drivers/crypto/stm32/stm32-cryp.c
@@ -1973,7 +1973,11 @@ static int stm32_cryp_probe(struct platform_device *pdev)
 	pm_runtime_enable(dev);
 
 	rst = devm_reset_control_get(dev, NULL);
-	if (!IS_ERR(rst)) {
+	if (IS_ERR(rst)) {
+		ret = PTR_ERR(rst);
+		if (ret == -EPROBE_DEFER)
+			goto err_rst;
+	} else {
 		reset_control_assert(rst);
 		udelay(2);
 		reset_control_deassert(rst);
@@ -2024,7 +2028,7 @@ static int stm32_cryp_probe(struct platform_device *pdev)
 	spin_lock(&cryp_list.lock);
 	list_del(&cryp->list);
 	spin_unlock(&cryp_list.lock);
-
+err_rst:
 	pm_runtime_disable(dev);
 	pm_runtime_put_noidle(dev);
 	pm_runtime_disable(dev);
-- 
2.17.1


WARNING: multiple messages have this Message-ID (diff)
From: Nicolas Toromanoff <nicolas.toromanoff@foss.st.com>
To: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S . Miller" <davem@davemloft.net>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>
Cc: Marek Vasut <marex@denx.de>,
	Nicolas Toromanoff <nicolas.toromanoff@foss.st.com>,
	Ard Biesheuvel <ardb@kernel.org>, <linux-crypto@vger.kernel.org>,
	<linux-stm32@st-md-mailman.stormreply.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>,
	Etienne Carriere <etienne.carriere@foss.st.com>
Subject: [PATCH v4 1/9] crypto: stm32/cryp - defer probe for reset controller
Date: Tue, 30 Nov 2021 08:54:53 +0100	[thread overview]
Message-ID: <20211130075501.21958-2-nicolas.toromanoff@foss.st.com> (raw)
In-Reply-To: <20211130075501.21958-1-nicolas.toromanoff@foss.st.com>

From: Etienne Carriere <etienne.carriere@foss.st.com>

Change stm32 CRYP driver to defer its probe operation when
reset controller device is registered but has not been probed yet.

Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
Signed-off-by: Nicolas Toromanoff <nicolas.toromanoff@foss.st.com>
---
 drivers/crypto/stm32/stm32-cryp.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/stm32/stm32-cryp.c b/drivers/crypto/stm32/stm32-cryp.c
index 7389a0536ff0..dcdd313485de 100644
--- a/drivers/crypto/stm32/stm32-cryp.c
+++ b/drivers/crypto/stm32/stm32-cryp.c
@@ -1973,7 +1973,11 @@ static int stm32_cryp_probe(struct platform_device *pdev)
 	pm_runtime_enable(dev);
 
 	rst = devm_reset_control_get(dev, NULL);
-	if (!IS_ERR(rst)) {
+	if (IS_ERR(rst)) {
+		ret = PTR_ERR(rst);
+		if (ret == -EPROBE_DEFER)
+			goto err_rst;
+	} else {
 		reset_control_assert(rst);
 		udelay(2);
 		reset_control_deassert(rst);
@@ -2024,7 +2028,7 @@ static int stm32_cryp_probe(struct platform_device *pdev)
 	spin_lock(&cryp_list.lock);
 	list_del(&cryp->list);
 	spin_unlock(&cryp_list.lock);
-
+err_rst:
 	pm_runtime_disable(dev);
 	pm_runtime_put_noidle(dev);
 	pm_runtime_disable(dev);
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-11-30  7:55 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-30  7:54 [PATCH v4 0/9] STM32 CRYP driver: many fixes Nicolas Toromanoff
2021-11-30  7:54 ` Nicolas Toromanoff
2021-11-30  7:54 ` Nicolas Toromanoff [this message]
2021-11-30  7:54   ` [PATCH v4 1/9] crypto: stm32/cryp - defer probe for reset controller Nicolas Toromanoff
2021-11-30  7:54 ` [PATCH v4 2/9] crypto: stm32/cryp - don't print error on probe deferral Nicolas Toromanoff
2021-11-30  7:54   ` Nicolas Toromanoff
2021-11-30  7:54 ` [PATCH v4 3/9] crypto: stm32/cryp - fix CTR counter carry Nicolas Toromanoff
2021-11-30  7:54   ` Nicolas Toromanoff
2021-11-30  7:54 ` [PATCH v4 4/9] crypto: stm32/cryp - fix xts and race condition in crypto_engine requests Nicolas Toromanoff
2021-11-30  7:54   ` Nicolas Toromanoff
2021-11-30  7:54 ` [PATCH v4 5/9] crypto: stm32/cryp - check early input data Nicolas Toromanoff
2021-11-30  7:54   ` Nicolas Toromanoff
2021-11-30  7:54 ` [PATCH v4 6/9] crypto: stm32/cryp - fix double pm exit Nicolas Toromanoff
2021-11-30  7:54   ` Nicolas Toromanoff
2021-11-30  7:54 ` [PATCH v4 7/9] crypto: stm32/cryp - fix lrw chaining mode Nicolas Toromanoff
2021-11-30  7:54   ` Nicolas Toromanoff
2021-11-30  7:55 ` [PATCH v4 8/9] crypto: stm32/cryp - fix bugs and crash in tests Nicolas Toromanoff
2021-11-30  7:55   ` Nicolas Toromanoff
2021-11-30  7:55 ` [PATCH v4 9/9] crypto: stm32/cryp - reorder hw initialization Nicolas Toromanoff
2021-11-30  7:55   ` Nicolas Toromanoff
2021-12-11  5:55 ` [PATCH v4 0/9] STM32 CRYP driver: many fixes Herbert Xu
2021-12-11  5:55   ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211130075501.21958-2-nicolas.toromanoff@foss.st.com \
    --to=nicolas.toromanoff@foss.st.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=ardb@kernel.org \
    --cc=davem@davemloft.net \
    --cc=etienne.carriere@foss.st.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=marex@denx.de \
    --cc=mcoquelin.stm32@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.