Re: [PATCH 2/2] i2c: mv64xxx: add an optional reset-gpios property

From: Andi Shyti
Date: Thu Oct 12 2023 - 06:21:49 EST


Hi Chris,

...

> static struct mv64xxx_i2c_regs mv64xxx_i2c_regs_mv64xxx = {
> @@ -1083,6 +1084,10 @@ mv64xxx_i2c_probe(struct platform_device *pd)
> if (drv_data->irq < 0)
> return drv_data->irq;
>
> + drv_data->reset_gpio = devm_gpiod_get_optional(&pd->dev, "reset", GPIOD_OUT_HIGH);
> + if (IS_ERR(drv_data->reset_gpio))
> + return PTR_ERR(drv_data->reset_gpio);

if this optional why are we returning in case of error?

> +
> if (pdata) {
> drv_data->freq_m = pdata->freq_m;
> drv_data->freq_n = pdata->freq_n;
> @@ -1121,6 +1126,12 @@ mv64xxx_i2c_probe(struct platform_device *pd)
> goto exit_disable_pm;
> }
>
> + if (drv_data->reset_gpio) {
> + udelay(1);
> + gpiod_set_value_cansleep(drv_data->reset_gpio, 0);
> + udelay(1);

you like busy waiting :-)

What is the reason behind these waits? Is there anything
specified by the datasheet?

If not I would do a more relaxed sleeping like an usleep_range...
what do you think?

Andi