Re: [PATCH v3 2/2] iio: proximity: add driver for ST VL53L1X ToF sensor
From: Andy Shevchenko
Date: Fri Mar 13 2026 - 05:37:23 EST
On Thu, Mar 12, 2026 at 11:37:26PM +0600, Sirat wrote:
> On Thu, Mar 12, 2026 at 8:58 PM Andy Shevchenko
> <andriy.shevchenko@xxxxxxxxx> wrote:
> > On Thu, Mar 12, 2026 at 04:40:37AM +0600, Siratul Islam wrote:
...
> > > +static const struct regmap_config vl53l1x_regmap_config = {
> > > + .reg_bits = 16,
> > > + .val_bits = 8,
> >
> > No cache?
> >
> The result registers change on every measurement, so caching doesn't
> apply well here.
> Will add .cache_type = REGCACHE_NONE with a comment to clarify.
OK!
> > > +};
...
> > > + reinit_completion(&data->completion);
> >
> > > + wait_for_completion_timeout(&data->completion, HZ / 10);
> >
> > No error condition check?
> >
> This is only a short drain to make sure any pending IRQ has been
> handled before we stop
> the device and clear the interrupt line. A timeout here is not treated
> as a failure and the device
> is being shut down anyway, so I intentionally do not check the return value.
Based on the above experience, you know how to improve this.
...
> > > + data->xshut_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
> > > + if (IS_ERR(data->xshut_gpio))
> > > + return dev_err_probe(dev, PTR_ERR(data->xshut_gpio),
> > > + "Cannot get reset GPIO\n");
> >
> > If it's a reset (semantically), use reset-gpio driver and reset APIs here.
> >
> The XSHUT pin is a shutdown/enable pin rather than a true reset line,
> and the existing shared st,vl53l0x.yaml
> binding already defines it as reset-gpios. So I am keeping the GPIO
> consumer API here.
And? reset-gpio driver is exactly for those cases. Please, move your driver
code accordingly.
> Sending v4 with all other fixes from your review, shortly.
Please, take care of the comments first.
--
With Best Regards,
Andy Shevchenko