From: Mikael Pettersson <mikpe@csd.uu.se>

Here are some patches to fix compilation warnings from
gcc-3.4.0 in the 2.6.6-rc3 x86_64 kernel.

- puts() type conflict in boot/compressed/misc.c:
  rename to putstr(), just like i386 did
- cast-as-lvalue in ia32_copy_siginfo_from_user():
  use temporary
- code before declaration in io_apic.c:
  move decl up
- code before declaration in ioremap.c:
  move existing #ifndef up
- cast-as-lvalue (tons of them) from UP version of per_cpu():
  merged asm-generic's version



---

 25-akpm/arch/x86_64/boot/compressed/misc.c |   14 +++++++-------
 25-akpm/arch/x86_64/ia32/ia32_signal.c     |    4 +++-
 25-akpm/arch/x86_64/kernel/io_apic.c       |    5 +++--
 25-akpm/arch/x86_64/mm/ioremap.c           |    4 ++--
 25-akpm/include/asm-x86_64/percpu.h        |    2 +-
 5 files changed, 16 insertions(+), 13 deletions(-)

diff -puN arch/x86_64/boot/compressed/misc.c~gcc-340-fixes-for-266-rc3-x86_64-kernel arch/x86_64/boot/compressed/misc.c
--- 25/arch/x86_64/boot/compressed/misc.c~gcc-340-fixes-for-266-rc3-x86_64-kernel	Mon May  3 14:13:54 2004
+++ 25-akpm/arch/x86_64/boot/compressed/misc.c	Mon May  3 14:13:54 2004
@@ -92,7 +92,7 @@ static unsigned long output_ptr = 0;
 static void *malloc(int size);
 static void free(void *where);
  
-static void puts(const char *);
+static void putstr(const char *);
   
 extern int end;
 static long free_mem_ptr = (long)&end;
@@ -153,7 +153,7 @@ static void scroll(void)
 		vidmem[i] = ' ';
 }
 
-static void puts(const char *s)
+static void putstr(const char *s)
 {
 	int x,y,pos;
 	char c;
@@ -270,9 +270,9 @@ static void flush_window(void)
 
 static void error(char *x)
 {
-	puts("\n\n");
-	puts(x);
-	puts("\n\n -- System halted");
+	putstr("\n\n");
+	putstr(x);
+	putstr("\n\n -- System halted");
 
 	while(1);
 }
@@ -346,9 +346,9 @@ int decompress_kernel(struct moveparams 
 	else setup_output_buffer_if_we_run_high(mv);
 
 	makecrc();
-	puts(".\nDecompressing Linux...");
+	putstr(".\nDecompressing Linux...");
 	gunzip();
-	puts("done.\nBooting the kernel.\n");
+	putstr("done.\nBooting the kernel.\n");
 	if (high_loaded) close_output_buffer_if_we_run_high(mv);
 	return high_loaded;
 }
diff -puN arch/x86_64/ia32/ia32_signal.c~gcc-340-fixes-for-266-rc3-x86_64-kernel arch/x86_64/ia32/ia32_signal.c
--- 25/arch/x86_64/ia32/ia32_signal.c~gcc-340-fixes-for-266-rc3-x86_64-kernel	Mon May  3 14:13:54 2004
+++ 25-akpm/arch/x86_64/ia32/ia32_signal.c	Mon May  3 14:13:54 2004
@@ -98,6 +98,7 @@ int ia32_copy_siginfo_to_user(siginfo_t3
 int ia32_copy_siginfo_from_user(siginfo_t *to, siginfo_t32 __user *from)
 {
 	int err;
+	u32 ptr32;
 	if (!access_ok (VERIFY_READ, from, sizeof(siginfo_t32)))
 		return -EFAULT;
 
@@ -107,7 +108,8 @@ int ia32_copy_siginfo_from_user(siginfo_
 
 	err |= __get_user(to->si_pid, &from->si_pid);
 	err |= __get_user(to->si_uid, &from->si_uid);
-	err |= __get_user((u32)(u64)to->si_ptr, &from->si_ptr);
+	err |= __get_user(ptr32, &from->si_ptr);
+	to->si_ptr = (void*)(u64)ptr32;
 
 	return err;
 }
diff -puN arch/x86_64/kernel/io_apic.c~gcc-340-fixes-for-266-rc3-x86_64-kernel arch/x86_64/kernel/io_apic.c
--- 25/arch/x86_64/kernel/io_apic.c~gcc-340-fixes-for-266-rc3-x86_64-kernel	Mon May  3 14:13:54 2004
+++ 25-akpm/arch/x86_64/kernel/io_apic.c	Mon May  3 14:13:54 2004
@@ -237,6 +237,7 @@ void __init check_ioapic(void) 
 			for (func = 0; func < 8; func++) { 
 				u32 class;
 				u32 vendor;
+				u8 type;
 				class = read_pci_config(num,slot,func,
 							PCI_CLASS_REVISION);
 				if (class == 0xffffffff)
@@ -270,8 +271,8 @@ void __init check_ioapic(void) 
 				} 
 
 				/* No multi-function device? */
-				u8 type = read_pci_config_byte(num,slot,func,
-							       PCI_HEADER_TYPE);
+				type = read_pci_config_byte(num,slot,func,
+							    PCI_HEADER_TYPE);
 				if (!(type & 0x80))
 					break;
 			} 
diff -puN arch/x86_64/mm/ioremap.c~gcc-340-fixes-for-266-rc3-x86_64-kernel arch/x86_64/mm/ioremap.c
--- 25/arch/x86_64/mm/ioremap.c~gcc-340-fixes-for-266-rc3-x86_64-kernel	Mon May  3 14:13:54 2004
+++ 25-akpm/arch/x86_64/mm/ioremap.c	Mon May  3 14:13:54 2004
@@ -132,13 +132,13 @@ void * __ioremap(unsigned long phys_addr
 	 * Don't allow anybody to remap normal RAM that we're using..
 	 */
 	if (phys_addr < virt_to_phys(high_memory)) {
+#ifndef CONFIG_DISCONTIGMEM
 		char *t_addr, *t_end;
+ 		struct page *page;
 
 		t_addr = __va(phys_addr);
 		t_end = t_addr + (size - 1);
 	   
-#ifndef CONFIG_DISCONTIGMEM	 
- 		struct page *page;
 		for(page = virt_to_page(t_addr); page <= virt_to_page(t_end); page++)
 			if(!PageReserved(page))
 				return NULL;
diff -puN include/asm-x86_64/percpu.h~gcc-340-fixes-for-266-rc3-x86_64-kernel include/asm-x86_64/percpu.h
--- 25/include/asm-x86_64/percpu.h~gcc-340-fixes-for-266-rc3-x86_64-kernel	Mon May  3 14:13:54 2004
+++ 25-akpm/include/asm-x86_64/percpu.h	Mon May  3 14:13:54 2004
@@ -39,7 +39,7 @@ extern void setup_per_cpu_areas(void);
 #define DEFINE_PER_CPU(type, name) \
     __typeof__(type) per_cpu__##name
 
-#define per_cpu(var, cpu)			((void)cpu, per_cpu__##var)
+#define per_cpu(var, cpu)			(*((void)cpu, &per_cpu__##var))
 #define __get_cpu_var(var)			per_cpu__##var
 
 #endif	/* SMP */

_