aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/time/ntp.c
diff options
context:
space:
mode:
authorRoman Zippel <zippel@linux-m68k.org>2008-09-22 17:42:44 -0400
committerThomas Gleixner <tglx@linutronix.de>2008-09-24 11:33:13 -0400
commitd40e944c25fb4642adb2a4c580a48218a9f3f824 (patch)
tree9be7107440704a84d17f9dde12991915931c5279 /kernel/time/ntp.c
parent5cd1c9c5cf30d4b33df3d3f74d8142f278d536b7 (diff)
ntp: improve adjtimex frequency rounding
Change PPM_SCALE_INV_SHIFT so that it doesn't throw away any input bits (19 is the amount of the factor 2 in PPM_SCALE), the output frequency can then be calculated back to its input value, as the inverse divide produce a slightly larger value, which is then correctly rounded by the final shift. Reported-by: Martin Ziegler <ziegler@uni-freiburg.de> Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Cc: John Stultz <johnstul@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/time/ntp.c')
-rw-r--r--kernel/time/ntp.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 450a45cb01c1..ddb0465a6baa 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -406,9 +406,8 @@ adj_done:
406 if (time_status & (STA_UNSYNC|STA_CLOCKERR)) 406 if (time_status & (STA_UNSYNC|STA_CLOCKERR))
407 result = TIME_ERROR; 407 result = TIME_ERROR;
408 408
409 txc->freq = shift_right((s32)(time_freq >> PPM_SCALE_INV_SHIFT) * 409 txc->freq = shift_right((time_freq >> PPM_SCALE_INV_SHIFT) *
410 (s64)PPM_SCALE_INV, 410 (s64)PPM_SCALE_INV, NTP_SCALE_SHIFT);
411 NTP_SCALE_SHIFT);
412 txc->maxerror = time_maxerror; 411 txc->maxerror = time_maxerror;
413 txc->esterror = time_esterror; 412 txc->esterror = time_esterror;
414 txc->status = time_status; 413 txc->status = time_status;