Message ID | 20220620105405.145959-3-alain.volmat@foss.st.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | i2c: stm32: addition of STM32MP13 support | expand |
Hi All Look good to me. Reviewed-by: Pierre-Yves MORDRET <pierre-yves.mordret@foss.st.com> 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 <alain.volmat@foss.st.com> > --- > 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; >
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;
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 <alain.volmat@foss.st.com> --- drivers/i2c/busses/i2c-stm32f7.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)