mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00
The jiffies-based off_on_delay implementation has a couple of problems
that cause it to sometimes not actually delay for the required time:
(1) If, for example, the off_on_delay time is equivalent to one jiffy,
and the ->last_off_jiffy is set just before a new jiffy starts,
then _regulator_do_enable() does not wait at all since it checks
using time_before().
(2) When jiffies overflows, the value of "remaining" becomes higher
than "max_delay" and the code simply proceeds without waiting.
Fix these problems by changing it to use ktime_t instead.
[Note that since jiffies doesn't start at zero but at INITIAL_JIFFIES
("-5 minutes"), (2) above also led to the code not delaying if
the first regulator_enable() is called when the ->last_off_jiffy is not
initialised, such as for regulators with ->constraints->boot_on set.
It's not clear to me if this was intended or not, but I've preserved
this behaviour explicitly with the check for a non-zero ->last_off.]
Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
Link: https://lore.kernel.org/r/20210423114524.26414-1-vincent.whitchurch@axis.com
Signed-off-by: Mark Brown <broonie@kernel.org>
|
||
|---|---|---|
| .. | ||
| act8865.h | ||
| arizona-ldo1.h | ||
| arizona-micsupp.h | ||
| consumer.h | ||
| coupler.h | ||
| da9121.h | ||
| da9211.h | ||
| db8500-prcmu.h | ||
| driver.h | ||
| fan53555.h | ||
| fixed.h | ||
| gpio-regulator.h | ||
| lp872x.h | ||
| lp3971.h | ||
| lp3972.h | ||
| machine.h | ||
| max1586.h | ||
| max8649.h | ||
| max8660.h | ||
| max8952.h | ||
| max8973-regulator.h | ||
| mt6311.h | ||
| mt6315-regulator.h | ||
| mt6323-regulator.h | ||
| mt6358-regulator.h | ||
| mt6380-regulator.h | ||
| mt6397-regulator.h | ||
| of_regulator.h | ||
| pca9450.h | ||
| pfuze100.h | ||
| tps6507x.h | ||
| tps51632-regulator.h | ||
| tps62360.h | ||
| userspace-consumer.h | ||