You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: hrtimer: Make lookup table const RTC: Disable CONFIG_RTC_CLASS from being built as a module timers: Fix alarmtimer build issues when CONFIG_RTC_CLASS=n timers: Remove delayed irqwork from alarmtimers implementation timers: Improve alarmtimer comments and minor fixes timers: Posix interface for alarm-timers timers: Introduce in-kernel alarm-timer interface timers: Add rb_init_node() to allow for stack allocated rb nodes time: Add timekeeping_inject_sleeptime
This commit is contained in:
+1
-1
@@ -81,7 +81,7 @@ DEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) =
|
||||
}
|
||||
};
|
||||
|
||||
static int hrtimer_clock_to_base_table[MAX_CLOCKS] = {
|
||||
static const int hrtimer_clock_to_base_table[MAX_CLOCKS] = {
|
||||
[CLOCK_REALTIME] = HRTIMER_BASE_REALTIME,
|
||||
[CLOCK_MONOTONIC] = HRTIMER_BASE_MONOTONIC,
|
||||
[CLOCK_BOOTTIME] = HRTIMER_BASE_BOOTTIME,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
obj-y += timekeeping.o ntp.o clocksource.o jiffies.o timer_list.o timecompare.o
|
||||
obj-y += timeconv.o posix-clock.o
|
||||
obj-y += timeconv.o posix-clock.o alarmtimer.o
|
||||
|
||||
obj-$(CONFIG_GENERIC_CLOCKEVENTS_BUILD) += clockevents.o
|
||||
obj-$(CONFIG_GENERIC_CLOCKEVENTS) += tick-common.o
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -595,6 +595,58 @@ void __init timekeeping_init(void)
|
||||
/* time in seconds when suspend began */
|
||||
static struct timespec timekeeping_suspend_time;
|
||||
|
||||
/**
|
||||
* __timekeeping_inject_sleeptime - Internal function to add sleep interval
|
||||
* @delta: pointer to a timespec delta value
|
||||
*
|
||||
* Takes a timespec offset measuring a suspend interval and properly
|
||||
* adds the sleep offset to the timekeeping variables.
|
||||
*/
|
||||
static void __timekeeping_inject_sleeptime(struct timespec *delta)
|
||||
{
|
||||
xtime = timespec_add(xtime, *delta);
|
||||
wall_to_monotonic = timespec_sub(wall_to_monotonic, *delta);
|
||||
total_sleep_time = timespec_add(total_sleep_time, *delta);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* timekeeping_inject_sleeptime - Adds suspend interval to timeekeeping values
|
||||
* @delta: pointer to a timespec delta value
|
||||
*
|
||||
* This hook is for architectures that cannot support read_persistent_clock
|
||||
* because their RTC/persistent clock is only accessible when irqs are enabled.
|
||||
*
|
||||
* This function should only be called by rtc_resume(), and allows
|
||||
* a suspend offset to be injected into the timekeeping values.
|
||||
*/
|
||||
void timekeeping_inject_sleeptime(struct timespec *delta)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct timespec ts;
|
||||
|
||||
/* Make sure we don't set the clock twice */
|
||||
read_persistent_clock(&ts);
|
||||
if (!(ts.tv_sec == 0 && ts.tv_nsec == 0))
|
||||
return;
|
||||
|
||||
write_seqlock_irqsave(&xtime_lock, flags);
|
||||
timekeeping_forward_now();
|
||||
|
||||
__timekeeping_inject_sleeptime(delta);
|
||||
|
||||
timekeeper.ntp_error = 0;
|
||||
ntp_clear();
|
||||
update_vsyscall(&xtime, &wall_to_monotonic, timekeeper.clock,
|
||||
timekeeper.mult);
|
||||
|
||||
write_sequnlock_irqrestore(&xtime_lock, flags);
|
||||
|
||||
/* signal hrtimers about time change */
|
||||
clock_was_set();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* timekeeping_resume - Resumes the generic timekeeping subsystem.
|
||||
*
|
||||
@@ -615,9 +667,7 @@ static void timekeeping_resume(void)
|
||||
|
||||
if (timespec_compare(&ts, &timekeeping_suspend_time) > 0) {
|
||||
ts = timespec_sub(ts, timekeeping_suspend_time);
|
||||
xtime = timespec_add(xtime, ts);
|
||||
wall_to_monotonic = timespec_sub(wall_to_monotonic, ts);
|
||||
total_sleep_time = timespec_add(total_sleep_time, ts);
|
||||
__timekeeping_inject_sleeptime(&ts);
|
||||
}
|
||||
/* re-base the last cycle value */
|
||||
timekeeper.clock->cycle_last = timekeeper.clock->read(timekeeper.clock);
|
||||
|
||||
Reference in New Issue
Block a user