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

Pierre Yves MORDRET pierre-yves.mordret at foss.st.com
Tue Jun 21 06:39:40 PDT 2022


Hi All

Look good to me.

Reviewed-by: Pierre-Yves MORDRET <pierre-yves.mordret at 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 at 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;
>  

-- 
--
~ Py MORDRET
--



More information about the linux-arm-kernel mailing list