From: Jonathan Cameron <jic23@kernel.org>
To: Sirat <email@sirat.me>
Cc: Jonathan Cameron <jonathan.cameron@huawei.com>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org,
robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
linux-kernel@vger.kernel.org,
Andy Shevchenko <andriy.shevchenko@intel.com>
Subject: Re: [PATCH v7 2/2] iio: proximity: add driver for ST VL53L1X ToF sensor
Date: Wed, 25 Mar 2026 19:47:13 +0000 [thread overview]
Message-ID: <20260325194713.6e986590@jic23-huawei> (raw)
In-Reply-To: <CANn+LW+tLc2sQwfknieUi1pCat0+HQWrCFN0WTJ4rC_7_qFGpQ@mail.gmail.com>
On Wed, 25 Mar 2026 22:33:22 +0600
Sirat <email@sirat.me> wrote:
> On Wed, Mar 25, 2026 at 8:47 PM Jonathan Cameron
> <jonathan.cameron@huawei.com> wrote:
> >
> > On Wed, 25 Mar 2026 12:32:23 +0600
> > Siratul Islam <email@sirat.me> wrote:
> >
> > > Add support for the STMicroelectronics VL53L1X Time-of-Flight
> > > ranging sensor with I2C interface.
> > >
> > > Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
> > > Signed-off-by: Siratul Islam <email@sirat.me>
> >
> > Hi Siratul,
> >
> > I used this as a bit of an experiment as you'd +CC lkml and took a close
> > read of the feedback google's AI bot produced.
> > https://sashiko.dev/#/patchset/20260325063254.18062-1-email%40sirat.me
> >
> > Be very careful when considering the output. There are some things
> > in here that are not true, or we don't generally defend against (like the
> > interrupt type related comments).
> >
> > The iio_trigger_get() is (I think) a more general problem so ignore that
> > for your driver - will just be a tiny memory leak and stop the
> > module being easily unloaded. I'll take a look at that one on a more general
> > basis.
> >
> > The regmap one is where these bots excel in that they sometimes go deeper
> > in analysis than a typical person focused on one driver.
> >
> > The stuff on using standard devm_ wasn't from the bot and I think will make
> > things rather simpler.
> >
> > Thanks,
> >
> > Jonathan
> >
> >
> > > ---
> > > MAINTAINERS | 1 +
> > > drivers/iio/proximity/Kconfig | 15 +
> > > drivers/iio/proximity/Makefile | 1 +
> > > drivers/iio/proximity/vl53l1x-i2c.c | 795 ++++++++++++++++++++++++++++
> > > 4 files changed, 812 insertions(+)
> > > create mode 100644 drivers/iio/proximity/vl53l1x-i2c.c
> > >
> >
> > > diff --git a/drivers/iio/proximity/vl53l1x-i2c.c b/drivers/iio/proximity/vl53l1x-i2c.c
> > > new file mode 100644
> > > index 000000000000..085bff04f5d9
> > > --- /dev/null
> > > +++ b/drivers/iio/proximity/vl53l1x-i2c.c
> ...
> > > +
> > > +static int vl53l1x_probe(struct i2c_client *client)
> > > +{
> > > + struct device *dev = &client->dev;
> > > + struct vl53l1x_data *data;
> > > + struct iio_dev *indio_dev;
> > > + int ret;
> > > +
> > > + if (!i2c_check_functionality(client->adapter,
> > > + I2C_FUNC_SMBUS_READ_I2C_BLOCK |
> > > + I2C_FUNC_SMBUS_BYTE_DATA))
> > Sashiko had an interesting comment on this...
> > https://sashiko.dev/#/patchset/20260325063254.18062-1-email%40sirat.me
> > (note in general be careful with this tools feedback, it has a significant
> > false positive rate!)
> >
> > "Does this check needlessly reject pure I2C adapters?
> > The driver configures regmap with reg_bits = 16, which forces regmap to use
> > raw I2C transfers requiring I2C_FUNC_I2C. Checking for SMBUS_READ_I2C_BLOCK
> > might prevent the driver from loading on pure I2C adapters that can perfectly
> > support the device via regmap."
> >
> > By by reading the comment is actually wrong, however... It did made me look.
> > With regbits == 16 & valbits == 8
> > The regmap code checks for I2C_FUNC_SMBUS_I2C_BLOCK
> > (and if not present fails).
> >
> > So the I2C_FUNC_SMBUS_BYTE_DATA seems unused and
> > a broader check on both read and write versions of I2C_BLOCK seems
> > appropriate.
> >
> > However, not a lot of point in checking it at all given regmap does
> > so for us. So I'd drop this check.
> >
> > If anyone is bored, we should probably take a look to see if there
> > are other redundant (or wrong) calls for this.
> >
> > There is another point about trigger references that might be
> > correct (but not unique to this driver so ignore it). That warrants
> > some investigation - I'll take a look in near future.
> >
> I will drop the check altogether here then.
> ...
> > > + /*
> > > + * XSHUT held low puts the chip in hardware standby. All register
> > > + * state is lost on de-assert so this is functionally a reset.
> > > + */
> > > + data->xshut_reset = devm_reset_control_get_optional_exclusive(dev, NULL);
> >
> > If you can switch to devm_regulator_get_enabled() this can I think be
> > ret = devm_reset_control_get_optional_exclusive_deasserted()
> > removing the need to register the action to power off.
> >
> > If you do that remember we still need the sleep after this call.
> >
> So I will move the sleep after
> devm_reset_control_get_optional_exclusive_deasserted() then.
> >
> >
> Thanks for the detailed review, Jonathan!
>
> A quick question. Since these are some small fixes, mostly removals,
> and the patch has seen quite some revisions, does the 1 week wait rule
> still apply here? I am still getting used to this mailing workflow
> coming from the PR workflow of Github and it will help me in the
> future.
Find to send now. Particularly given my recent email saying
cut off for this cycle is lunch time tomorrow (due to my travel).
If not for the dt-binding which is a little more complex change, I might
otherwise have just taken this version and tweaked it whilst applying.
Thanks
Jonathan
>
> Thanks
> Sirat
next prev parent reply other threads:[~2026-03-25 19:47 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-25 6:32 [PATCH v7 0/2] iio: proximity: add driver for ST VL53L1X ToF sensor Siratul Islam
2026-03-25 6:32 ` [PATCH v7 1/2] dt-bindings: iio: proximity: add " Siratul Islam
2026-03-25 8:05 ` Krzysztof Kozlowski
2026-03-25 8:48 ` Sirat
2026-03-25 8:57 ` Krzysztof Kozlowski
2026-03-25 9:18 ` Sirat
2026-03-25 13:38 ` Jonathan Cameron
2026-03-25 13:44 ` Krzysztof Kozlowski
2026-03-25 14:06 ` Jonathan Cameron
2026-03-25 14:38 ` Sirat
2026-03-25 15:01 ` Jonathan Cameron
2026-03-25 6:32 ` [PATCH v7 2/2] iio: proximity: add driver for " Siratul Islam
2026-03-25 14:47 ` Jonathan Cameron
2026-03-25 16:33 ` Sirat
2026-03-25 19:47 ` Jonathan Cameron [this message]
2026-03-26 9:14 ` Andy Shevchenko
2026-04-12 15:40 ` Jonathan Cameron
2026-03-25 7:55 ` [PATCH v7 0/2] " Krzysztof Kozlowski
2026-03-25 8:23 ` Sirat
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260325194713.6e986590@jic23-huawei \
--to=jic23@kernel.org \
--cc=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=email@sirat.me \
--cc=jonathan.cameron@huawei.com \
--cc=krzk+dt@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox