提交 c7121843 编写于 作者: M Magnus Damm 提交者: Ingo Molnar

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: NMagnus 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: NThomas Gleixner <tglx@linutronix.de>
上级 4be3bd78
...@@ -293,7 +293,12 @@ static inline int clocksource_enable(struct clocksource *cs) ...@@ -293,7 +293,12 @@ static inline int clocksource_enable(struct clocksource *cs)
if (cs->enable) if (cs->enable)
ret = cs->enable(cs); 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; cs->mult_orig = cs->mult;
return ret; return ret;
...@@ -309,6 +314,13 @@ static inline int clocksource_enable(struct clocksource *cs) ...@@ -309,6 +314,13 @@ static inline int clocksource_enable(struct clocksource *cs)
*/ */
static inline void clocksource_disable(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) if (cs->disable)
cs->disable(cs); cs->disable(cs);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册