From: sashiko-bot@kernel.org
To: "Kurt Borja" <kuurtb@gmail.com>
Cc: devicetree@vger.kernel.org, conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH v4 09/10] iio: adc: ti-ads1262: support REFOUT and VBIAS regulators
Date: Fri, 28 Aug 2026 06:53:07 +0000 [thread overview]
Message-ID: <20260828065307.9006E1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260828-ads126x-v4-9-1dc27e9c0260@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Calling regulator_get_voltage() on a regulator's own supply from within its .get_voltage() callback causes a recursive locking self-deadlock.
--
commit ea8c096c3d3561a926dd5bc84b789c153ef1db68
Author: Kurt Borja <kuurtb@gmail.com>
iio: adc: ti-ads1262: support REFOUT and VBIAS regulators
This commit registers the "refout" and "vbias" regulators in the ti-ads1262
driver to enable their use as common mode supplies.
> diff --git a/drivers/iio/adc/ti-ads1262.c b/drivers/iio/adc/ti-ads1262.c
> index 3f6d34a08b296..4784142f35c9d 100644
> --- a/drivers/iio/adc/ti-ads1262.c
> +++ b/drivers/iio/adc/ti-ads1262.c
[ ... ]
> @@ -1132,6 +1133,120 @@ static irqreturn_t ads1262_irq_handler(int irq, void *dev_id)
> return IRQ_HANDLED;
> }
>
[ ... ]
> +static int ads1262_vbias_get_voltage(struct regulator_dev *rdev)
> +{
> + struct ads1262 *st = rdev_get_drvdata(rdev);
> + int avdd_uV, avss_uV;
> +
> + avdd_uV = regulator_get_voltage(st->avdd_supply);
[Severity: High]
Does this cause a recursive locking self-deadlock?
When a consumer or sysfs triggers a voltage query on vbias, the regulator
core calls regulator_lock_dependent(), which safely locks vbias and
recursively locks all of its supplies, including avdd.
The core then invokes vbias's .get_voltage callback, mapping to
ads1262_vbias_get_voltage(). Inside this callback, regulator_get_voltage()
acts as an external API: it initializes a new lock context and attempts
to lock avdd_supply again.
Because the current thread already holds the mutex for avdd, attempting
to lock it again with a new lock context results in a self-deadlock. A
thread attempting to read the vbias voltage will deadlock indefinitely,
causing a hang on that code path.
Could this approach use the unlocked internal API
regulator_get_voltage_rdev(rdev->supply->rdev) to get the supply's
voltage from within a regulator op instead?
> + if (avdd_uV < 0)
> + return avdd_uV;
> +
> + avss_uV = st->avss_supply ? regulator_get_voltage(st->avss_supply) : 0;
> + if (avss_uV < 0)
> + return avss_uV;
> +
> + return DIV_ROUND_CLOSEST(avdd_uV - avss_uV, 2);
> +}
[ ... ]
> +static const struct regulator_desc ads1262_vbias_regulator_desc = {
> + .name = "vbias",
> + .of_match = "vbias",
> + .regulators_node = "regulators",
> + .supply_name = "avdd",
[Severity: High]
This line establishes avdd as the upstream supply for vbias, which
instructs the regulator core that avdd is a strict dependency of vbias
and must be locked before dispatching operations to vbias ops. This is
what triggers the self-deadlock described above when
regulator_get_voltage() is called.
> + .ops = &ads1262_vbias_regulator_ops,
> + .type = REGULATOR_VOLTAGE,
> + .owner = THIS_MODULE,
> +};
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260828-ads126x-v4-0-1dc27e9c0260@gmail.com?part=9
next prev parent reply other threads:[~2026-08-28 6:53 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 6:38 [PATCH v4 00/10] iio: adc: Add TI ADS126X ADC family support Kurt Borja
2026-08-28 6:38 ` [PATCH v4 01/10] dt-bindings: adc: add excitation-current-chopping property Kurt Borja
2026-08-28 16:33 ` Conor Dooley
2026-08-28 6:38 ` [PATCH v4 02/10] dt-bindings: iio: adc: support the TI ADS126x ADC family Kurt Borja
2026-08-28 6:45 ` sashiko-bot
2026-08-28 16:39 ` Conor Dooley
2026-08-28 6:38 ` [PATCH v4 03/10] iio: adc: add the ti-ads1262 driver Kurt Borja
2026-08-28 6:52 ` sashiko-bot
2026-08-28 8:09 ` Andy Shevchenko
2026-08-28 6:38 ` [PATCH v4 04/10] iio: adc: ti-ads1262: support per-channel sampling frequency Kurt Borja
2026-08-28 7:03 ` sashiko-bot
2026-08-28 6:38 ` [PATCH v4 05/10] iio: adc: ti-ads1262: support per-channel reference and gain Kurt Borja
2026-08-28 6:38 ` [PATCH v4 06/10] iio: adc: ti-ads1262: support input chopping Kurt Borja
2026-08-28 6:38 ` [PATCH v4 07/10] iio: adc: ti-ads1262: support excitation currents Kurt Borja
2026-08-28 6:57 ` sashiko-bot
2026-08-28 6:38 ` [PATCH v4 08/10] iio: adc: ti-ads1262: support triggered buffer sampling Kurt Borja
2026-08-28 6:57 ` sashiko-bot
2026-08-28 6:38 ` [PATCH v4 09/10] iio: adc: ti-ads1262: support REFOUT and VBIAS regulators Kurt Borja
2026-08-28 6:53 ` sashiko-bot [this message]
2026-08-28 6:38 ` [PATCH v4 10/10] iio: adc: ti-ads1262: support common mode supplies Kurt Borja
2026-08-28 7:03 ` 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=20260828065307.9006E1F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=kuurtb@gmail.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