Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f153d017 authored by Russell King's avatar Russell King
Browse files

ARM: sync sched_clock() state on suspend



Ensure that the software state for sched_clock() is updated at the
point of suspend so that we avoid losing ticks since the last update.

This prevents the platform dependent possibility that sched_clock()
may appear to go backwards across a suspend/resume cycle.

Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 8211ca65
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@
#include <linux/jiffies.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/syscore_ops.h>
#include <linux/timer.h>

#include <asm/sched_clock.h>
@@ -164,3 +165,20 @@ void __init sched_clock_postinit(void)

	sched_clock_poll(sched_clock_timer.data);
}

static int sched_clock_suspend(void)
{
	sched_clock_poll(sched_clock_timer.data);
	return 0;
}

static struct syscore_ops sched_clock_ops = {
	.suspend = sched_clock_suspend,
};

static int __init sched_clock_syscore_init(void)
{
	register_syscore_ops(&sched_clock_ops);
	return 0;
}
device_initcall(sched_clock_syscore_init);