linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: stm32: don't print an error on probe deferral
@ 2020-03-19 18:22 Alain Volmat
  2020-03-30  8:40 ` Pierre Yves MORDRET
  2020-04-15 11:01 ` Wolfram Sang
  0 siblings, 2 replies; 4+ messages in thread
From: Alain Volmat @ 2020-03-19 18:22 UTC (permalink / raw)
  To: wsa, pierre-yves.mordret
  Cc: alain.volmat, alexandre.torgue, linux-i2c, linux-stm32,
	linux-arm-kernel, linux-kernel, fabrice.gasnier

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

Do not print an error trace when deferring probe for some resource.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Signed-off-by: Alain Volmat <alain.volmat@st.com>
---
 drivers/i2c/busses/i2c-stm32.c   | 10 +++++++---
 drivers/i2c/busses/i2c-stm32f4.c |  4 +++-
 drivers/i2c/busses/i2c-stm32f7.c |  7 +++++--
 3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/busses/i2c-stm32.c b/drivers/i2c/busses/i2c-stm32.c
index 1da347e6a358..7be559858402 100644
--- a/drivers/i2c/busses/i2c-stm32.c
+++ b/drivers/i2c/busses/i2c-stm32.c
@@ -25,8 +25,9 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev,
 	/* Request and configure I2C TX dma channel */
 	dma->chan_tx = dma_request_chan(dev, "tx");
 	if (IS_ERR(dma->chan_tx)) {
-		dev_dbg(dev, "can't request DMA tx channel\n");
 		ret = PTR_ERR(dma->chan_tx);
+		if (ret != -EPROBE_DEFER)
+			dev_dbg(dev, "can't request DMA tx channel\n");
 		goto fail_al;
 	}
 
@@ -44,8 +45,10 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev,
 	/* Request and configure I2C RX dma channel */
 	dma->chan_rx = dma_request_chan(dev, "rx");
 	if (IS_ERR(dma->chan_rx)) {
-		dev_err(dev, "can't request DMA rx channel\n");
 		ret = PTR_ERR(dma->chan_rx);
+		if (ret != -EPROBE_DEFER)
+			dev_err(dev, "can't request DMA rx channel\n");
+
 		goto fail_tx;
 	}
 
@@ -73,7 +76,8 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev,
 	dma_release_channel(dma->chan_tx);
 fail_al:
 	devm_kfree(dev, dma);
-	dev_info(dev, "can't use DMA\n");
+	if (ret != -EPROBE_DEFER)
+		dev_info(dev, "can't use DMA\n");
 
 	return ERR_PTR(ret);
 }
diff --git a/drivers/i2c/busses/i2c-stm32f4.c b/drivers/i2c/busses/i2c-stm32f4.c
index ba600d77a3f8..1b8cad506ad7 100644
--- a/drivers/i2c/busses/i2c-stm32f4.c
+++ b/drivers/i2c/busses/i2c-stm32f4.c
@@ -797,8 +797,10 @@ static int stm32f4_i2c_probe(struct platform_device *pdev)
 
 	rst = devm_reset_control_get_exclusive(&pdev->dev, NULL);
 	if (IS_ERR(rst)) {
-		dev_err(&pdev->dev, "Error: Missing controller reset\n");
 		ret = PTR_ERR(rst);
+		if (ret != -EPROBE_DEFER)
+			dev_err(&pdev->dev, "Error: Missing reset ctrl\n");
+
 		goto clk_free;
 	}
 	reset_control_assert(rst);
diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c
index 78d40a4cc282..ab95ed52a7dc 100644
--- a/drivers/i2c/busses/i2c-stm32f7.c
+++ b/drivers/i2c/busses/i2c-stm32f7.c
@@ -1915,7 +1915,8 @@ static int stm32f7_i2c_probe(struct platform_device *pdev)
 
 	i2c_dev->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(i2c_dev->clk)) {
-		dev_err(&pdev->dev, "Error: Missing controller clock\n");
+		if (PTR_ERR(i2c_dev->clk) != -EPROBE_DEFER)
+			dev_err(&pdev->dev, "Failed to get controller clock\n");
 		return PTR_ERR(i2c_dev->clk);
 	}
 
@@ -1941,8 +1942,10 @@ static int stm32f7_i2c_probe(struct platform_device *pdev)
 
 	rst = devm_reset_control_get(&pdev->dev, NULL);
 	if (IS_ERR(rst)) {
-		dev_err(&pdev->dev, "Error: Missing controller reset\n");
 		ret = PTR_ERR(rst);
+		if (ret != -EPROBE_DEFER)
+			dev_err(&pdev->dev, "Error: Missing reset ctrl\n");
+
 		goto clk_free;
 	}
 	reset_control_assert(rst);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] i2c: stm32: don't print an error on probe deferral
  2020-03-19 18:22 [PATCH] i2c: stm32: don't print an error on probe deferral Alain Volmat
@ 2020-03-30  8:40 ` Pierre Yves MORDRET
  2020-04-15 11:01 ` Wolfram Sang
  1 sibling, 0 replies; 4+ messages in thread
From: Pierre Yves MORDRET @ 2020-03-30  8:40 UTC (permalink / raw)
  To: Alain Volmat, wsa
  Cc: alexandre.torgue, linux-i2c, linux-stm32, linux-arm-kernel,
	linux-kernel, fabrice.gasnier

Hello !

Reviewed-by: Pierre-Yves MORDRET <pierre-yves.mordret@st.com>

Thanks

On 3/19/20 7:22 PM, Alain Volmat wrote:
> From: Etienne Carriere <etienne.carriere@st.com>
> 
> Do not print an error trace when deferring probe for some resource.
> 
> Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
> Signed-off-by: Alain Volmat <alain.volmat@st.com>
> ---
>  drivers/i2c/busses/i2c-stm32.c   | 10 +++++++---
>  drivers/i2c/busses/i2c-stm32f4.c |  4 +++-
>  drivers/i2c/busses/i2c-stm32f7.c |  7 +++++--
>  3 files changed, 15 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-stm32.c b/drivers/i2c/busses/i2c-stm32.c
> index 1da347e6a358..7be559858402 100644
> --- a/drivers/i2c/busses/i2c-stm32.c
> +++ b/drivers/i2c/busses/i2c-stm32.c
> @@ -25,8 +25,9 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev,
>  	/* Request and configure I2C TX dma channel */
>  	dma->chan_tx = dma_request_chan(dev, "tx");
>  	if (IS_ERR(dma->chan_tx)) {
> -		dev_dbg(dev, "can't request DMA tx channel\n");
>  		ret = PTR_ERR(dma->chan_tx);
> +		if (ret != -EPROBE_DEFER)
> +			dev_dbg(dev, "can't request DMA tx channel\n");
>  		goto fail_al;
>  	}
>  
> @@ -44,8 +45,10 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev,
>  	/* Request and configure I2C RX dma channel */
>  	dma->chan_rx = dma_request_chan(dev, "rx");
>  	if (IS_ERR(dma->chan_rx)) {
> -		dev_err(dev, "can't request DMA rx channel\n");
>  		ret = PTR_ERR(dma->chan_rx);
> +		if (ret != -EPROBE_DEFER)
> +			dev_err(dev, "can't request DMA rx channel\n");
> +
>  		goto fail_tx;
>  	}
>  
> @@ -73,7 +76,8 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev,
>  	dma_release_channel(dma->chan_tx);
>  fail_al:
>  	devm_kfree(dev, dma);
> -	dev_info(dev, "can't use DMA\n");
> +	if (ret != -EPROBE_DEFER)
> +		dev_info(dev, "can't use DMA\n");
>  
>  	return ERR_PTR(ret);
>  }
> diff --git a/drivers/i2c/busses/i2c-stm32f4.c b/drivers/i2c/busses/i2c-stm32f4.c
> index ba600d77a3f8..1b8cad506ad7 100644
> --- a/drivers/i2c/busses/i2c-stm32f4.c
> +++ b/drivers/i2c/busses/i2c-stm32f4.c
> @@ -797,8 +797,10 @@ static int stm32f4_i2c_probe(struct platform_device *pdev)
>  
>  	rst = devm_reset_control_get_exclusive(&pdev->dev, NULL);
>  	if (IS_ERR(rst)) {
> -		dev_err(&pdev->dev, "Error: Missing controller reset\n");
>  		ret = PTR_ERR(rst);
> +		if (ret != -EPROBE_DEFER)
> +			dev_err(&pdev->dev, "Error: Missing reset ctrl\n");
> +
>  		goto clk_free;
>  	}
>  	reset_control_assert(rst);
> diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c
> index 78d40a4cc282..ab95ed52a7dc 100644
> --- a/drivers/i2c/busses/i2c-stm32f7.c
> +++ b/drivers/i2c/busses/i2c-stm32f7.c
> @@ -1915,7 +1915,8 @@ static int stm32f7_i2c_probe(struct platform_device *pdev)
>  
>  	i2c_dev->clk = devm_clk_get(&pdev->dev, NULL);
>  	if (IS_ERR(i2c_dev->clk)) {
> -		dev_err(&pdev->dev, "Error: Missing controller clock\n");
> +		if (PTR_ERR(i2c_dev->clk) != -EPROBE_DEFER)
> +			dev_err(&pdev->dev, "Failed to get controller clock\n");
>  		return PTR_ERR(i2c_dev->clk);
>  	}
>  
> @@ -1941,8 +1942,10 @@ static int stm32f7_i2c_probe(struct platform_device *pdev)
>  
>  	rst = devm_reset_control_get(&pdev->dev, NULL);
>  	if (IS_ERR(rst)) {
> -		dev_err(&pdev->dev, "Error: Missing controller reset\n");
>  		ret = PTR_ERR(rst);
> +		if (ret != -EPROBE_DEFER)
> +			dev_err(&pdev->dev, "Error: Missing reset ctrl\n");
> +
>  		goto clk_free;
>  	}
>  	reset_control_assert(rst);
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] i2c: stm32: don't print an error on probe deferral
  2020-03-19 18:22 [PATCH] i2c: stm32: don't print an error on probe deferral Alain Volmat
  2020-03-30  8:40 ` Pierre Yves MORDRET
@ 2020-04-15 11:01 ` Wolfram Sang
  2020-04-20 15:11   ` Alain Volmat
  1 sibling, 1 reply; 4+ messages in thread
From: Wolfram Sang @ 2020-04-15 11:01 UTC (permalink / raw)
  To: Alain Volmat
  Cc: pierre-yves.mordret, alexandre.torgue, linux-i2c, linux-stm32,
	linux-arm-kernel, linux-kernel, fabrice.gasnier

[-- Attachment #1: Type: text/plain, Size: 702 bytes --]

>  	if (IS_ERR(dma->chan_tx)) {
> -		dev_dbg(dev, "can't request DMA tx channel\n");
>  		ret = PTR_ERR(dma->chan_tx);
> +		if (ret != -EPROBE_DEFER)
> +			dev_dbg(dev, "can't request DMA tx channel\n");

dev_dbg for tx...

>  		goto fail_al;
>  	}
>  
> @@ -44,8 +45,10 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev,
>  	/* Request and configure I2C RX dma channel */
>  	dma->chan_rx = dma_request_chan(dev, "rx");
>  	if (IS_ERR(dma->chan_rx)) {
> -		dev_err(dev, "can't request DMA rx channel\n");
>  		ret = PTR_ERR(dma->chan_rx);
> +		if (ret != -EPROBE_DEFER)
> +			dev_err(dev, "can't request DMA rx channel\n");

... and dev_err for rx? Intentional?


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] i2c: stm32: don't print an error on probe deferral
  2020-04-15 11:01 ` Wolfram Sang
@ 2020-04-20 15:11   ` Alain Volmat
  0 siblings, 0 replies; 4+ messages in thread
From: Alain Volmat @ 2020-04-20 15:11 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: pierre-yves.mordret, alexandre.torgue, linux-i2c, linux-stm32,
	linux-arm-kernel, linux-kernel, fabrice.gasnier

Hi Wolfram,

On Wed, Apr 15, 2020 at 01:01:45PM +0200, Wolfram Sang wrote:
> >  	if (IS_ERR(dma->chan_tx)) {
> > -		dev_dbg(dev, "can't request DMA tx channel\n");
> >  		ret = PTR_ERR(dma->chan_tx);
> > +		if (ret != -EPROBE_DEFER)
> > +			dev_dbg(dev, "can't request DMA tx channel\n");
> 
> dev_dbg for tx...

Intention was to not change too much the original code when introducing this
check and fixing this message level in another patch. But I guess indeed this
can be done all at once.

I am pushing a v2 fixing this in this patch and having dev_err for both tx & rx
dma requests.

> 
> >  		goto fail_al;
> >  	}
> >  
> > @@ -44,8 +45,10 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev,
> >  	/* Request and configure I2C RX dma channel */
> >  	dma->chan_rx = dma_request_chan(dev, "rx");
> >  	if (IS_ERR(dma->chan_rx)) {
> > -		dev_err(dev, "can't request DMA rx channel\n");
> >  		ret = PTR_ERR(dma->chan_rx);
> > +		if (ret != -EPROBE_DEFER)
> > +			dev_err(dev, "can't request DMA rx channel\n");
> 
> ... and dev_err for rx? Intentional?
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-04-20 15:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-19 18:22 [PATCH] i2c: stm32: don't print an error on probe deferral Alain Volmat
2020-03-30  8:40 ` Pierre Yves MORDRET
2020-04-15 11:01 ` Wolfram Sang
2020-04-20 15:11   ` Alain Volmat

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).