All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Elimar Riesebieter <riesebie@lxtec.de>,
	mingo@elte.hu, linux-kernel@vger.kernel.org,
	Roman Zippel <zippel@linux-m68k.org>
Subject: Re: 2.6.22-rc2 built on ppc (2)
Date: Mon, 21 May 2007 12:03:37 +0200	[thread overview]
Message-ID: <1179741817.6570.44.camel@chaos> (raw)
In-Reply-To: <20070520143752.2f6be87a.akpm@linux-foundation.org>

On Sun, 2007-05-20 at 14:37 -0700, Andrew Morton wrote:
> On Sun, 20 May 2007 13:08:15 +0200 Elimar Riesebieter <riesebie@lxtec.de> wrote:
> 
> > FYI, building 2.6.22-rc2 with
> > gcc (GCC) 4.1.3 20070514 (prerelease) (Debian 4.1.2-7)
> > on my powerbook (PPC) gives:
> > 
> > ...
> > kernel/time/ntp.c: In function 'do_adjtimex':
> > kernel/time/ntp.c:307: warning: comparison of distinct pointer types lacks a cast
> > kernel/time/ntp.c:310: warning: comparison of distinct pointer types lacks a cast
> 
> hm, do_div() is defined as operating on a u64, but ntp is passing it an s64
> and the asm-generic implementation of do_div() is warning about that.
> 
> Fixing that would be simple but a bit ugly.

We have the signed do_div() work around and it is used in the ntp code 5
lines further down already.

	tglx

--------------------------------->
Subject: NTP: use the signed divide function instead of do_div()

> > kernel/time/ntp.c:307: warning: comparison of distinct pointer types lacks a cast
> > kernel/time/ntp.c:310: warning: comparison of distinct pointer types lacks a cast
> 
> hm, do_div() is defined as operating on a u64, but ntp is passing it an s64
> and the asm-generic implementation of do_div() is warning about that.

Replace do_div() by div_long_long_rem_signed()

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index cb25649..bb1bf86 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -304,10 +304,12 @@ int do_adjtimex(struct timex *txc)
 			temp64 = time_offset << (SHIFT_NSEC - SHIFT_FLL);
 			if (time_offset < 0) {
 			    temp64 = -temp64;
-			    do_div(temp64, mtemp);
+			    temp64 = div_long_long_rem_signed(temp64, mtemp,
+							      &rem);
 			    freq_adj -= temp64;
 			} else {
-			    do_div(temp64, mtemp);
+			    temp64 = div_long_long_rem_signed(temp64, mtemp,
+							      &rem);
 			    freq_adj += temp64;
 			}
 		    }





  parent reply	other threads:[~2007-05-21  9:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-20 11:08 2.6.22-rc2 built on ppc (2) Elimar Riesebieter
2007-05-20 21:37 ` Andrew Morton
2007-05-21  1:54   ` Roman Zippel
2007-05-21 10:03   ` Thomas Gleixner [this message]
2007-05-21 10:25     ` Roman Zippel
2007-05-21 10:40       ` Thomas Gleixner

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=1179741817.6570.44.camel@chaos \
    --to=tglx@linutronix.de \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=riesebie@lxtec.de \
    --cc=zippel@linux-m68k.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.