Skip to contentSkip to conversation

gcc-4.0 allyesconfig fixes

PATCH In review Benoit Boissinot 4 participants 5 messages Jan 20, 2005 – Jan 21, 2005

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gcc-4.0 allyesconfig fixes

Hi,

the following patch (against latest -mm), correct compilation errors with gcc-4.0 (snapshot 20050116).

please correct me if i did something wrong, this is my first patch with the linux kernel.

Benoit

drivers/char/generic_serial.c +1 -1
diff -Naurp --exclude=ctags linux-clean/drivers/char/generic_serial.c linux-2.6-mm-test/drivers/char/generic_serial.c
@@ -36,7 +36,7 @@
 static char *                  tmp_buf; 
 static DECLARE_MUTEX(tmp_buf_sem);
 
-static int gs_debug;
+int gs_debug;
 
 #ifdef DEBUG
 #define gs_dprintk(f, str...) if (gs_debug & f) printk (str)
drivers/net/s2io.h +2 -2
diff -Naurp --exclude=ctags linux-clean/drivers/net/s2io.h linux-2.6-mm-test/drivers/net/s2io.h
@@ -739,8 +739,8 @@ typedef struct s2io_nic {
 static inline u64 readq(void __iomem *addr)
 {
 	u64 ret = readl(addr + 4);
-	(u64) ret <<= 32;
-	(u64) ret |= readl(addr);
+	ret = ret << 32;
+	ret = ret | readl(addr);
 
 	return ret;
 }

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#1 lore raw

Hi Benoit,
i do not think this will work. Numbers are int and i already got some strange effects because of that (perhaps gcc 4.0 will handle this better but dont count on it). please use: ret= ret << 32L;

on the other side: does readl() return long() ? perhaps it can return a real 64bit value on a 64bit box ? then whole code is broken.

re,
walter

Quoted 41 lines · Benoit Boissinot

Hi,

the following patch (against latest -mm), correct compilation errors with gcc-4.0 (snapshot 20050116).

please correct me if i did something wrong, this is my first patch with the linux kernel.

Benoit

diff -Naurp --exclude=ctags linux-clean/drivers/char/generic_serial.c linux-2.6-mm-test/drivers/char/generic_serial.c

drivers/char/generic_serial.c +1 -1
@@ -36,7 +36,7 @@
 static char *                  tmp_buf; 
 static DECLARE_MUTEX(tmp_buf_sem);
 
-static int gs_debug;
+int gs_debug;
 
 #ifdef DEBUG
 #define gs_dprintk(f, str...) if (gs_debug & f) printk (str)

diff -Naurp --exclude=ctags linux-clean/drivers/net/s2io.h linux-2.6-mm-test/drivers/net/s2io.h

drivers/net/s2io.h +2 -3
@@ -739,8 +739,8 @@ typedef struct s2io_nic {
 static inline u64 readq(void __iomem *addr)
 {
 	u64 ret = readl(addr + 4);
-	(u64) ret <<= 32;
-	(u64) ret |= readl(addr);
+	ret = ret << 32;
+	ret = ret | readl(addr);
 
 	return ret;
 }
 
 
 
------------------------------------------------------------------------
Quoted 4 lines

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#2 lore raw

PATCH 1/1 generic_serial.h: kill incorrect gs_debug reference

In reply to Benoit Boissinot
Quoted 14 lines · Benoit Boissinot

Hi,

the following patch (against latest -mm), correct compilation errors with gcc-4.0 (snapshot 20050116).

please correct me if i did something wrong, this is my first patch with the linux kernel.

Benoit

diff -Naurp --exclude=ctags linux-clean/drivers/char/generic_serial.c linux-2.6-mm-test/drivers/char/generic_serial.c

drivers/char/generic_serial.c line 39

Quoted 6 lines
drivers/char/generic_serial.c +1 -1
@@ -36,7 +36,7 @@
 static char *                  tmp_buf; 
 static DECLARE_MUTEX(tmp_buf_sem);
 
-static int gs_debug;
+int gs_debug;
...

This part seems to be wrong.

Correct patch below.

<-- snip -->

generic_serial.h contained an incorrect extern reference to the static variable gs_debug (Benoit Boissinot reported that gcc 4.0 rejects this).

include/linux/generic_serial.h renamed from include/linux/generic_serial.h.old +0 -2
@@ -93,6 +93,4 @@
 int  gs_getserial(struct gs_port *port, struct serial_struct __user *sp);
 void gs_got_break(struct gs_port *port);
 
-extern int gs_debug;
-
 #endif

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#3 lore raw
In reply to Benoit Boissinot
Quoted 11 lines · walter harms

Hi Benoit,
i do not think this will work. Numbers are int and i already got some strange effects because of that (perhaps gcc 4.0 will handle this better but dont count on it). please use: ret= ret << 32L;

on the other side: does readl() return long() ? perhaps it can return a real 64bit value on a 64bit box ? then whole code is broken.

re,
walter

Is the following patch better ?
I checked the return type of readl, it is a 32bit integer.

drivers/net/s2io.h +3 -3
@@ -738,9 +738,9 @@ typedef struct s2io_nic {
 #ifndef readq
 static inline u64 readq(void __iomem *addr)
 {
-	u64 ret = readl(addr + 4);
-	(u64) ret <<= 32;
-	(u64) ret |= readl(addr);
+	u64 ret = (u64) readl(addr + 4);
+	ret <<= 32;
+	ret |= (u64) readl(addr);
 
 	return ret;
 }

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#4 lore raw
In reply to Benoit Boissinot

drivers/net/s2io.h typedef struct s2io_nic { · line 741

Quoted 13 lines · Benoit Boissinot

Is the following patch better ?
I checked the return type of readl, it is a 32bit integer.

drivers/net/s2io.h +1 -3
@@ -738,9 +738,9 @@ typedef struct s2io_nic {
 #ifndef readq
 static inline u64 readq(void __iomem *addr)
 {
-	u64 ret = readl(addr + 4);
-	(u64) ret <<= 32;
-	(u64) ret |= readl(addr);
+	u64 ret = (u64) readl(addr + 4);

No need to cast, it's automatic.

drivers/net/s2io.h typedef struct s2io_nic { · line 743

Quoted 2 lines
drivers/net/s2io.h +2 -0
+	ret <<= 32;
+	ret |= (u64) readl(addr);

Ditto here.

So the correct form would be:

	u64 ret = readl(addr + 4);
	ret <<= 32;
	ret |= readl(addr);
Signature · 6 lines
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors