From f153d017ab70d2954f5456278f3cbc39e6e060f3 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 4 Feb 2012 12:31:27 +0000 Subject: [PATCH] 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: Linus Walleij Signed-off-by: Russell King --- arch/arm/kernel/sched_clock.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/arch/arm/kernel/sched_clock.c b/arch/arm/kernel/sched_clock.c index 5416c7c12528..27d186abbc06 100644 --- a/arch/arm/kernel/sched_clock.c +++ b/arch/arm/kernel/sched_clock.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -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); -- 2.20.1