]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
ARM: sync sched_clock() state on suspend
authorRussell King <rmk+kernel@arm.linux.org.uk>
Sat, 4 Feb 2012 12:31:27 +0000 (12:31 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Sat, 24 Mar 2012 09:38:53 +0000 (09:38 +0000)
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 <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/kernel/sched_clock.c

index 5416c7c125289b201cb5c8db3c27b9bf8eeea298..27d186abbc06f8aa3aa6310faa5b67039d447f03 100644 (file)
@@ -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);