aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorMagnus Damm <damm@opensource.se>2010-02-02 14:41:41 -0800
committerThomas Gleixner <tglx@linutronix.de>2010-02-05 14:54:10 +0100
commitc54a42b19fbaae4e9f212322ecca25a6bc95c1ba (patch)
tree2c929d3cde3b4ae864d5f5a50bdda688fd5293eb /kernel
parent17622339af2536b32cf29699ddd4ba0fe79a61d5 (diff)
downloadkernel_samsung_aries-c54a42b19fbaae4e9f212322ecca25a6bc95c1ba.zip
kernel_samsung_aries-c54a42b19fbaae4e9f212322ecca25a6bc95c1ba.tar.gz
kernel_samsung_aries-c54a42b19fbaae4e9f212322ecca25a6bc95c1ba.tar.bz2
clocksource: add suspend callback
Add a clocksource suspend callback. This callback can be used by the clocksource driver to shutdown and perform any kind of late suspend activities even though the clocksource driver itself is a non-sysdev driver. One example where this is useful is to fix the sh_cmt.c platform driver that today suspends using the platform bus and shuts down the clocksource too early. With this callback in place the sh_cmt driver will suspend using the clocksource and clockevent hooks and leave the platform device pm callbacks unused. Signed-off-by: Magnus Damm <damm@opensource.se> Cc: Paul Mundt <lethal@linux-sh.org> Cc: john stultz <johnstul@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/time/clocksource.c12
-rw-r--r--kernel/time/timekeeping.c1
2 files changed, 13 insertions, 0 deletions
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 08adacb..bd24666 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -441,6 +441,18 @@ static inline int clocksource_watchdog_kthread(void *data) { return 0; }
#endif /* CONFIG_CLOCKSOURCE_WATCHDOG */
/**
+ * clocksource_suspend - suspend the clocksource(s)
+ */
+void clocksource_suspend(void)
+{
+ struct clocksource *cs;
+
+ list_for_each_entry_reverse(cs, &clocksource_list, list)
+ if (cs->suspend)
+ cs->suspend(cs);
+}
+
+/**
* clocksource_resume - resume the clocksource(s)
*/
void clocksource_resume(void)
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 7faaa32..843d8a7 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -622,6 +622,7 @@ static int timekeeping_suspend(struct sys_device *dev, pm_message_t state)
write_sequnlock_irqrestore(&xtime_lock, flags);
clockevents_notify(CLOCK_EVT_NOTIFY_SUSPEND, NULL);
+ clocksource_suspend();
return 0;
}