Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Muhammad Abu Bakar" <m.abubakar365@yahoo.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 2/2] iio: pressure: add Sensirion SDP31 driver
Date: Sun, 20 Sep 2026 16:55:58 +0000	[thread overview]
Message-ID: <20260920165558.B09DA1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260920164724.32019-3-m.abubakar365@yahoo.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] iio: sdp31: missing sensor power-on delay after vdd enable
--

commit 29a27ea5bbd1f787014c3c0a7f644c621fff7ae3
Author: Muhammad Abu Bakar <m.abubakar365@yahoo.com>

iio: pressure: add Sensirion SDP31 driver

Add an IIO driver for the Sensirion SDP31 differential pressure sensor.
The device is accessed over I2C and reports differential pressure and
temperature. Each measurement is validated using the sensor's CRC-8
checksum.

> diff --git a/drivers/iio/pressure/sdp31.c b/drivers/iio/pressure/sdp31.c
> new file mode 100644
> index 0000000000000..e661a7af86271
> --- /dev/null
> +++ b/drivers/iio/pressure/sdp31.c
[ ... ]
> +static int sdp31_probe(struct i2c_client *client)
> +{
> +	struct device *dev = &client->dev;   /* #5 */
> +	struct iio_dev *indio_dev;
> +	struct sdp31_data *data;
> +	struct sdp31_reading r;
> +	int ret;
> +
> +	/* #9: get and enable the sensor's supply (auto-disabled on remove). */
> +	ret = devm_regulator_get_enable(dev, "vdd");
> +	if (ret)
> +		return dev_err_probe(dev, ret, "failed to enable regulator\n");
> +
> +	indio_dev = devm_iio_device_alloc(dev, sizeof(*data));
> +	if (!indio_dev)
> +		return -ENOMEM;
> +
> +	data = iio_priv(indio_dev);
> +	data->client = client;
> +
> +	ret = devm_mutex_init(dev, &data->lock);   /* #6 */
> +	if (ret)
> +		return ret;
> +
> +	/* #7: populate the shared CRC table exactly once, race-free. */
> +	DO_ONCE(crc8_populate_msb, sdp31_crc8_table, SDP31_CRC8_POLY);
> +
> +	/* Confirm the sensor is present and learn its scale factor. */
> +	ret = sdp31_measure(data, &r);
> +	if (ret)
> +		return dev_err_probe(dev, ret, "failed to read from sensor\n");  /* #8 */

[Severity: Medium]
Will this I2C transaction fail if the sensor is still booting?

The driver calls devm_regulator_get_enable() to turn on the vdd supply and
then almost immediately calls sdp31_measure() to communicate with the sensor.
If the regulator physically toggles power, the sensor might still be in its
hardware initialization sequence and could NACK the initial I2C trigger
command.

Does this need a startup delay between enabling the regulator and the first I2C
transaction to ensure the sensor is fully ready to process commands, preventing
an unconditional probe failure on such platforms?

> +	if (!r.scale)
> +		return dev_err_probe(dev, -EINVAL, "invalid scale factor\n");
> +	data->dp_scale = r.scale;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260920164724.32019-1-m.abubakar365@yahoo.com?part=2

  reply	other threads:[~2026-09-20 16:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260920164724.32019-1-m.abubakar365.ref@yahoo.com>
2026-09-20 16:47 ` [PATCH v2 0/2] iio: pressure: add Sensirion SDP31 driver Muhammad Abu Bakar
2026-09-20 16:47   ` [PATCH v2 1/2] dt-bindings: iio: pressure: add Sensirion SDP31 Muhammad Abu Bakar
2026-09-24 13:04     ` Krzysztof Kozlowski
2026-09-20 16:47   ` [PATCH v2 2/2] iio: pressure: add Sensirion SDP31 driver Muhammad Abu Bakar
2026-09-20 16:55     ` sashiko-bot [this message]
2026-09-25  2:13     ` Jonathan Cameron
2026-09-24 13:03   ` [PATCH v2 0/2] " Krzysztof Kozlowski

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=20260920165558.B09DA1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=m.abubakar365@yahoo.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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