From: sashiko-bot@kernel.org
To: "Chen-Yu Tsai" <wenst@chromium.org>
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org,
robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v6 1/8] regulator: core: Add "enable and wait" functions
Date: Tue, 01 Sep 2026 08:03:35 +0000 [thread overview]
Message-ID: <20260901080336.665A31F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260901074930.764550-2-wenst@chromium.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Mismatched timebase used for `last_off` initialization, which breaks `off_on_delay` semantics.
--
commit 4cf0bd57fa8e1cfa65a0e290c2b4a44f43cb23db
Author: Chen-Yu Tsai <wenst@chromium.org>
regulator: core: Add "enable and wait" functions
In device power sequencing and initialization use cases, it is common
for the driver to enable the regulator and then wait for a certain
period of time to pass before continuing. In cases where the regulator
supply is always on, or has been turned on or left on by another consumer,
the driver could shorten the delay or skip it altogether, provided that
enough time has already passed since the regulator was actually turned on.
> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> index 6a4008f387b5e..d7a193a3bcb28 100644
> --- a/drivers/regulator/core.c
> +++ b/drivers/regulator/core.c
[ ... ]
> @@ -3061,6 +3108,8 @@ static int _regulator_do_enable(struct regulator_dev *rdev)
> fsleep(delay);
> }
>
> + rdev->last_on = ktime_get_boottime();
> +
> trace_regulator_enable_complete(rdev_get_name(rdev));
>
> return 0;
[Severity: High]
This isn't a bug introduced by this patch, but since you are working with
timestamps in this function, could this timebase mismatch break off_on_delay
semantics?
In set_machine_constraints(), last_off is initialized with the monotonic clock:
rdev->last_off = ktime_get();
But earlier in _regulator_do_enable(), the remaining delay is calculated using
the boottime clock:
ktime_t end = ktime_add_us(rdev->last_off, rdev->desc->off_on_delay);
s64 remaining = ktime_us_delta(end, ktime_get_boottime());
Because ktime_get_boottime() includes suspend time and ktime_get() does not,
the required delay is bypassed entirely if the system has accumulated suspend
time greater than the off_on_delay.
Will this lead to hardware sequence violations and incorrect functional behavior
unconditionally for any regulator with an off_on_delay registered after the
system has been suspended (such as via hotplug or module load)?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260901074930.764550-1-wenst@chromium.org?part=1
next prev parent reply other threads:[~2026-09-01 8:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 7:49 [PATCH v6 0/8] arm64: mediatek: Chromebook trackpad supply fixes Chen-Yu Tsai
2026-09-01 7:49 ` [PATCH v6 1/8] regulator: core: Add "enable and wait" functions Chen-Yu Tsai
2026-09-01 8:03 ` sashiko-bot [this message]
2026-09-01 7:49 ` [PATCH v6 2/8] Input: elan_i2c - Wait for initialization after enabling regulator supply Chen-Yu Tsai
2026-09-01 7:49 ` [PATCH v6 3/8] HID: i2c-hid-of: skip post-power-on delay if powered on sufficiently long Chen-Yu Tsai
2026-09-01 8:01 ` sashiko-bot
2026-09-01 7:49 ` [PATCH v6 4/8] i2c: of-prober: " Chen-Yu Tsai
2026-09-01 8:02 ` sashiko-bot
2026-09-01 7:49 ` [PATCH v6 5/8] i2c: of-prober: Let cleanup op know if a device was found Chen-Yu Tsai
2026-09-01 7:49 ` [PATCH v6 6/8] i2c: of-prober: Defer regulator_disable() on successful probe in simple helper Chen-Yu Tsai
2026-09-01 7:49 ` [PATCH v6 7/8] arm64: dts: mediatek: mt8173-elm-hana: Unmark trackpad supply as always-on Chen-Yu Tsai
2026-09-01 7:49 ` [PATCH v6 8/8] arm64: dts: mediatek: mt8192-asurada-spherion: Add Synaptics trackpad's supply Chen-Yu Tsai
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=20260901080336.665A31F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=wenst@chromium.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