summaryrefslogtreecommitdiffstats
path: root/include/linux/clocksource.h
diff options
context:
space:
mode:
authorMagnus Damm <magnus.damm@gmail.com>2009-07-28 14:09:55 -0700
committerIngo Molnar <mingo@elte.hu>2009-07-31 14:12:36 +0200
commitc7121843685de2bf7f3afd3ae1d6a146010bf1fc (patch)
treef3a098159b8463386cd6d55b6272b6604bfbb9ce /include/linux/clocksource.h
parent4be3bd7849165e7efa6b0b35a23d6a3598d97465 (diff)
downloadop-kernel-dev-c7121843685de2bf7f3afd3ae1d6a146010bf1fc.zip
op-kernel-dev-c7121843685de2bf7f3afd3ae1d6a146010bf1fc.tar.gz
clocksource: Save mult_orig in clocksource_disable()
To fix the common case where ->enable() does not set up mult, make sure mult_orig is saved in mult on disable. Also add comments to explain why we do this. Signed-off-by: Magnus Damm <damm@igel.co.jp> Cc: johnstul@us.ibm.com Cc: lethal@linux-sh.org Cc: akpm@linux-foundation.org LKML-Reference: <20090618152432.10136.9932.sendpatchset@rx1.opensource.se> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/linux/clocksource.h')
-rw-r--r--include/linux/clocksource.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index c56457c..1219be4 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -293,7 +293,12 @@ static inline int clocksource_enable(struct clocksource *cs)
if (cs->enable)
ret = cs->enable(cs);
- /* save mult_orig on enable */
+ /*
+ * The frequency may have changed while the clocksource
+ * was disabled. If so the code in ->enable() must update
+ * the mult value to reflect the new frequency. Make sure
+ * mult_orig follows this change.
+ */
cs->mult_orig = cs->mult;
return ret;
@@ -309,6 +314,13 @@ static inline int clocksource_enable(struct clocksource *cs)
*/
static inline void clocksource_disable(struct clocksource *cs)
{
+ /*
+ * Save mult_orig in mult so clocksource_enable() can
+ * restore the value regardless if ->enable() updates
+ * the value of mult or not.
+ */
+ cs->mult = cs->mult_orig;
+
if (cs->disable)
cs->disable(cs);
}
OpenPOWER on IntegriCloud