Files
rockchip-kernel/include/linux
Vincent Whitchurch a8ce7bd896 regulator: core: Fix off_on_delay handling
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>
2021-04-23 13:18:35 +01:00
..
2021-02-02 00:16:57 +01:00
2020-12-09 19:26:02 -06:00
2021-01-23 14:57:21 +01:00
2020-11-06 08:08:37 -08:00
2020-12-02 09:46:55 -07:00
2021-01-24 14:27:17 +01:00
2021-02-26 09:41:03 -08:00
2021-02-17 14:07:48 +01:00
2020-12-19 11:18:38 -08:00
2021-01-21 14:06:00 -07:00
2021-01-16 15:12:06 -05:00
2021-01-18 14:26:51 +01:00
2021-02-08 12:28:07 +01:00
2020-12-10 12:42:59 -06:00
2020-11-16 16:31:41 +01:00
2020-11-16 15:20:01 +01:00
2020-11-16 08:14:30 -07:00
2021-02-11 13:24:44 -08:00
2020-12-02 22:10:35 -08:00
2020-11-23 14:16:55 +00:00
2021-01-27 12:27:36 +01:00
2020-11-24 16:47:48 +01:00
2020-12-15 16:19:31 +01:00
2021-02-26 09:41:03 -08:00
2020-12-15 16:19:31 +01:00
2021-02-17 14:12:42 +01:00
2021-01-21 16:16:10 +00:00
2021-02-26 09:41:02 -08:00
2021-02-26 09:41:03 -08:00
2021-01-22 15:09:42 +01:00
2021-01-14 11:20:17 +01:00
2021-02-26 09:41:03 -08:00
2021-03-13 11:27:30 -08:00
2021-01-04 11:42:21 -05:00
2021-02-16 16:11:14 -05:00
2021-02-02 10:26:12 +01:00
2021-02-17 13:17:49 -08:00
2021-02-26 09:40:59 -08:00
2021-01-21 14:06:00 -07:00
2021-02-03 19:05:50 +01:00
2021-01-24 14:27:17 +01:00
2021-01-24 14:27:20 +01:00
2021-02-26 09:41:03 -08:00
2020-12-03 11:20:52 +01:00
2021-01-16 23:19:26 +01:00
2020-12-07 17:12:49 -07:00
2020-11-06 10:05:18 -08:00
2020-12-10 16:17:15 +01:00
2021-01-28 00:35:03 +01:00
2020-11-24 16:47:49 +01:00
2020-12-10 10:45:36 +01:00
2021-03-02 17:25:46 -07:00
2021-02-20 10:13:32 -05:00
2020-10-30 21:57:04 +01:00
2021-01-06 16:24:59 -08:00
2021-02-09 12:27:29 -05:00
2020-12-04 16:54:35 +01:00
2021-02-13 17:17:53 +01:00
2020-11-09 18:39:36 +01:00
2021-01-21 16:16:10 +00:00
2021-02-01 13:20:07 -07:00
2021-01-18 10:52:41 +01:00
2021-02-09 12:15:07 +01:00
2021-01-21 14:06:00 -07:00
2021-01-24 14:27:17 +01:00
2021-02-08 22:58:55 +01:00