2020-04-20 15:22:33

by Alain Volmat

[permalink] [raw]
Subject: [PATCH v2] i2c: stm32: don't print an error on probe deferral

From: Etienne Carriere <[email protected]>

Do not print an error trace when deferring probe for some resource.
Fix as well the error message in case of tx dma_request_chan failure.

Signed-off-by: Etienne Carriere <[email protected]>
Signed-off-by: Alain Volmat <[email protected]>
Reviewed-by: Pierre-Yves MORDRET <[email protected]>
---
v2: replace dev_dbg with dev_err in case of error with dma_request_chan for tx

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..3f69a3bb6119 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_err(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 d6a69dfcac3f..48e269284369 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 8102e33a6753..59a0dcd6a475 100644
--- a/drivers/i2c/busses/i2c-stm32f7.c
+++ b/drivers/i2c/busses/i2c-stm32f7.c
@@ -1967,7 +1967,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);
}

@@ -1979,8 +1980,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


2020-04-26 07:49:57

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH v2] i2c: stm32: don't print an error on probe deferral

On Mon, Apr 20, 2020 at 05:17:06PM +0200, Alain Volmat wrote:
> From: Etienne Carriere <[email protected]>
>
> Do not print an error trace when deferring probe for some resource.
> Fix as well the error message in case of tx dma_request_chan failure.
>
> Signed-off-by: Etienne Carriere <[email protected]>
> Signed-off-by: Alain Volmat <[email protected]>
> Reviewed-by: Pierre-Yves MORDRET <[email protected]>

Applied to for-next, thanks!


Attachments:
(No filename) (480.00 B)
signature.asc (849.00 B)
Download all attachments