public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Make the kernel NTP code hand 64-bit *unsigned* values to do_div() [try #2]
@ 2008-02-21 16:49 David Howells
  2008-02-21 16:51 ` David Howells
  0 siblings, 1 reply; 2+ messages in thread
From: David Howells @ 2008-02-21 16:49 UTC (permalink / raw)
  To: torvalds, akpm, zippel, schwab; +Cc: linux-kernel, dhowells

From: David Howells <dhowells@redhat.com>

The kernel NTP code shouldn't hand 64-bit *signed* values to do_div().  Make it
instead hand 64-bit unsigned values.  This gets rid of a couple of warnings.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 kernel/time/ntp.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)


diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index c88b591..3bead00 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -342,13 +342,15 @@ int do_adjtimex(struct timex *txc)
 		    freq_adj = shift_right(freq_adj, time_constant * 2 +
 					   (SHIFT_PLL + 2) * 2 - SHIFT_NSEC);
 		    if (mtemp >= MINSEC && (time_status & STA_FLL || mtemp > MAXSEC)) {
+			u64 utemp64;
 			temp64 = time_offset << (SHIFT_NSEC - SHIFT_FLL);
 			if (time_offset < 0) {
-			    temp64 = -temp64;
-			    do_div(temp64, mtemp);
+			    utemp64 = -temp64;
+			    do_div(utemp64, mtemp);
 			    freq_adj -= temp64;
 			} else {
-			    do_div(temp64, mtemp);
+			    utemp64 = temp64;
+			    do_div(utemp64, mtemp);
 			    freq_adj += temp64;
 			}
 		    }


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

* Re: [PATCH] Make the kernel NTP code hand 64-bit *unsigned* values to do_div() [try #2]
  2008-02-21 16:49 [PATCH] Make the kernel NTP code hand 64-bit *unsigned* values to do_div() [try #2] David Howells
@ 2008-02-21 16:51 ` David Howells
  0 siblings, 0 replies; 2+ messages in thread
From: David Howells @ 2008-02-21 16:51 UTC (permalink / raw)
  Cc: dhowells, torvalds, akpm, zippel, schwab, linux-kernel

David Howells <dhowells@redhat.com> wrote:

> Subject: [PATCH] Make the kernel NTP code hand 64-bit *unsigned* values to
> 	do_div() [try #2]

Ignore try #2.  I forgot to commit the changes before mailing.

David

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

end of thread, other threads:[~2008-02-21 16:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-21 16:49 [PATCH] Make the kernel NTP code hand 64-bit *unsigned* values to do_div() [try #2] David Howells
2008-02-21 16:51 ` David Howells

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