2022-06-20 11:11:25

by Alain Volmat

[permalink] [raw]
Subject: [PATCH 2/4] i2c: stm32: only perform a reset if there is a reset property

Allow the driver to properly initialize even if there is no reset
property given. In such case reset control is not done and
initialization proceed.

Signed-off-by: Alain Volmat <[email protected]>
---
drivers/i2c/busses/i2c-stm32f7.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c
index 6d4aa64b195d..b29d8e476342 100644
--- a/drivers/i2c/busses/i2c-stm32f7.c
+++ b/drivers/i2c/busses/i2c-stm32f7.c
@@ -2138,13 +2138,14 @@ static int stm32f7_i2c_probe(struct platform_device *pdev)

rst = devm_reset_control_get(&pdev->dev, NULL);
if (IS_ERR(rst)) {
- ret = dev_err_probe(&pdev->dev, PTR_ERR(rst),
- "Error: Missing reset ctrl\n");
- goto clk_free;
+ ret = PTR_ERR(rst);
+ if (ret == -EPROBE_DEFER)
+ goto clk_free;
+ } else {
+ reset_control_assert(rst);
+ udelay(2);
+ reset_control_deassert(rst);
}
- reset_control_assert(rst);
- udelay(2);
- reset_control_deassert(rst);

i2c_dev->dev = &pdev->dev;

--
2.25.1


2022-06-21 14:16:00

by Pierre Yves MORDRET

[permalink] [raw]
Subject: Re: [PATCH 2/4] i2c: stm32: only perform a reset if there is a reset property

Hi All

Look good to me.

Reviewed-by: Pierre-Yves MORDRET <[email protected]>

Regards

On 6/20/22 12:54, Alain Volmat wrote:
> Allow the driver to properly initialize even if there is no reset
> property given. In such case reset control is not done and
> initialization proceed.
>
> Signed-off-by: Alain Volmat <[email protected]>
> ---
> drivers/i2c/busses/i2c-stm32f7.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c
> index 6d4aa64b195d..b29d8e476342 100644
> --- a/drivers/i2c/busses/i2c-stm32f7.c
> +++ b/drivers/i2c/busses/i2c-stm32f7.c
> @@ -2138,13 +2138,14 @@ static int stm32f7_i2c_probe(struct platform_device *pdev)
>
> rst = devm_reset_control_get(&pdev->dev, NULL);
> if (IS_ERR(rst)) {
> - ret = dev_err_probe(&pdev->dev, PTR_ERR(rst),
> - "Error: Missing reset ctrl\n");
> - goto clk_free;
> + ret = PTR_ERR(rst);
> + if (ret == -EPROBE_DEFER)
> + goto clk_free;
> + } else {
> + reset_control_assert(rst);
> + udelay(2);
> + reset_control_deassert(rst);
> }
> - reset_control_assert(rst);
> - udelay(2);
> - reset_control_deassert(rst);
>
> i2c_dev->dev = &pdev->dev;
>

--
--
~ Py MORDRET
--