Commit-ID: c7121843685de2bf7f3afd3ae1d6a146010bf1fc Gitweb: http://git.kernel.org/tip/c7121843685de2bf7f3afd3ae1d6a146010bf1fc Author: Magnus Damm <magnus.damm@xxxxxxxxx> AuthorDate: Tue, 28 Jul 2009 14:09:55 -0700 Committer: Ingo Molnar <mingo@xxxxxxx> CommitDate: Fri, 31 Jul 2009 14:12:36 +0200 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@xxxxxxxxxx> Cc: johnstul@xxxxxxxxxx Cc: lethal@xxxxxxxxxxxx Cc: akpm@xxxxxxxxxxxxxxxxxxxx LKML-Reference: <20090618152432.10136.9932.sendpatchset@xxxxxxxxxxxxxxxxx> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx> --- include/linux/clocksource.h | 14 +++++++++++++- 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); } -- To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html