All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] [PATCH] gcc-4.0 allyesconfig fixes
@ 2005-01-20 22:04 Benoit Boissinot
  2005-01-21  9:10 ` walter harms
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Benoit Boissinot @ 2005-01-20 22:04 UTC (permalink / raw)
  To: kernel-janitors

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

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
--- linux-clean/drivers/char/generic_serial.c	2005-01-20 22:12:57.000000000 +0100
+++ linux-2.6-mm-test/drivers/char/generic_serial.c	2005-01-20 21:27:11.000000000 +0100
@@ -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
--- linux-clean/drivers/net/s2io.h	2005-01-20 22:13:01.000000000 +0100
+++ linux-2.6-mm-test/drivers/net/s2io.h	2005-01-20 21:47:30.000000000 +0100
@@ -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;
 }


[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] [PATCH] gcc-4.0 allyesconfig fixes
  2005-01-20 22:04 [KJ] [PATCH] gcc-4.0 allyesconfig fixes Benoit Boissinot
@ 2005-01-21  9:10 ` walter harms
  2005-01-21 10:08   ` Adrian Bunk
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: walter harms @ 2005-01-21  9:10 UTC (permalink / raw)
  To: kernel-janitors

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

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



Benoit Boissinot wrote:
> 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
> --- linux-clean/drivers/char/generic_serial.c	2005-01-20 22:12:57.000000000 +0100
> +++ linux-2.6-mm-test/drivers/char/generic_serial.c	2005-01-20 21:27:11.000000000 +0100
> @@ -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
> --- linux-clean/drivers/net/s2io.h	2005-01-20 22:13:01.000000000 +0100
> +++ linux-2.6-mm-test/drivers/net/s2io.h	2005-01-20 21:47:30.000000000 +0100
> @@ -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
> Kernel-janitors@lists.osdl.org
> http://lists.osdl.org/mailman/listinfo/kernel-janitors

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* [KJ] [2.6 patch] generic_serial.h: kill incorrect gs_debug reference
  2005-01-20 22:04 [KJ] [PATCH] gcc-4.0 allyesconfig fixes Benoit Boissinot
@ 2005-01-21 10:08   ` Adrian Bunk
  2005-01-21 10:08   ` Adrian Bunk
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Adrian Bunk @ 2005-01-21 10:08 UTC (permalink / raw)
  To: Benoit Boissinot; +Cc: kernel-janitors, linux-kernel

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

On Thu, Jan 20, 2005 at 11:04:03PM +0100, Benoit Boissinot wrote:

> 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
> --- linux-clean/drivers/char/generic_serial.c	2005-01-20 22:12:57.000000000 +0100
> +++ linux-2.6-mm-test/drivers/char/generic_serial.c	2005-01-20 21:27:11.000000000 +0100
> @@ -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).


Signed-off-by: Adrian Bunk <bunk@stusta.de>

--- linux-2.6.11-rc1-mm2-full/include/linux/generic_serial.h.old	2005-01-20 23:26:07.000000000 +0100
+++ linux-2.6.11-rc1-mm2-full/include/linux/generic_serial.h	2005-01-20 23:26:20.000000000 +0100
@@ -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


[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* [2.6 patch] generic_serial.h: kill incorrect gs_debug reference
@ 2005-01-21 10:08   ` Adrian Bunk
  0 siblings, 0 replies; 6+ messages in thread
From: Adrian Bunk @ 2005-01-21 10:08 UTC (permalink / raw)
  To: Benoit Boissinot; +Cc: kernel-janitors, linux-kernel

On Thu, Jan 20, 2005 at 11:04:03PM +0100, Benoit Boissinot wrote:

> 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
> --- linux-clean/drivers/char/generic_serial.c	2005-01-20 22:12:57.000000000 +0100
> +++ linux-2.6-mm-test/drivers/char/generic_serial.c	2005-01-20 21:27:11.000000000 +0100
> @@ -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).


Signed-off-by: Adrian Bunk <bunk@stusta.de>

--- linux-2.6.11-rc1-mm2-full/include/linux/generic_serial.h.old	2005-01-20 23:26:07.000000000 +0100
+++ linux-2.6.11-rc1-mm2-full/include/linux/generic_serial.h	2005-01-20 23:26:20.000000000 +0100
@@ -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


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

* Re: [KJ] [PATCH] gcc-4.0 allyesconfig fixes
  2005-01-20 22:04 [KJ] [PATCH] gcc-4.0 allyesconfig fixes Benoit Boissinot
  2005-01-21  9:10 ` walter harms
  2005-01-21 10:08   ` Adrian Bunk
@ 2005-01-21 14:13 ` Benoit Boissinot
  2005-01-21 15:45 ` Matthew Wilcox
  3 siblings, 0 replies; 6+ messages in thread
From: Benoit Boissinot @ 2005-01-21 14:13 UTC (permalink / raw)
  To: kernel-janitors

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

On Fri, Jan 21, 2005 at 10:10:39AM +0100, walter harms wrote:
> 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.

--- linux-clean/drivers/net/s2io.h	2005-01-20 22:13:01.000000000 +0100
+++ linux-2.6-mm-test/drivers/net/s2io.h	2005-01-21 14:01:21.000000000 +0100
@@ -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;
 }


[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] [PATCH] gcc-4.0 allyesconfig fixes
  2005-01-20 22:04 [KJ] [PATCH] gcc-4.0 allyesconfig fixes Benoit Boissinot
                   ` (2 preceding siblings ...)
  2005-01-21 14:13 ` [KJ] [PATCH] gcc-4.0 allyesconfig fixes Benoit Boissinot
@ 2005-01-21 15:45 ` Matthew Wilcox
  3 siblings, 0 replies; 6+ messages in thread
From: Matthew Wilcox @ 2005-01-21 15:45 UTC (permalink / raw)
  To: kernel-janitors

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

On Fri, Jan 21, 2005 at 03:13:12PM +0100, Benoit Boissinot wrote:
> Is the following patch better ?
> I checked the return type of readl, it is a 32bit integer.
> 
> --- linux-clean/drivers/net/s2io.h	2005-01-20 22:13:01.000000000 +0100
> +++ linux-2.6-mm-test/drivers/net/s2io.h	2005-01-21 14:01:21.000000000 +0100
> @@ -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.

> +	ret <<= 32;
> +	ret |= (u64) readl(addr);

Ditto here.

So the correct form would be:

	u64 ret = readl(addr + 4);
	ret <<= 32;
	ret |= readl(addr);

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

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

end of thread, other threads:[~2005-01-21 15:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-20 22:04 [KJ] [PATCH] gcc-4.0 allyesconfig fixes Benoit Boissinot
2005-01-21  9:10 ` walter harms
2005-01-21 10:08 ` [KJ] [2.6 patch] generic_serial.h: kill incorrect gs_debug reference Adrian Bunk
2005-01-21 10:08   ` Adrian Bunk
2005-01-21 14:13 ` [KJ] [PATCH] gcc-4.0 allyesconfig fixes Benoit Boissinot
2005-01-21 15:45 ` Matthew Wilcox

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.