From: Lee Jones <lee@kernel.org>
To: lee@kernel.org, Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
Douglas Anderson <dianders@chromium.org>,
linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: [PATCH 06/10] regulator: core: Use ktime_get_boottime() in set_machine_constraints()
Date: Wed, 4 Nov 2026 18:20:56 +0000 [thread overview]
Message-ID: <20261104182148.1176116-7-lee@kernel.org> (raw)
In-Reply-To: <20261104182148.1176116-1-lee@kernel.org>
rdev->last_off is tracked against CLOCK_BOOTTIME in both
_regulator_do_enable() and _regulator_do_disable(), whereas
set_machine_constraints() initialises rdev->last_off using ktime_get()
(CLOCK_MONOTONIC). If the system suspends before a regulator with
off_on_delay is enabled, comparing a CLOCK_BOOTTIME timestamp against a
CLOCK_MONOTONIC timestamp produces an incorrect elapsed off-time.
Use ktime_get_boottime() in set_machine_constraints() so rdev->last_off
uses the same clock base everywhere.
Fixes: 691c1fcda535 ("regulator: core: Shorten off-on-delay-us for always-on/boot-on by time since booted")
Closes: https://sashiko.dev/#/bug/linux-4afd38c3-0589-4544-961d-4e3cc5ed8639
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
drivers/regulator/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 6d522731e4d9..6b5fae3cd486 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1698,7 +1698,7 @@ static int set_machine_constraints(struct regulator_dev *rdev,
if (rdev->constraints->always_on)
rdev->use_count++;
} else if (rdev->desc->off_on_delay) {
- rdev->last_off = ktime_get();
+ rdev->last_off = ktime_get_boottime();
}
if (!rdev->constraints->pw_budget_mW)
--
2.56.0.385.gac671c819a-goog
next prev parent reply other threads:[~2026-11-04 18:22 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 18:20 [PATCH 00/10] regulator: Fix teardown races, reference counting, and error handling Lee Jones
2026-11-04 18:20 ` [PATCH 01/10] regulator: irq_helpers: Clear caller handle in regulator_irq_helper_cancel() Lee Jones
2026-11-05 7:58 ` Matti Vaittinen
2026-11-04 18:20 ` [PATCH 02/10] regulator: arizona-ldo1: Avoid double gpiod_put() on enable GPIO Lee Jones
2026-11-05 10:08 ` Charles Keepax
2026-11-04 18:20 ` [PATCH 03/10] regulator: core: Flush delayed disable_work before releasing supply in regulator_unregister() Lee Jones
2026-11-04 18:20 ` [PATCH 04/10] regulator: arizona-micsupp: Cancel check_cp_work on device teardown Lee Jones
2026-11-05 10:15 ` Charles Keepax
2026-11-04 18:20 ` [PATCH 05/10] regulator: core: Hold supply device reference until constraints are resolved in regulator_resolve_supply() Lee Jones
2026-11-05 17:28 ` André Draszik
2026-11-04 18:20 ` Lee Jones [this message]
2026-11-04 18:20 ` [PATCH 07/10] regulator: bq257xx: Propagate GPIO error in bq257xx_reg_dt_parse_gpio() Lee Jones
2026-11-04 18:20 ` [PATCH 08/10] regulator: tps6594-regulator: Fix LDO4 n_voltages in tps6594_ldo_regs Lee Jones
2026-11-04 18:20 ` [PATCH 09/10] regulator: max8907: Avoid NULL idata dereference in max8907_regulator_probe() Lee Jones
2026-11-04 18:21 ` [PATCH 10/10] regulator: rt6190: Check pm_runtime_resume_and_get() return value in rt6190_out_enable() Lee Jones
2026-11-05 13:53 ` [PATCH 00/10] regulator: Fix teardown races, reference counting, and error handling Mark Brown
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=20261104182148.1176116-7-lee@kernel.org \
--to=lee@kernel.org \
--cc=broonie@kernel.org \
--cc=dianders@chromium.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.