public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clocksource: save mult_orig in clocksource_disable()
@ 2009-06-18 15:24 Magnus Damm
  2009-06-18 19:17 ` john stultz
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Magnus Damm @ 2009-06-18 15:24 UTC (permalink / raw)
  To: linux-kernel; +Cc: johnstul, mingo, lethal, tglx, akpm, Magnus Damm

From: Magnus Damm <damm@igel.co.jp>

Save clocksource mult_orig in clocksource_disable().

To fix the common case where ->enable() does not setup
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>
---

 include/linux/clocksource.h |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

--- 0001/include/linux/clocksource.h
+++ work/include/linux/clocksource.h	2009-06-19 00:12:16.000000000 +0900
@@ -293,7 +293,11 @@ static inline int clocksource_enable(str
 	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 +313,12 @@ static inline int clocksource_enable(str
  */
 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);
 }

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-07-31 17:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-18 15:24 [PATCH] clocksource: save mult_orig in clocksource_disable() Magnus Damm
2009-06-18 19:17 ` john stultz
2009-06-26  5:30   ` Magnus Damm
2009-07-31 12:18     ` Ingo Molnar
2009-07-31 14:23       ` Magnus Damm
2009-07-31 17:33         ` john stultz
2009-07-31 17:28       ` john stultz
2009-07-30 19:57 ` [tip:timers/urgent] " tip-bot for Magnus Damm
2009-07-31 12:16 ` [tip:timers/urgent] clocksource: Save " tip-bot for Magnus Damm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox