Skip to contentSkip to conversation

2.6.22-rc2 built on ppc (2)

DISCUSSION Elimar Riesebieter 4 participants 6 messages May 20, 2007 – May 21, 2007 Timekeeping, clocksource core, NTP, alarmtimer

lore
Share & tools
lore
#0 lore raw

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

Signature · 2 lines
  Never make anything simple and efficient when a way
  can be found to make it complex and wonderful ;-)
#1 lore raw
Quoted 8 lines · On Sun, 20 May 2007 13:08:15 +0200 Elimar Riesebieter <[email protected]> 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..

#2 lore raw

Hi,

Quoted 11 lines · Andrew Morton
Quoted 8 lines · On Sun, 20 May 2007 13:08:15 +0200 Elimar Riesebieter <[email protected]> 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

Quoted 4 lines

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

#3 lore raw
In reply to Andrew Morton
Quoted 11 lines · Andrew Morton
Quoted 8 lines · On Sun, 20 May 2007 13:08:15 +0200 Elimar Riesebieter <[email protected]> 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

Quoted 4 lines

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()

Quoted 5 lines
Quoted 2 lines

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()

kernel/time/ntp.c +4 -2
index cb25649..bb1bf86 100644
@@ -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;
 			}
 		    }
#4 lore raw

Hi,

Quoted 9 lines · Thomas Gleixner
kernel/time/ntp.c +0 -1
index cb25649..bb1bf86 100644
@@ -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);

kernel/time/ntp.c int do_adjtimex(struct timex *txc) · line 315

Quoted 10 lines
kernel/time/ntp.c +4 -1
+			    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

#5 lore raw
Quoted 1 line · Roman Zippel

This only returns a long.

Damn, you're right.

tglx