From: Anton Blanchard <anton@samba•org>
To: benh@kernel•crashing.org, paulus@samba•org, johnstul@us•ibm.com,
miltonm@bga•com
Cc: linuxppc-dev@lists•ozlabs.org
Subject: [PATCH 3/6] powerpc/time: Use clocksource_register_hz
Date: Thu, 24 Nov 2011 17:07:19 +1100 [thread overview]
Message-ID: <20111124060847.282144743@samba.org> (raw)
In-Reply-To: 20111124060716.362614789@samba.org
Use clocksource_register_hz which calculates the shift/mult
factors for us. Also remove the shift = 22 assumption in
vsyscall_update - thanks to Paul Mackerras and John Stultz for
catching that.
Signed-off-by: Anton Blanchard <anton@samba•org>
---
Index: linux-build/arch/powerpc/kernel/time.c
===================================================================
--- linux-build.orig/arch/powerpc/kernel/time.c 2011-11-17 10:11:51.175038860 +1100
+++ linux-build/arch/powerpc/kernel/time.c 2011-11-17 10:11:55.547114957 +1100
@@ -86,8 +86,6 @@ static struct clocksource clocksource_rt
.rating = 400,
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
.mask = CLOCKSOURCE_MASK(64),
- .shift = 22,
- .mult = 0, /* To be filled in */
.read = rtc_read,
};
@@ -97,8 +95,6 @@ static struct clocksource clocksource_ti
.rating = 400,
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
.mask = CLOCKSOURCE_MASK(64),
- .shift = 22,
- .mult = 0, /* To be filled in */
.read = timebase_read,
};
@@ -822,9 +818,8 @@ void update_vsyscall(struct timespec *wa
++vdso_data->tb_update_count;
smp_mb();
- /* XXX this assumes clock->shift == 22 */
- /* 4611686018 ~= 2^(20+64-22) / 1e9 */
- new_tb_to_xs = (u64) mult * 4611686018ULL;
+ /* 19342813113834067 ~= 2^(20+64) / 1e9 */
+ new_tb_to_xs = (u64) mult * (19342813113834067ULL >> clock->shift);
new_stamp_xsec = (u64) wall_time->tv_nsec * XSEC_PER_SEC;
do_div(new_stamp_xsec, 1000000000);
new_stamp_xsec += (u64) wall_time->tv_sec * XSEC_PER_SEC;
@@ -875,9 +870,7 @@ static void __init clocksource_init(void
else
clock = &clocksource_timebase;
- clock->mult = clocksource_hz2mult(tb_ticks_per_sec, clock->shift);
-
- if (clocksource_register(clock)) {
+ if (clocksource_register_hz(clock, tb_ticks_per_sec)) {
printk(KERN_ERR "clocksource: %s is already registered\n",
clock->name);
return;
next prev parent reply other threads:[~2011-11-24 6:07 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-24 6:07 [PATCH 0/6] ppc time fixes Anton Blanchard
2011-11-24 6:07 ` [PATCH 1/6] powerpc/time: Handle wrapping of decrementer Anton Blanchard
2011-11-28 17:44 ` Scott Wood
2011-11-28 20:01 ` Benjamin Herrenschmidt
2011-11-24 6:07 ` [PATCH 2/6] powerpc/time: Use clockevents_calc_mult_shift Anton Blanchard
2011-11-24 6:25 ` Kumar Gala
2011-11-28 11:47 ` Anton Blanchard
2011-11-24 6:07 ` Anton Blanchard [this message]
2011-11-28 23:30 ` [PATCH 3/6] powerpc/time: Use clocksource_register_hz john stultz
2011-11-24 6:07 ` [PATCH 4/6] powerpc/time: Remove unnecessary sanity check of decrementer expiration Anton Blanchard
2011-11-24 6:07 ` [PATCH 5/6] powerpc/time: Fix some style issues Anton Blanchard
2011-11-24 6:07 ` [PATCH 6/6] powerpc/time: Optimise decrementer_check_overflow Anton Blanchard
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=20111124060847.282144743@samba.org \
--to=anton@samba$(echo .)org \
--cc=benh@kernel$(echo .)crashing.org \
--cc=johnstul@us$(echo .)ibm.com \
--cc=linuxppc-dev@lists$(echo .)ozlabs.org \
--cc=miltonm@bga$(echo .)com \
--cc=paulus@samba$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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