From: tip-bot for Magnus Damm <magnus.damm@gmail.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
damm@igel.co.jp, tglx@linutronix.de, magnus.damm@gmail.com
Subject: [tip:timers/urgent] clocksource: Save mult_orig in clocksource_disable()
Date: Fri, 31 Jul 2009 12:16:22 GMT [thread overview]
Message-ID: <tip-c7121843685de2bf7f3afd3ae1d6a146010bf1fc@git.kernel.org> (raw)
In-Reply-To: <20090618152432.10136.9932.sendpatchset@rx1.opensource.se>
Commit-ID: c7121843685de2bf7f3afd3ae1d6a146010bf1fc
Gitweb: http://git.kernel.org/tip/c7121843685de2bf7f3afd3ae1d6a146010bf1fc
Author: Magnus Damm <magnus.damm@gmail.com>
AuthorDate: Tue, 28 Jul 2009 14:09:55 -0700
Committer: Ingo Molnar <mingo@elte.hu>
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@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>
---
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);
}
prev parent reply other threads:[~2009-07-31 12:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
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-bot for Magnus Damm [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-c7121843685de2bf7f3afd3ae1d6a146010bf1fc@git.kernel.org \
--to=magnus.damm@gmail.com \
--cc=damm@igel.co.jp \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox