Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Javier Carrasco" <javier.carrasco.cruz@gmail.com>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v3 08/11] hwmon: chipcap2: balance regulator state
Date: Wed, 14 Oct 2026 18:38:03 +0000	[thread overview]
Message-ID: <sashiko-outbox-171716@kernel.org> (raw)
In-Reply-To: <20261014-chipcap2_locks-v3-8-27ebfc2c5b9e@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] hwmon: permanent timeout when regulator is always-on
--

commit 5c82eb519f9635342c52ec29776d87d3ed1c197e
Author: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Subject: hwmon: chipcap2: balance regulator state

This commit adds a regulator_enabled flag to track the regulator state
within the driver, ensuring balanced calls to regulator_enable() and
regulator_disable(). This addresses issues where regulator_is_enabled()
might return unexpected values or when the regulator is configured as
always-on in the device tree.

[Severity: High]
Could this cause a permanent timeout when reading measurements if the device
is connected to an always-on regulator?

In drivers/hwmon/chipcap2.c around line 407, cc2_measurement() expects the
device to automatically start a measurement upon being enabled:

cc2_measurement()
    ret = cc2_enable(data);

If the regulator is marked as always-on in the device tree, the earlier
call to cc2_disable() will successfully drop the regulator reference, but it
will not physically remove power from the chip.

When cc2_enable() is called again, it will see data->regulator_enabled is
false, enable the regulator reference, and return successfully. Because the
chip was never physically power-cycled, it will not initiate an automatic
measurement upon power-on reset.

Since the driver does not explicitly send a measurement command in
cc2_measurement(), the device will never produce new data or fire the ready
interrupt. This appears to cause the wait_for_completion_timeout() call in
cc2_read_measurement() (around line 389) to permanently time out:

    ret = wait_for_completion_timeout(&data->complete, timeout);
    if (!ret)
        return -ETIMEDOUT;

Is there a need to explicitly trigger a measurement command if the regulator
was not actually toggled, or to verify if a power-on reset physically
occurred?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261014-chipcap2_locks-v3-0-27ebfc2c5b9e@gmail.com?part=8

  reply	other threads:[~2026-10-14 18:38 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14 17:33 [PATCH v3 00/11] hwmon: chipcap2: various bug fixes Javier Carrasco
2026-10-14 17:34 ` [PATCH v3 01/11] hwmon: chipcap2: fix command error diagnostics Javier Carrasco
2026-10-14 17:50   ` sashiko-bot
2026-10-14 17:34 ` [PATCH v3 02/11] hwmon: chipcap2: fix off-by-one in command mode retry loop Javier Carrasco
2026-10-14 18:01   ` sashiko-bot
2026-10-14 20:11     ` Javier Carrasco
2026-10-14 17:34 ` [PATCH v3 03/11] hwmon: chipcap2: fix be16 handling Javier Carrasco
2026-10-14 18:08   ` sashiko-bot
2026-10-14 17:34 ` [PATCH v3 04/11] hwmon: chipcap2: defer probe when IRQs are unavailable Javier Carrasco
2026-10-14 18:14   ` sashiko-bot
2026-10-14 17:34 ` [PATCH v3 05/11] hwmon: chipcap2: fix IRQ teardown ordering Javier Carrasco
2026-10-14 18:22   ` sashiko-bot
2026-10-14 17:34 ` [PATCH v3 06/11] hwmon: chipcap2: disable device after hwmon teardown Javier Carrasco
2026-10-14 18:34   ` sashiko-bot
2026-10-14 17:34 ` [PATCH v3 07/11] hwmon: chipcap2: enable IRQ processing when regulator is already enabled Javier Carrasco
2026-10-14 18:36   ` sashiko-bot
2026-10-14 17:34 ` [PATCH v3 08/11] hwmon: chipcap2: balance regulator state Javier Carrasco
2026-10-14 18:38   ` sashiko-bot [this message]
2026-10-14 17:34 ` [PATCH v3 09/11] hwmon: chipcap2: do not discard pending alarms on disable Javier Carrasco
2026-10-14 18:38   ` sashiko-bot
2026-10-14 17:34 ` [PATCH v3 10/11] hwmon: chipcap2: serialize access to the alarm indicators Javier Carrasco
2026-10-14 18:35   ` sashiko-bot
2026-10-14 17:34 ` [PATCH v3 11/11] hwmon: chipcap2: synchronize ready IRQ state Javier Carrasco
2026-10-14 18:41   ` sashiko-bot

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=sashiko-outbox-171716@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=javier.carrasco.cruz@gmail.com \
    --cc=linux-hwmon@vger.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