public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* 2.6.22-rc2 built on ppc (2)
@ 2007-05-20 11:08 Elimar Riesebieter
  2007-05-20 21:37 ` Andrew Morton
  0 siblings, 1 reply; 6+ messages in thread
From: Elimar Riesebieter @ 2007-05-20 11:08 UTC (permalink / raw)
  To: mingo; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 578 bytes --]

Hi,

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
...

If more info is needed, please contact me via PM, as I am not
subscribed.

Thanks for your patience
Elimar

-- 
  Never make anything simple and efficient when a way
  can be found to make it complex and wonderful ;-)

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: 2.6.22-rc2 built on ppc (2)
  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
  0 siblings, 2 replies; 6+ messages in thread
From: Andrew Morton @ 2007-05-20 21:37 UTC (permalink / raw)
  To: Elimar Riesebieter; +Cc: mingo, linux-kernel, Roman Zippel

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.

The code around there needs to be taught about min_t and max_t, too..

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

* Re: 2.6.22-rc2 built on ppc (2)
  2007-05-20 21:37 ` Andrew Morton
@ 2007-05-21  1:54   ` Roman Zippel
  2007-05-21 10:03   ` Thomas Gleixner
  1 sibling, 0 replies; 6+ messages in thread
From: Roman Zippel @ 2007-05-21  1:54 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Elimar Riesebieter, mingo, linux-kernel

Hi,

On Sun, 20 May 2007, 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.

The correct fix would be to clean up that API and provide a signed 
do_div(), so ntp doesn't have to work around for the lack of it.
It's on my todo list for ages, but I haven't gotten to it yet.

bye, Roman

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

* Re: 2.6.22-rc2 built on ppc (2)
  2007-05-20 21:37 ` Andrew Morton
  2007-05-21  1:54   ` Roman Zippel
@ 2007-05-21 10:03   ` Thomas Gleixner
  2007-05-21 10:25     ` Roman Zippel
  1 sibling, 1 reply; 6+ messages in thread
From: Thomas Gleixner @ 2007-05-21 10:03 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Elimar Riesebieter, mingo, linux-kernel, Roman Zippel

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;
 			}
 		    }





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

* Re: 2.6.22-rc2 built on ppc (2)
  2007-05-21 10:03   ` Thomas Gleixner
@ 2007-05-21 10:25     ` Roman Zippel
  2007-05-21 10:40       ` Thomas Gleixner
  0 siblings, 1 reply; 6+ messages in thread
From: Roman Zippel @ 2007-05-21 10:25 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Andrew Morton, Elimar Riesebieter, mingo, linux-kernel

Hi,

On Mon, 21 May 2007, Thomas Gleixner wrote:

> 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;
>  			}
>  		    }

This only returns a long.

bye, Roman

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

* Re: 2.6.22-rc2 built on ppc (2)
  2007-05-21 10:25     ` Roman Zippel
@ 2007-05-21 10:40       ` Thomas Gleixner
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Gleixner @ 2007-05-21 10:40 UTC (permalink / raw)
  To: Roman Zippel; +Cc: Andrew Morton, Elimar Riesebieter, mingo, linux-kernel

On Mon, 2007-05-21 at 12:25 +0200, Roman Zippel wrote:

> This only returns a long.

Damn, you're right.

	tglx



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

end of thread, other threads:[~2007-05-21 10:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2007-05-21 10:25     ` Roman Zippel
2007-05-21 10:40       ` Thomas Gleixner

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