summaryrefslogtreecommitdiffstats
path: root/openwrt/target/linux/linux-2.4
diff options
context:
space:
mode:
Diffstat (limited to 'openwrt/target/linux/linux-2.4')
-rw-r--r--openwrt/target/linux/linux-2.4/patches/generic/006-gcc4fixes.patch522
-rw-r--r--openwrt/target/linux/linux-2.4/patches/generic/007-more_gcc4_fixes.patch1339
-rw-r--r--openwrt/target/linux/linux-2.4/patches/generic/050-build_flags.patch (renamed from openwrt/target/linux/linux-2.4/patches/generic/006-build_flags.patch)96
-rw-r--r--openwrt/target/linux/linux-2.4/patches/generic/113-even_more_gcc4_stuff.patch367
4 files changed, 2268 insertions, 56 deletions
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/006-gcc4fixes.patch b/openwrt/target/linux/linux-2.4/patches/generic/006-gcc4fixes.patch
new file mode 100644
index 000000000..4034d1b48
--- /dev/null
+++ b/openwrt/target/linux/linux-2.4/patches/generic/006-gcc4fixes.patch
@@ -0,0 +1,522 @@
+diff -rupN linux-2.4.32/Makefile linux-2.4.32.gcc4-fixes-v12/Makefile
+--- linux-2.4.32/Makefile 2005-11-17 13:27:30.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/Makefile 2005-11-17 13:32:13.000000000 +0100
+@@ -93,11 +93,17 @@ CPPFLAGS := -D__KERNEL__ -I$(HPATH)
+
+ CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \
+ -fno-strict-aliasing -fno-common
++CFLAGS += -fno-builtin-sprintf
+ ifndef CONFIG_FRAME_POINTER
+ CFLAGS += -fomit-frame-pointer
+ endif
+ AFLAGS := -D__ASSEMBLY__ $(CPPFLAGS)
+
++check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
++
++# disable pointer signedness warnings in gcc 4.0
++CFLAGS += $(call check_gcc,-Wno-pointer-sign,)
++
+ #
+ # ROOT_DEV specifies the default root-device when making the image.
+ # This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
+diff -rupN linux-2.4.32/arch/i386/Makefile linux-2.4.32.gcc4-fixes-v12/arch/i386/Makefile
+--- linux-2.4.32/arch/i386/Makefile 2004-11-17 18:36:41.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/arch/i386/Makefile 2005-11-17 13:32:13.000000000 +0100
+@@ -23,8 +23,6 @@ LINKFLAGS =-T $(TOPDIR)/arch/i386/vmlinu
+
+ CFLAGS += -pipe
+
+-check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
+-
+ # prevent gcc from keeping the stack 16 byte aligned
+ CFLAGS += $(call check_gcc,-mpreferred-stack-boundary=2,)
+
+diff -rupN linux-2.4.32/arch/mips/Makefile linux-2.4.32.gcc4-fixes-v12/arch/mips/Makefile
+--- linux-2.4.32/arch/mips/Makefile 2005-01-19 18:00:52.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/arch/mips/Makefile 2005-11-17 13:32:13.000000000 +0100
+@@ -30,8 +30,6 @@ endif
+
+ MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
+
+-check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
+-
+ #
+ #
+ # GCC uses -G 0 -mabicalls -fpic as default. We don't want PIC in the kernel
+diff -rupN linux-2.4.32/arch/mips64/Makefile linux-2.4.32.gcc4-fixes-v12/arch/mips64/Makefile
+--- linux-2.4.32/arch/mips64/Makefile 2005-01-19 18:00:52.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/arch/mips64/Makefile 2005-11-17 13:32:13.000000000 +0100
+@@ -26,7 +26,6 @@ ifdef CONFIG_CROSSCOMPILE
+ CROSS_COMPILE = $(tool-prefix)
+ endif
+
+-check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
+ check_gas = $(shell if $(CC) $(1) -Wa,-Z -c -o /dev/null -xassembler /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
+
+ #
+diff -rupN linux-2.4.32/arch/ppc/kernel/open_pic_defs.h linux-2.4.32.gcc4-fixes-v12/arch/ppc/kernel/open_pic_defs.h
+--- linux-2.4.32/arch/ppc/kernel/open_pic_defs.h 2003-06-14 13:30:19.000000000 +0200
++++ linux-2.4.32.gcc4-fixes-v12/arch/ppc/kernel/open_pic_defs.h 2005-11-17 13:32:13.000000000 +0100
+@@ -172,9 +172,6 @@ struct OpenPIC {
+ OpenPIC_Processor Processor[OPENPIC_MAX_PROCESSORS];
+ };
+
+-extern volatile struct OpenPIC *OpenPIC;
+-
+-
+ /*
+ * Current Task Priority Register
+ */
+diff -rupN linux-2.4.32/arch/x86_64/Makefile linux-2.4.32.gcc4-fixes-v12/arch/x86_64/Makefile
+--- linux-2.4.32/arch/x86_64/Makefile 2004-04-14 20:22:20.000000000 +0200
++++ linux-2.4.32.gcc4-fixes-v12/arch/x86_64/Makefile 2005-11-17 13:32:13.000000000 +0100
+@@ -38,8 +38,6 @@ OBJCOPY=$(CROSS_COMPILE)objcopy -O binar
+ LDFLAGS=-e stext
+ LINKFLAGS =-T $(TOPDIR)/arch/x86_64/vmlinux.lds $(LDFLAGS)
+
+-check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1 ; then echo "$(1)"; else echo "$(2)"; fi)
+-
+ CFLAGS += -mno-red-zone
+ CFLAGS += -mcmodel=kernel
+ CFLAGS += -pipe
+diff -rupN linux-2.4.32/arch/x86_64/ia32/ia32entry.S linux-2.4.32.gcc4-fixes-v12/arch/x86_64/ia32/ia32entry.S
+--- linux-2.4.32/arch/x86_64/ia32/ia32entry.S 2005-01-19 18:00:53.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/arch/x86_64/ia32/ia32entry.S 2005-11-17 13:32:13.000000000 +0100
+@@ -113,9 +113,18 @@ quiet_ni_syscall:
+ PTREGSCALL stub32_fork, sys32_fork
+ PTREGSCALL stub32_clone, sys32_clone
+ PTREGSCALL stub32_vfork, sys32_vfork
+- PTREGSCALL stub32_iopl, sys_iopl
+ PTREGSCALL stub32_rt_sigsuspend, sys_rt_sigsuspend
+
++ .macro PTREGSCALL3 label, func, arg
++ .globl \label
++\label:
++ leaq \func(%rip),%rax
++ leaq -ARGOFFSET+8(%rsp),\arg /* 8 for return address */
++ jmp ia32_ptregs_common
++ .endm
++
++ PTREGSCALL3 stub32_iopl, sys_iopl, %rsi
++
+ ENTRY(ia32_ptregs_common)
+ popq %r11
+ SAVE_REST
+diff -rupN linux-2.4.32/arch/x86_64/kernel/entry.S linux-2.4.32.gcc4-fixes-v12/arch/x86_64/kernel/entry.S
+--- linux-2.4.32/arch/x86_64/kernel/entry.S 2003-11-29 00:28:11.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/arch/x86_64/kernel/entry.S 2005-11-17 13:32:13.000000000 +0100
+@@ -249,7 +249,16 @@ intret_signal_test:
+ PTREGSCALL stub_vfork, sys_vfork
+ PTREGSCALL stub_rt_sigsuspend, sys_rt_sigsuspend
+ PTREGSCALL stub_sigaltstack, sys_sigaltstack
+- PTREGSCALL stub_iopl, sys_iopl
++
++ .macro PTREGSCALL3 label,func,arg
++ .globl \label
++\label:
++ leaq \func(%rip),%rax
++ leaq -ARGOFFSET+8(%rsp),\arg /* 8 for return address */
++ jmp ptregscall_common
++ .endm
++
++ PTREGSCALL3 stub_iopl, sys_iopl, %rsi
+
+ ENTRY(ptregscall_common)
+ popq %r11
+diff -rupN linux-2.4.32/arch/x86_64/kernel/ioport.c linux-2.4.32.gcc4-fixes-v12/arch/x86_64/kernel/ioport.c
+--- linux-2.4.32/arch/x86_64/kernel/ioport.c 2003-11-29 00:28:11.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/arch/x86_64/kernel/ioport.c 2005-11-17 13:32:13.000000000 +0100
+@@ -81,9 +81,9 @@ asmlinkage long sys_ioperm(unsigned long
+ * code.
+ */
+
+-asmlinkage long sys_iopl(unsigned int level, struct pt_regs regs)
++asmlinkage long sys_iopl(unsigned int level, struct pt_regs *regs)
+ {
+- unsigned int old = (regs.eflags >> 12) & 3;
++ unsigned int old = (regs->eflags >> 12) & 3;
+
+ if (level > 3)
+ return -EINVAL;
+@@ -92,6 +92,6 @@ asmlinkage long sys_iopl(unsigned int le
+ if (!capable(CAP_SYS_RAWIO))
+ return -EPERM;
+ }
+- regs.eflags = (regs.eflags & 0xffffffffffffcfff) | (level << 12);
++ regs->eflags = (regs->eflags &~ 0x3000UL) | (level << 12);
+ return 0;
+ }
+diff -rupN linux-2.4.32/drivers/acpi/bus.c linux-2.4.32.gcc4-fixes-v12/drivers/acpi/bus.c
+--- linux-2.4.32/drivers/acpi/bus.c 2005-01-19 18:00:53.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/drivers/acpi/bus.c 2005-11-17 13:32:13.000000000 +0100
+@@ -623,7 +623,7 @@ acpi_bus_generate_event (
+ int data)
+ {
+ struct acpi_bus_event *event = NULL;
+- u32 flags = 0;
++ unsigned long flags = 0;
+
+ ACPI_FUNCTION_TRACE("acpi_bus_generate_event");
+
+@@ -656,7 +656,7 @@ int
+ acpi_bus_receive_event (
+ struct acpi_bus_event *event)
+ {
+- u32 flags = 0;
++ unsigned long flags = 0;
+ struct acpi_bus_event *entry = NULL;
+
+ DECLARE_WAITQUEUE(wait, current);
+diff -rupN linux-2.4.32/drivers/sound/sound_firmware.c linux-2.4.32.gcc4-fixes-v12/drivers/sound/sound_firmware.c
+--- linux-2.4.32/drivers/sound/sound_firmware.c 2001-02-22 15:23:46.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/drivers/sound/sound_firmware.c 2005-11-17 13:32:13.000000000 +0100
+@@ -4,10 +4,11 @@
+ #include <linux/fs.h>
+ #include <linux/mm.h>
+ #include <linux/slab.h>
+-#include <linux/unistd.h>
++static int my_errno;
++#define errno my_errno
++#include <asm/unistd.h>
+ #include <asm/uaccess.h>
+
+-static int errno;
+ static int do_mod_firmware_load(const char *fn, char **fp)
+ {
+ int fd;
+diff -rupN linux-2.4.32/drivers/usb/host/ehci-q.c linux-2.4.32.gcc4-fixes-v12/drivers/usb/host/ehci-q.c
+--- linux-2.4.32/drivers/usb/host/ehci-q.c 2005-01-19 18:00:53.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/drivers/usb/host/ehci-q.c 2005-11-17 13:32:13.000000000 +0100
+@@ -199,8 +199,6 @@ ehci_urb_done (struct ehci_hcd *ehci, st
+ #ifdef INTR_AUTOMAGIC
+ struct urb *resubmit = 0;
+ struct usb_device *dev = 0;
+-
+- static int ehci_urb_enqueue (struct usb_hcd *, struct urb *, int);
+ #endif
+
+ if (likely (urb->hcpriv != 0)) {
+diff -rupN linux-2.4.32/drivers/usb/inode.c linux-2.4.32.gcc4-fixes-v12/drivers/usb/inode.c
+--- linux-2.4.32/drivers/usb/inode.c 2004-02-18 15:16:23.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/drivers/usb/inode.c 2005-11-17 13:32:13.000000000 +0100
+@@ -41,6 +41,9 @@
+ #include <linux/usbdevice_fs.h>
+ #include <asm/uaccess.h>
+
++static struct inode_operations usbdevfs_bus_inode_operations;
++static struct file_operations usbdevfs_bus_file_operations;
++
+ /* --------------------------------------------------------------------- */
+
+ /*
+diff -rupN linux-2.4.32/fs/hfs/trans.c linux-2.4.32.gcc4-fixes-v12/fs/hfs/trans.c
+--- linux-2.4.32/fs/hfs/trans.c 2001-02-22 15:23:47.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/fs/hfs/trans.c 2005-11-17 13:32:13.000000000 +0100
+@@ -33,6 +33,7 @@
+ #include <linux/hfs_fs_sb.h>
+ #include <linux/hfs_fs_i.h>
+ #include <linux/hfs_fs.h>
++#include <linux/compiler.h>
+
+ /*================ File-local variables ================*/
+
+@@ -78,7 +79,7 @@ static unsigned char mac2latin_map[128]
+ *
+ * Given a hexadecimal digit in ASCII, return the integer representation.
+ */
+-static inline const unsigned char dehex(char c) {
++static inline __attribute_const__ unsigned char dehex(char c) {
+ if ((c>='0')&&(c<='9')) {
+ return c-'0';
+ }
+diff -rupN linux-2.4.32/include/asm-i386/byteorder.h linux-2.4.32.gcc4-fixes-v12/include/asm-i386/byteorder.h
+--- linux-2.4.32/include/asm-i386/byteorder.h 2003-06-14 13:30:27.000000000 +0200
++++ linux-2.4.32.gcc4-fixes-v12/include/asm-i386/byteorder.h 2005-11-17 13:32:13.000000000 +0100
+@@ -2,6 +2,7 @@
+ #define _I386_BYTEORDER_H
+
+ #include <asm/types.h>
++#include <linux/compiler.h>
+
+ #ifdef __GNUC__
+
+@@ -10,7 +11,7 @@
+ #include <linux/config.h>
+ #endif
+
+-static __inline__ __const__ __u32 ___arch__swab32(__u32 x)
++static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
+ {
+ #ifdef CONFIG_X86_BSWAP
+ __asm__("bswap %0" : "=r" (x) : "0" (x));
+@@ -26,7 +27,7 @@ static __inline__ __const__ __u32 ___arc
+
+ /* gcc should generate this for open coded C now too. May be worth switching to
+ it because inline assembly cannot be scheduled. -AK */
+-static __inline__ __const__ __u16 ___arch__swab16(__u16 x)
++static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x)
+ {
+ __asm__("xchgb %b0,%h0" /* swap bytes */
+ : "=q" (x)
+diff -rupN linux-2.4.32/include/asm-i386/processor.h linux-2.4.32.gcc4-fixes-v12/include/asm-i386/processor.h
+--- linux-2.4.32/include/asm-i386/processor.h 2004-02-18 15:16:24.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/include/asm-i386/processor.h 2005-11-17 13:32:13.000000000 +0100
+@@ -72,7 +72,6 @@ struct cpuinfo_x86 {
+ */
+
+ extern struct cpuinfo_x86 boot_cpu_data;
+-extern struct tss_struct init_tss[NR_CPUS];
+
+ #ifdef CONFIG_SMP
+ extern struct cpuinfo_x86 cpu_data[];
+@@ -357,6 +356,8 @@ struct tss_struct {
+ unsigned long __cacheline_filler[5];
+ };
+
++extern struct tss_struct init_tss[NR_CPUS];
++
+ struct thread_struct {
+ unsigned long esp0;
+ unsigned long eip;
+diff -rupN linux-2.4.32/include/asm-i386/string.h linux-2.4.32.gcc4-fixes-v12/include/asm-i386/string.h
+--- linux-2.4.32/include/asm-i386/string.h 2001-08-12 11:35:53.000000000 +0200
++++ linux-2.4.32.gcc4-fixes-v12/include/asm-i386/string.h 2005-11-17 13:32:13.000000000 +0100
+@@ -337,7 +337,7 @@ extern void __struct_cpy_bug (void);
+ #define struct_cpy(x,y) \
+ ({ \
+ if (sizeof(*(x)) != sizeof(*(y))) \
+- __struct_cpy_bug; \
++ __struct_cpy_bug(); \
+ memcpy(x, y, sizeof(*(x))); \
+ })
+
+diff -rupN linux-2.4.32/include/asm-m68k/setup.h linux-2.4.32.gcc4-fixes-v12/include/asm-m68k/setup.h
+--- linux-2.4.32/include/asm-m68k/setup.h 2000-01-29 13:07:40.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/include/asm-m68k/setup.h 2005-11-17 13:32:13.000000000 +0100
+@@ -361,12 +361,13 @@ extern int m68k_is040or060;
+ #ifndef __ASSEMBLY__
+ extern int m68k_num_memory; /* # of memory blocks found (and used) */
+ extern int m68k_realnum_memory; /* real # of memory blocks found */
+-extern struct mem_info m68k_memory[NUM_MEMINFO];/* memory description */
+
+ struct mem_info {
+ unsigned long addr; /* physical address of memory chunk */
+ unsigned long size; /* length of memory chunk (in bytes) */
+ };
++
++extern struct mem_info m68k_memory[NUM_MEMINFO];/* memory description */
+ #endif
+
+ #endif /* __KERNEL__ */
+diff -rupN linux-2.4.32/include/asm-ppc/byteorder.h linux-2.4.32.gcc4-fixes-v12/include/asm-ppc/byteorder.h
+--- linux-2.4.32/include/asm-ppc/byteorder.h 2003-06-14 13:30:28.000000000 +0200
++++ linux-2.4.32.gcc4-fixes-v12/include/asm-ppc/byteorder.h 2005-11-17 13:32:13.000000000 +0100
+@@ -2,6 +2,7 @@
+ #define _PPC_BYTEORDER_H
+
+ #include <asm/types.h>
++#include <linux/compiler.h>
+
+ #ifdef __GNUC__
+ #ifdef __KERNEL__
+@@ -50,7 +51,7 @@ extern __inline__ void st_le64(volatile
+ __asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (taddr+4));
+ }
+
+-static __inline__ __const__ __u16 ___arch__swab16(__u16 value)
++static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 value)
+ {
+ __u16 result;
+
+@@ -58,7 +59,7 @@ static __inline__ __const__ __u16 ___arc
+ return result;
+ }
+
+-static __inline__ __const__ __u32 ___arch__swab32(__u32 value)
++static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 value)
+ {
+ __u32 result;
+
+diff -rupN linux-2.4.32/include/asm-ppc/time.h linux-2.4.32.gcc4-fixes-v12/include/asm-ppc/time.h
+--- linux-2.4.32/include/asm-ppc/time.h 2003-08-25 20:07:49.000000000 +0200
++++ linux-2.4.32.gcc4-fixes-v12/include/asm-ppc/time.h 2005-11-17 13:32:13.000000000 +0100
+@@ -12,6 +12,7 @@
+ #include <linux/config.h>
+ #include <linux/mc146818rtc.h>
+ #include <linux/threads.h>
++#include <linux/compiler.h>
+
+ #include <asm/processor.h>
+
+@@ -57,7 +58,7 @@ static __inline__ void set_dec(unsigned
+ /* Accessor functions for the timebase (RTC on 601) registers. */
+ /* If one day CONFIG_POWER is added just define __USE_RTC as 1 */
+ #ifdef CONFIG_6xx
+-extern __inline__ int const __USE_RTC(void) {
++extern __inline__ int __attribute_const__ __USE_RTC(void) {
+ return (mfspr(SPRN_PVR)>>16) == 1;
+ }
+ #else
+diff -rupN linux-2.4.32/include/asm-x86_64/byteorder.h linux-2.4.32.gcc4-fixes-v12/include/asm-x86_64/byteorder.h
+--- linux-2.4.32/include/asm-x86_64/byteorder.h 2002-11-30 17:12:31.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/include/asm-x86_64/byteorder.h 2005-11-17 13:32:13.000000000 +0100
+@@ -2,16 +2,17 @@
+ #define _X86_64_BYTEORDER_H
+
+ #include <asm/types.h>
++#include <linux/compiler.h>
+
+ #ifdef __GNUC__
+
+-static __inline__ __const__ __u64 ___arch__swab64(__u64 x)
++static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 x)
+ {
+ __asm__("bswapq %0" : "=r" (x) : "0" (x));
+ return x;
+ }
+
+-static __inline__ __const__ __u32 ___arch__swab32(__u32 x)
++static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
+ {
+ __asm__("bswapl %0" : "=r" (x) : "0" (x));
+ return x;
+diff -rupN linux-2.4.32/include/asm-x86_64/processor.h linux-2.4.32.gcc4-fixes-v12/include/asm-x86_64/processor.h
+--- linux-2.4.32/include/asm-x86_64/processor.h 2005-11-17 13:27:30.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/include/asm-x86_64/processor.h 2005-11-17 13:32:13.000000000 +0100
+@@ -68,7 +68,6 @@ struct cpuinfo_x86 {
+ #define X86_VENDOR_UNKNOWN 0xff
+
+ extern struct cpuinfo_x86 boot_cpu_data;
+-extern struct tss_struct init_tss[NR_CPUS];
+
+ #ifdef CONFIG_SMP
+ extern struct cpuinfo_x86 cpu_data[];
+@@ -300,6 +299,8 @@ struct tss_struct {
+ u32 io_bitmap[IO_BITMAP_SIZE];
+ } __attribute__((packed)) ____cacheline_aligned;
+
++extern struct tss_struct init_tss[NR_CPUS];
++
+ struct thread_struct {
+ unsigned long rsp0;
+ unsigned long rip;
+diff -rupN linux-2.4.32/include/linux/byteorder/swab.h linux-2.4.32.gcc4-fixes-v12/include/linux/byteorder/swab.h
+--- linux-2.4.32/include/linux/byteorder/swab.h 2002-11-30 17:12:31.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/include/linux/byteorder/swab.h 2005-11-17 13:32:13.000000000 +0100
+@@ -15,6 +15,8 @@
+ *
+ */
+
++#include <linux/compiler.h>
++
+ /* casts are necessary for constants, because we never know how for sure
+ * how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way.
+ */
+@@ -156,7 +158,7 @@
+ #endif /* OPTIMIZE */
+
+
+-static __inline__ __const__ __u16 __fswab16(__u16 x)
++static __inline__ __attribute_const__ __u16 __fswab16(__u16 x)
+ {
+ return __arch__swab16(x);
+ }
+@@ -169,7 +171,7 @@ static __inline__ void __swab16s(__u16 *
+ __arch__swab16s(addr);
+ }
+
+-static __inline__ __const__ __u32 __fswab24(__u32 x)
++static __inline__ __attribute_const__ __u32 __fswab24(__u32 x)
+ {
+ return __arch__swab24(x);
+ }
+@@ -182,7 +184,7 @@ static __inline__ void __swab24s(__u32 *
+ __arch__swab24s(addr);
+ }
+
+-static __inline__ __const__ __u32 __fswab32(__u32 x)
++static __inline__ __attribute_const__ __u32 __fswab32(__u32 x)
+ {
+ return __arch__swab32(x);
+ }
+@@ -196,7 +198,7 @@ static __inline__ void __swab32s(__u32 *
+ }
+
+ #ifdef __BYTEORDER_HAS_U64__
+-static __inline__ __const__ __u64 __fswab64(__u64 x)
++static __inline__ __attribute_const__ __u64 __fswab64(__u64 x)
+ {
+ # ifdef __SWAB_64_THRU_32__
+ __u32 h = x >> 32;
+diff -rupN linux-2.4.32/include/linux/compiler.h linux-2.4.32.gcc4-fixes-v12/include/linux/compiler.h
+--- linux-2.4.32/include/linux/compiler.h 2004-11-17 18:36:42.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/include/linux/compiler.h 2005-11-17 13:32:13.000000000 +0100
+@@ -27,6 +27,12 @@
+ #define __attribute_used__ /* not implemented */
+ #endif /* __GNUC__ */
+
++#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
++#define __attribute_const__ __attribute__((__const__))
++#else
++#define __attribute_const__ /* unimplemented */
++#endif
++
+ #if __GNUC__ == 3
+ #if __GNUC_MINOR__ >= 1
+ # define inline __inline__ __attribute__((always_inline))
+diff -rupN linux-2.4.32/include/linux/fs.h linux-2.4.32.gcc4-fixes-v12/include/linux/fs.h
+--- linux-2.4.32/include/linux/fs.h 2005-04-04 19:56:05.000000000 +0200
++++ linux-2.4.32.gcc4-fixes-v12/include/linux/fs.h 2005-11-17 13:32:13.000000000 +0100
+@@ -1559,7 +1559,6 @@ static inline int is_mounted(kdev_t dev)
+ unsigned long generate_cluster(kdev_t, int b[], int);
+ unsigned long generate_cluster_swab32(kdev_t, int b[], int);
+ extern kdev_t ROOT_DEV;
+-extern char root_device_name[];
+
+
+ extern void show_buffers(void);
+diff -rupN linux-2.4.32/include/linux/ufs_fs.h linux-2.4.32.gcc4-fixes-v12/include/linux/ufs_fs.h
+--- linux-2.4.32/include/linux/ufs_fs.h 2001-11-23 22:40:15.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/include/linux/ufs_fs.h 2005-11-17 13:32:13.000000000 +0100
+@@ -555,7 +555,6 @@ extern struct buffer_head * ufs_bread (s
+ extern struct file_operations ufs_dir_operations;
+
+ /* super.c */
+-extern struct file_system_type ufs_fs_type;
+ extern void ufs_warning (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
+ extern void ufs_error (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
+ extern void ufs_panic (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
+diff -rupN linux-2.4.32/include/linux/usbdevice_fs.h linux-2.4.32.gcc4-fixes-v12/include/linux/usbdevice_fs.h
+--- linux-2.4.32/include/linux/usbdevice_fs.h 2003-11-29 00:28:14.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/include/linux/usbdevice_fs.h 2005-11-17 13:32:13.000000000 +0100
+@@ -185,8 +185,6 @@ extern struct file_operations usbdevfs_d
+ extern struct file_operations usbdevfs_devices_fops;
+ extern struct file_operations usbdevfs_device_file_operations;
+ extern struct inode_operations usbdevfs_device_inode_operations;
+-extern struct inode_operations usbdevfs_bus_inode_operations;
+-extern struct file_operations usbdevfs_bus_file_operations;
+ extern void usbdevfs_conn_disc_event(void);
+
+ #endif /* __KERNEL__ */
+diff -rupN linux-2.4.32/include/net/icmp.h linux-2.4.32.gcc4-fixes-v12/include/net/icmp.h
+--- linux-2.4.32/include/net/icmp.h 2001-04-28 12:35:26.000000000 +0200
++++ linux-2.4.32.gcc4-fixes-v12/include/net/icmp.h 2005-11-17 13:32:13.000000000 +0100
+@@ -23,6 +23,7 @@
+
+ #include <net/sock.h>
+ #include <net/protocol.h>
++#include <net/snmp.h>
+
+ struct icmp_err {
+ int errno;
+diff -rupN linux-2.4.32/include/net/ipv6.h linux-2.4.32.gcc4-fixes-v12/include/net/ipv6.h
+--- linux-2.4.32/include/net/ipv6.h 2004-11-17 18:36:43.000000000 +0100
++++ linux-2.4.32.gcc4-fixes-v12/include/net/ipv6.h 2005-11-17 13:32:13.000000000 +0100
+@@ -101,6 +101,7 @@ struct frag_hdr {
+ #ifdef __KERNEL__
+
+ #include <net/sock.h>
++#include <net/snmp.h>
+
+ /* sysctls */
+ extern int sysctl_ipv6_bindv6only;
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/007-more_gcc4_fixes.patch b/openwrt/target/linux/linux-2.4/patches/generic/007-more_gcc4_fixes.patch
new file mode 100644
index 000000000..b234c7028
--- /dev/null
+++ b/openwrt/target/linux/linux-2.4/patches/generic/007-more_gcc4_fixes.patch
@@ -0,0 +1,1339 @@
+diff -rupN linux-2.4.32/drivers/atm/fore200e.c linux-2.4.32.more-gcc4-fixes-v1/drivers/atm/fore200e.c
+--- linux-2.4.32/drivers/atm/fore200e.c 2004-11-17 18:36:41.000000000 +0100
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/atm/fore200e.c 2005-11-17 13:31:16.000000000 +0100
+@@ -112,8 +112,8 @@
+ #endif
+
+
+-extern const struct atmdev_ops fore200e_ops;
+-extern const struct fore200e_bus fore200e_bus[];
++static const struct atmdev_ops fore200e_ops;
++static const struct fore200e_bus fore200e_bus[];
+
+ static struct fore200e* fore200e_boards = NULL;
+
+diff -rupN linux-2.4.32/drivers/atm/horizon.c linux-2.4.32.more-gcc4-fixes-v1/drivers/atm/horizon.c
+--- linux-2.4.32/drivers/atm/horizon.c 2004-02-18 15:16:22.000000000 +0100
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/atm/horizon.c 2005-11-17 13:31:16.000000000 +0100
+@@ -481,6 +481,7 @@ static inline void dump_skb (char * pref
+ return;
+ }
+
++#if 0 /* unused and in conflict with <asm-ppc/system.h> */
+ static inline void dump_regs (hrz_dev * dev) {
+ #ifdef DEBUG_HORIZON
+ PRINTD (DBG_REGS, "CONTROL 0: %#x", rd_regl (dev, CONTROL_0_REG));
+@@ -494,6 +495,7 @@ static inline void dump_regs (hrz_dev *
+ #endif
+ return;
+ }
++#endif
+
+ static inline void dump_framer (hrz_dev * dev) {
+ #ifdef DEBUG_HORIZON
+diff -rupN linux-2.4.32/drivers/atm/iphase.c linux-2.4.32.more-gcc4-fixes-v1/drivers/atm/iphase.c
+--- linux-2.4.32/drivers/atm/iphase.c 2004-11-17 18:36:41.000000000 +0100
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/atm/iphase.c 2005-11-17 13:31:16.000000000 +0100
+@@ -82,6 +82,7 @@ static IADEV *ia_dev[8];
+ static struct atm_dev *_ia_dev[8];
+ static int iadev_count;
+ static void ia_led_timer(unsigned long arg);
++static int ia_pkt_tx (struct atm_vcc *vcc, struct sk_buff *skb);
+ static struct timer_list ia_timer = { function: ia_led_timer };
+ struct atm_vcc *vcc_close_que[100];
+ static int IA_TX_BUF = DFL_TX_BUFFERS, IA_TX_BUF_SZ = DFL_TX_BUF_SZ;
+@@ -627,7 +628,6 @@ static int ia_que_tx (IADEV *iadev) {
+ int num_desc;
+ struct atm_vcc *vcc;
+ struct ia_vcc *iavcc;
+- static int ia_pkt_tx (struct atm_vcc *vcc, struct sk_buff *skb);
+ num_desc = ia_avail_descs(iadev);
+ while (num_desc && (skb = skb_dequeue(&iadev->tx_backlog))) {
+ if (!(vcc = ATM_SKB(skb)->vcc)) {
+diff -rupN linux-2.4.32/drivers/atm/iphase.h linux-2.4.32.more-gcc4-fixes-v1/drivers/atm/iphase.h
+--- linux-2.4.32/drivers/atm/iphase.h 2003-06-14 13:30:20.000000000 +0200
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/atm/iphase.h 2005-11-17 13:31:16.000000000 +0100
+@@ -68,8 +68,6 @@
+ #define IF_IADBG_SUNI_STAT 0x02000000 // suni statistics
+ #define IF_IADBG_RESET 0x04000000
+
+-extern unsigned int IADebugFlag;
+-
+ #define IF_IADBG(f) if (IADebugFlag & (f))
+
+ #ifdef CONFIG_ATM_IA_DEBUG /* Debug build */
+diff -rupN linux-2.4.32/drivers/block/nbd.c linux-2.4.32.more-gcc4-fixes-v1/drivers/block/nbd.c
+--- linux-2.4.32/drivers/block/nbd.c 2005-04-04 19:56:04.000000000 +0200
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/block/nbd.c 2005-11-17 13:31:16.000000000 +0100
+@@ -74,6 +74,29 @@ static int requests_in;
+ static int requests_out;
+ #endif
+
++static void
++nbd_end_request(struct request *req)
++{
++ struct buffer_head *bh;
++ unsigned nsect;
++ unsigned long flags;
++ int uptodate = (req->errors == 0) ? 1 : 0;
++
++#ifdef PARANOIA
++ requests_out++;
++#endif
++ spin_lock_irqsave(&io_request_lock, flags);
++ while((bh = req->bh) != NULL) {
++ nsect = bh->b_size >> 9;
++ blk_finished_io(nsect);
++ req->bh = bh->b_reqnext;
++ bh->b_reqnext = NULL;
++ bh->b_end_io(bh, uptodate);
++ }
++ blkdev_release_request(req);
++ spin_unlock_irqrestore(&io_request_lock, flags);
++}
++
+ static int nbd_open(struct inode *inode, struct file *file)
+ {
+ int dev;
+diff -rupN linux-2.4.32/drivers/block/paride/pd.c linux-2.4.32.more-gcc4-fixes-v1/drivers/block/paride/pd.c
+--- linux-2.4.32/drivers/block/paride/pd.c 2002-11-30 17:12:24.000000000 +0100
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/block/paride/pd.c 2005-11-17 13:31:16.000000000 +0100
+@@ -343,7 +343,14 @@ static char *pd_errs[17] = { "ERR","INDE
+
+ /* kernel glue structures */
+
+-extern struct block_device_operations pd_fops;
++static struct block_device_operations pd_fops = {
++ owner: THIS_MODULE,
++ open: pd_open,
++ release: pd_release,
++ ioctl: pd_ioctl,
++ check_media_change: pd_check_media,
++ revalidate: pd_revalidate
++};
+
+ static struct gendisk pd_gendisk = {
+ major: PD_MAJOR,
+@@ -355,15 +362,6 @@ static struct gendisk pd_gendisk = {
+ fops: &pd_fops,
+ };
+
+-static struct block_device_operations pd_fops = {
+- owner: THIS_MODULE,
+- open: pd_open,
+- release: pd_release,
+- ioctl: pd_ioctl,
+- check_media_change: pd_check_media,
+- revalidate: pd_revalidate
+-};
+-
+ void pd_init_units( void )
+
+ { int unit, j;
+diff -rupN linux-2.4.32/drivers/block/xd.c linux-2.4.32.more-gcc4-fixes-v1/drivers/block/xd.c
+--- linux-2.4.32/drivers/block/xd.c 2002-11-30 17:12:24.000000000 +0100
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/block/xd.c 2005-11-17 13:31:16.000000000 +0100
+@@ -125,7 +125,12 @@ static int xd_sizes[XD_MAXDRIVES << 6],
+ static int xd_blocksizes[XD_MAXDRIVES << 6];
+ static int xd_maxsect[XD_MAXDRIVES << 6];
+
+-extern struct block_device_operations xd_fops;
++static struct block_device_operations xd_fops = {
++ owner: THIS_MODULE,
++ open: xd_open,
++ release: xd_release,
++ ioctl: xd_ioctl,
++};
+
+ static struct gendisk xd_gendisk = {
+ major: MAJOR_NR,
+@@ -138,13 +143,6 @@ static struct gendisk xd_gendisk = {
+ fops: &xd_fops,
+ };
+
+-static struct block_device_operations xd_fops = {
+- owner: THIS_MODULE,
+- open: xd_open,
+- release: xd_release,
+- ioctl: xd_ioctl,
+-};
+-
+ static DECLARE_WAIT_QUEUE_HEAD(xd_wait_int);
+ static DECLARE_WAIT_QUEUE_HEAD(xd_wait_open);
+ static u8 xd_valid[XD_MAXDRIVES] = { 0,0 };
+diff -rupN linux-2.4.32/drivers/cdrom/sbpcd.c linux-2.4.32.more-gcc4-fixes-v1/drivers/cdrom/sbpcd.c
+--- linux-2.4.32/drivers/cdrom/sbpcd.c 2001-11-06 12:12:06.000000000 +0100
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/cdrom/sbpcd.c 2005-11-17 13:31:16.000000000 +0100
+@@ -525,6 +525,8 @@ static int sbp_data(struct request *req)
+ static int cmd_out(void);
+ static int DiskInfo(void);
+ static int sbpcd_chk_disk_change(kdev_t);
++static int cmd_out_T(void);
++static int cc_DriveReset(void);
+
+ /*==========================================================================*/
+
+@@ -1213,8 +1215,6 @@ static int get_state_T(void)
+ {
+ int i;
+
+- static int cmd_out_T(void);
+-
+ clr_cmdbuf();
+ D_S[d].n_bytes=1;
+ drvcmd[0]=CMDT_STATUS;
+@@ -1362,7 +1362,6 @@ static int cmd_out_T(void)
+ #define CMDT_TRIES 1000
+ #define TEST_FALSE_FF 1
+
+- static int cc_DriveReset(void);
+ int i, j, l=0, m, ntries;
+ long flags;
+
+diff -rupN linux-2.4.32/drivers/char/ip2/i2lib.c linux-2.4.32.more-gcc4-fixes-v1/drivers/char/ip2/i2lib.c
+--- linux-2.4.32/drivers/char/ip2/i2lib.c 2005-01-19 18:00:53.000000000 +0100
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/char/ip2/i2lib.c 2005-11-17 13:31:16.000000000 +0100
+@@ -1262,7 +1262,7 @@ i2RetryFlushOutput(i2ChanStrPtr pCh)
+
+ }
+ if ( old_flags & STOPFL_FLAG ) {
+- if ( 1 == i2QueueCommands(PTYPE_INLINE, pCh, 0, 1, CMD_STOPFL) > 0 ) {
++ if ( 1 == i2QueueCommands(PTYPE_INLINE, pCh, 0, 1, CMD_STOPFL)) {
+ old_flags = 0; // Success - clear flags
+ }
+
+diff -rupN linux-2.4.32/drivers/char/rio/rio_linux.c linux-2.4.32.more-gcc4-fixes-v1/drivers/char/rio/rio_linux.c
+--- linux-2.4.32/drivers/char/rio/rio_linux.c 2002-02-26 13:26:56.000000000 +0100
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/char/rio/rio_linux.c 2005-11-17 13:31:16.000000000 +0100
+@@ -1205,8 +1205,8 @@ static int __init rio_init(void)
+ hp->Ivec = get_irq (pdev);
+ if (((1 << hp->Ivec) & rio_irqmask) == 0)
+ hp->Ivec = 0;
+- hp->CardP = (struct DpRam *)
+ hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN);
++ hp->CardP = (struct DpRam *) hp->Caddr;
+ hp->Type = RIO_PCI;
+ hp->Copy = rio_pcicopy;
+ hp->Mode = RIO_PCI_BOOT_FROM_RAM;
+@@ -1277,8 +1277,8 @@ static int __init rio_init(void)
+ if (((1 << hp->Ivec) & rio_irqmask) == 0)
+ hp->Ivec = 0;
+ hp->Ivec |= 0x8000; /* Mark as non-sharable */
+- hp->CardP = (struct DpRam *)
+ hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN);
++ hp->CardP = (struct DpRam *) hp->Caddr;
+ hp->Type = RIO_PCI;
+ hp->Copy = rio_pcicopy;
+ hp->Mode = RIO_PCI_BOOT_FROM_RAM;
+@@ -1329,8 +1329,8 @@ static int __init rio_init(void)
+ hp->PaddrP = rio_probe_addrs[i];
+ /* There was something about the IRQs of these cards. 'Forget what.--REW */
+ hp->Ivec = 0;
+- hp->CardP = (struct DpRam *)
+ hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN);
++ hp->CardP = (struct DpRam *) hp->Caddr;
+ hp->Type = RIO_AT;
+ hp->Copy = rio_pcicopy; /* AT card PCI???? - PVDL
+ * -- YES! this is now a normal copy. Only the
+diff -rupN linux-2.4.32/drivers/char/sonypi.c linux-2.4.32.more-gcc4-fixes-v1/drivers/char/sonypi.c
+--- linux-2.4.32/drivers/char/sonypi.c 2004-04-14 20:22:20.000000000 +0200
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/char/sonypi.c 2005-11-17 13:31:16.000000000 +0100
+@@ -60,6 +60,35 @@ static int compat; /* = 0 */
+ static int useinput = 1;
+ static unsigned long mask = 0xffffffff;
+
++static inline int sonypi_ec_write(u8 addr, u8 value) {
++#ifdef CONFIG_ACPI_EC
++ if (SONYPI_ACPI_ACTIVE)
++ return ec_write(addr, value);
++#endif
++ wait_on_command(1, inb_p(SONYPI_CST_IOPORT) & 3, ITERATIONS_LONG);
++ outb_p(0x81, SONYPI_CST_IOPORT);
++ wait_on_command(0, inb_p(SONYPI_CST_IOPORT) & 2, ITERATIONS_LONG);
++ outb_p(addr, SONYPI_DATA_IOPORT);
++ wait_on_command(0, inb_p(SONYPI_CST_IOPORT) & 2, ITERATIONS_LONG);
++ outb_p(value, SONYPI_DATA_IOPORT);
++ wait_on_command(0, inb_p(SONYPI_CST_IOPORT) & 2, ITERATIONS_LONG);
++ return 0;
++}
++
++static inline int sonypi_ec_read(u8 addr, u8 *value) {
++#ifdef CONFIG_ACPI_EC
++ if (SONYPI_ACPI_ACTIVE)
++ return ec_read(addr, value);
++#endif
++ wait_on_command(1, inb_p(SONYPI_CST_IOPORT) & 3, ITERATIONS_LONG);
++ outb_p(0x80, SONYPI_CST_IOPORT);
++ wait_on_command(0, inb_p(SONYPI_CST_IOPORT) & 2, ITERATIONS_LONG);
++ outb_p(addr, SONYPI_DATA_IOPORT);
++ wait_on_command(0, inb_p(SONYPI_CST_IOPORT) & 2, ITERATIONS_LONG);
++ *value = inb_p(SONYPI_DATA_IOPORT);
++ return 0;
++}
++
+ /* Inits the queue */
+ static inline void sonypi_initq(void) {
+ sonypi_device.queue.head = sonypi_device.queue.tail = 0;
+diff -rupN linux-2.4.32/drivers/char/sonypi.h linux-2.4.32.more-gcc4-fixes-v1/drivers/char/sonypi.h
+--- linux-2.4.32/drivers/char/sonypi.h 2004-04-14 20:22:20.000000000 +0200
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/char/sonypi.h 2005-11-17 13:31:16.000000000 +0100
+@@ -401,37 +401,6 @@ struct sonypi_device {
+ #define SONYPI_ACPI_ACTIVE 0
+ #endif /* CONFIG_ACPI */
+
+-extern int verbose;
+-
+-static inline int sonypi_ec_write(u8 addr, u8 value) {
+-#ifdef CONFIG_ACPI_EC
+- if (SONYPI_ACPI_ACTIVE)
+- return ec_write(addr, value);
+-#endif
+- wait_on_command(1, inb_p(SONYPI_CST_IOPORT) & 3, ITERATIONS_LONG);
+- outb_p(0x81, SONYPI_CST_IOPORT);
+- wait_on_command(0, inb_p(SONYPI_CST_IOPORT) & 2, ITERATIONS_LONG);
+- outb_p(addr, SONYPI_DATA_IOPORT);
+- wait_on_command(0, inb_p(SONYPI_CST_IOPORT) & 2, ITERATIONS_LONG);
+- outb_p(value, SONYPI_DATA_IOPORT);
+- wait_on_command(0, inb_p(SONYPI_CST_IOPORT) & 2, ITERATIONS_LONG);
+- return 0;
+-}
+-
+-static inline int sonypi_ec_read(u8 addr, u8 *value) {
+-#ifdef CONFIG_ACPI_EC
+- if (SONYPI_ACPI_ACTIVE)
+- return ec_read(addr, value);
+-#endif
+- wait_on_command(1, inb_p(SONYPI_CST_IOPORT) & 3, ITERATIONS_LONG);
+- outb_p(0x80, SONYPI_CST_IOPORT);
+- wait_on_command(0, inb_p(SONYPI_CST_IOPORT) & 2, ITERATIONS_LONG);
+- outb_p(addr, SONYPI_DATA_IOPORT);
+- wait_on_command(0, inb_p(SONYPI_CST_IOPORT) & 2, ITERATIONS_LONG);
+- *value = inb_p(SONYPI_DATA_IOPORT);
+- return 0;
+-}
+-
+ #endif /* __KERNEL__ */
+
+ #endif /* _SONYPI_PRIV_H_ */
+diff -rupN linux-2.4.32/drivers/char/sx.c linux-2.4.32.more-gcc4-fixes-v1/drivers/char/sx.c
+--- linux-2.4.32/drivers/char/sx.c 2005-01-19 18:00:53.000000000 +0100
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/char/sx.c 2005-11-17 13:31:16.000000000 +0100
+@@ -522,13 +522,13 @@ static int sx_busy_wait_eq (struct sx_bo
+
+ func_enter ();
+
+- for (i=0; i < TIMEOUT_1 > 0;i++)
++ for (i=0; i < TIMEOUT_1 ;i++)
+ if ((read_sx_byte (board, offset) & mask) == correctval) {
+ func_exit ();
+ return 1;
+ }
+
+- for (i=0; i < TIMEOUT_2 > 0;i++) {
++ for (i=0; i < TIMEOUT_2 ;i++) {
+ if ((read_sx_byte (board, offset) & mask) == correctval) {
+ func_exit ();
+ return 1;
+@@ -548,13 +548,13 @@ static int sx_busy_wait_neq (struct sx_b
+
+ func_enter ();
+
+- for (i=0; i < TIMEOUT_1 > 0;i++)
++ for (i=0; i < TIMEOUT_1 ;i++)
+ if ((read_sx_byte (board, offset) & mask) != badval) {
+ func_exit ();
+ return 1;
+ }
+
+- for (i=0; i < TIMEOUT_2 > 0;i++) {
++ for (i=0; i < TIMEOUT_2 ;i++) {
+ if ((read_sx_byte (board, offset) & mask) != badval) {
+ func_exit ();
+ return 1;
+diff -rupN linux-2.4.32/drivers/char/tpqic02.c linux-2.4.32.more-gcc4-fixes-v1/drivers/char/tpqic02.c
+--- linux-2.4.32/drivers/char/tpqic02.c 2004-08-08 10:56:31.000000000 +0200
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/char/tpqic02.c 2005-11-17 13:31:16.000000000 +0100
+@@ -202,6 +202,7 @@ static int mode_access; /* access mode:
+
+ static int qic02_get_resources(void);
+ static void qic02_release_resources(void);
++static void finish_rw(int cmd);
+
+ /* This is a pointer to the actual kernel buffer where the interrupt routines
+ * read from/write to. It is needed because the DMA channels 1 and 3 cannot
+@@ -820,7 +821,6 @@ static int get_ext_status3(void)
+ static int tp_sense(int ignore)
+ {
+ unsigned err = 0, exnr = 0, gs = 0;
+- static void finish_rw(int cmd);
+
+ if (TPQDBG(SENSE_TEXT))
+ printk(TPQIC02_NAME ": tp_sense(ignore=0x%x) enter\n",
+@@ -2173,16 +2173,6 @@ static ssize_t qic02_tape_write(struct f
+ * Don't rewind if the minor bits specify density 0.
+ */
+
+-static int qic02_tape_open(struct inode *inode, struct file *filp)
+-{
+- static int qic02_tape_open_no_use_count(struct inode *,
+- struct file *);
+- int open_error;
+-
+- open_error = qic02_tape_open_no_use_count(inode, filp);
+- return open_error;
+-}
+-
+ static int qic02_tape_open_no_use_count(struct inode *inode,
+ struct file *filp)
+ {
+@@ -2385,6 +2375,14 @@ static int qic02_tape_open_no_use_count(
+ } /* qic02_tape_open */
+
+
++static int qic02_tape_open(struct inode *inode, struct file *filp)
++{
++ int open_error;
++
++ open_error = qic02_tape_open_no_use_count(inode, filp);
++ return open_error;
++}
++
+ static int qic02_tape_release(struct inode *inode, struct file *filp)
+ {
+ kdev_t dev = inode->i_rdev;
+diff -rupN linux-2.4.32/drivers/i2c/i2c-core.c linux-2.4.32.more-gcc4-fixes-v1/drivers/i2c/i2c-core.c
+--- linux-2.4.32/drivers/i2c/i2c-core.c 2005-06-01 18:02:21.000000000 +0200
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/i2c/i2c-core.c 2005-11-17 13:31:16.000000000 +0100
+@@ -720,7 +720,7 @@ int i2cproc_cleanup(void)
+ * ----------------------------------------------------
+ */
+
+-int i2c_transfer(struct i2c_adapter * adap, struct i2c_msg msgs[],int num)
++int i2c_transfer(struct i2c_adapter * adap, struct i2c_msg *msgs,int num)
+ {
+ int ret;
+
+@@ -750,7 +750,7 @@ int i2c_master_send(struct i2c_client *c
+ msg.addr = client->addr;
+ msg.flags = client->flags & I2C_M_TEN;
+ msg.len = count;
+- (const char *)msg.buf = buf;
++ msg.buf = (char *)buf;
+
+ DEB2(printk(KERN_DEBUG "i2c-core.o: master_send: writing %d bytes on %s.\n",
+ count,client->adapter->name));
+diff -rupN linux-2.4.32/drivers/i2c/i2c-proc.c linux-2.4.32.more-gcc4-fixes-v1/drivers/i2c/i2c-proc.c
+--- linux-2.4.32/drivers/i2c/i2c-proc.c 2005-01-19 18:00:53.000000000 +0100
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/i2c/i2c-proc.c 2005-11-17 13:31:16.000000000 +0100
+@@ -205,7 +205,7 @@ void i2c_deregister_entry(int id)
+ table = i2c_entries[id]->ctl_table;
+ unregister_sysctl_table(i2c_entries[id]);
+ /* 2-step kfree needed to keep gcc happy about const points */
+- (const char *) temp = table[4].procname;
++ temp = (char *) table[4].procname;
+ kfree(temp);
+ kfree(table);
+ i2c_entries[id] = NULL;
+@@ -287,7 +287,7 @@ int i2c_proc_chips(ctl_table * ctl, int
+ if(copy_to_user(buffer, BUF, buflen))
+ return -EFAULT;
+ curbufsize += buflen;
+- (char *) buffer += buflen;
++ buffer = (char *) buffer + buflen;
+ }
+ *lenp = curbufsize;
+ filp->f_pos += curbufsize;
+@@ -318,7 +318,7 @@ int i2c_sysctl_chips(ctl_table * table,
+ sizeof(struct
+ i2c_chips_data)))
+ return -EFAULT;
+- (char *) oldval +=
++ oldval = (char *) oldval +
+ sizeof(struct i2c_chips_data);
+ nrels++;
+ }
+@@ -473,7 +473,7 @@ int i2c_parse_reals(int *nrels, void *bu
+ !((ret=get_user(nextchar, (char *) buffer))) &&
+ isspace((int) nextchar)) {
+ bufsize--;
+- ((char *) buffer)++;
++ buffer = (char *) buffer + 1;
+ }
+
+ if (ret)
+@@ -492,7 +492,7 @@ int i2c_parse_reals(int *nrels, void *bu
+ && (nextchar == '-')) {
+ min = 1;
+ bufsize--;
+- ((char *) buffer)++;
++ buffer = (char *) buffer + 1;
+ }
+ if (ret)
+ return -EFAULT;
+@@ -503,7 +503,7 @@ int i2c_parse_reals(int *nrels, void *bu
+ isdigit((int) nextchar)) {
+ res = res * 10 + nextchar - '0';
+ bufsize--;
+- ((char *) buffer)++;
++ buffer = (char *) buffer + 1;
+ }
+ if (ret)
+ return -EFAULT;
+@@ -517,7 +517,7 @@ int i2c_parse_reals(int *nrels, void *bu
+ if (bufsize && (nextchar == '.')) {
+ /* Skip the dot */
+ bufsize--;
+- ((char *) buffer)++;
++ buffer = (char *) buffer + 1;
+
+ /* Read digits while they are significant */
+ while (bufsize && (mag > 0) &&
+@@ -526,7 +526,7 @@ int i2c_parse_reals(int *nrels, void *bu
+ res = res * 10 + nextchar - '0';
+ mag--;
+ bufsize--;
+- ((char *) buffer)++;
++ buffer = (char *) buffer + 1;
+ }
+ if (ret)
+ return -EFAULT;
+@@ -542,7 +542,7 @@ int i2c_parse_reals(int *nrels, void *bu
+ !((ret=get_user(nextchar, (char *) buffer))) &&
+ !isspace((int) nextchar)) {
+ bufsize--;
+- ((char *) buffer)++;
++ buffer = (char *) buffer + 1;
+ }
+ if (ret)
+ return -EFAULT;
+@@ -574,7 +574,7 @@ int i2c_write_reals(int nrels, void *buf
+ if(put_user(' ', (char *) buffer))
+ return -EFAULT;
+ curbufsize++;
+- ((char *) buffer)++;
++ buffer = (char *) buffer + 1;
+ }
+
+ /* Fill BUF with the representation of the next string */
+@@ -615,7 +615,7 @@ int i2c_write_reals(int nrels, void *buf
+ if(copy_to_user(buffer, BUF, buflen))
+ return -EFAULT;
+ curbufsize += buflen;
+- (char *) buffer += buflen;
++ buffer = (char *) buffer + buflen;
+
+ nr++;
+ }
+diff -rupN linux-2.4.32/drivers/ide/legacy/hd.c linux-2.4.32.more-gcc4-fixes-v1/drivers/ide/legacy/hd.c
+--- linux-2.4.32/drivers/ide/legacy/hd.c 2003-06-14 13:30:22.000000000 +0200
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/ide/legacy/hd.c 2005-11-17 13:31:16.000000000 +0100
+@@ -694,7 +694,11 @@ static int hd_release(struct inode * ino
+ return 0;
+ }
+
+-extern struct block_device_operations hd_fops;
++static struct block_device_operations hd_fops = {
++ open: hd_open,
++ release: hd_release,
++ ioctl: hd_ioctl,
++};
+
+ static struct gendisk hd_gendisk = {
+ major: MAJOR_NR,
+@@ -718,12 +722,6 @@ static void hd_interrupt(int irq, void *
+ sti();
+ }
+
+-static struct block_device_operations hd_fops = {
+- open: hd_open,
+- release: hd_release,
+- ioctl: hd_ioctl,
+-};
+-
+ /*
+ * This is the hard disk IRQ description. The SA_INTERRUPT in sa_flags
+ * means we run the IRQ-handler with interrupts disabled: this is bad for
+diff -rupN linux-2.4.32/drivers/ieee1394/highlevel.c linux-2.4.32.more-gcc4-fixes-v1/drivers/ieee1394/highlevel.c
+--- linux-2.4.32/drivers/ieee1394/highlevel.c 2003-11-29 00:28:11.000000000 +0100
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/ieee1394/highlevel.c 2005-11-17 13:31:16.000000000 +0100
+@@ -500,7 +500,7 @@ int highlevel_read(struct hpsb_host *hos
+ rcode = RCODE_TYPE_ERROR;
+ }
+
+- (u8 *)data += partlength;
++ data += partlength;
+ length -= partlength;
+ addr += partlength;
+
+@@ -546,7 +546,7 @@ int highlevel_write(struct hpsb_host *ho
+ rcode = RCODE_TYPE_ERROR;
+ }
+
+- (u8 *)data += partlength;
++ data += partlength;
+ length -= partlength;
+ addr += partlength;
+
+diff -rupN linux-2.4.32/drivers/isdn/eicon/eicon.h linux-2.4.32.more-gcc4-fixes-v1/drivers/isdn/eicon/eicon.h
+--- linux-2.4.32/drivers/isdn/eicon/eicon.h 2002-08-07 00:52:20.000000000 +0200
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/isdn/eicon/eicon.h 2005-11-17 13:31:16.000000000 +0100
+@@ -344,7 +344,6 @@ typedef struct eicon_card {
+
+ #include "eicon_idi.h"
+
+-extern eicon_card *cards;
+ extern char *eicon_ctype_name[];
+
+
+diff -rupN linux-2.4.32/drivers/isdn/hisax/hfc_pci.c linux-2.4.32.more-gcc4-fixes-v1/drivers/isdn/hisax/hfc_pci.c
+--- linux-2.4.32/drivers/isdn/hisax/hfc_pci.c 2004-11-17 18:36:42.000000000 +0100
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/isdn/hisax/hfc_pci.c 2005-11-17 13:31:16.000000000 +0100
+@@ -1742,7 +1742,7 @@ setup_hfcpci(struct IsdnCard *card)
+ /* Allocate memory for FIFOS */
+ /* Because the HFC-PCI needs a 32K physical alignment, we */
+ /* need to allocate the double mem and align the address */
+- if (!((void *) cs->hw.hfcpci.share_start = kmalloc(65536, GFP_KERNEL))) {
++ if (!(cs->hw.hfcpci.share_start = kmalloc(65536, GFP_KERNEL))) {
+ printk(KERN_WARNING "HFC-PCI: Error allocating memory for FIFO!\n");
+ return 0;
+ }
+diff -rupN linux-2.4.32/drivers/md/lvm-internal.h linux-2.4.32.more-gcc4-fixes-v1/drivers/md/lvm-internal.h
+--- linux-2.4.32/drivers/md/lvm-internal.h 2003-11-29 00:28:12.000000000 +0100
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/md/lvm-internal.h 2005-11-17 13:31:16.000000000 +0100
+@@ -45,7 +45,6 @@ extern int loadtime;
+ extern const char *const lvm_name;
+
+
+-extern uint vg_count;
+ extern vg_t *vg[];
+ extern struct file_operations lvm_chr_fops;
+
+diff -rupN linux-2.4.32/drivers/media/video/bttvp.h linux-2.4.32.more-gcc4-fixes-v1/drivers/media/video/bttvp.h
+--- linux-2.4.32/drivers/media/video/bttvp.h 2003-11-29 00:28:12.000000000 +0100
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/media/video/bttvp.h 2005-11-17 13:31:16.000000000 +0100
+@@ -58,7 +58,6 @@ extern int pvr_boot(struct bttv *btv);
+
+ #define BTTV_MAX 16
+ extern unsigned int bttv_num; /* number of Bt848s in use */
+-extern struct bttv bttvs[BTTV_MAX];
+
+ #define UNSET -1U
+
+@@ -203,6 +202,8 @@ struct bttv {
+ int shutdown;
+ void (*audio_hook)(struct bttv *btv, struct video_audio *v, int set);
+ };
++
++extern struct bttv bttvs[BTTV_MAX];
+ #endif
+
+ #define btwrite(dat,adr) writel((dat), (char *) (btv->bt848_mem+(adr)))
+diff -rupN linux-2.4.32/drivers/media/video/videodev.c linux-2.4.32.more-gcc4-fixes-v1/drivers/media/video/videodev.c
+--- linux-2.4.32/drivers/media/video/videodev.c 2004-08-08 10:56:31.000000000 +0200
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/media/video/videodev.c 2005-11-17 13:31:16.000000000 +0100
+@@ -489,7 +489,18 @@ static void videodev_proc_destroy_dev (s
+
+ #endif /* CONFIG_VIDEO_PROC_FS */
+
+-extern struct file_operations video_fops;
++static struct file_operations video_fops=
++{
++ owner: THIS_MODULE,
++ llseek: no_llseek,
++ read: video_read,
++ write: video_write,
++ ioctl: video_ioctl,
++ mmap: video_mmap,
++ open: video_open,
++ release: video_release,
++ poll: video_poll,
++};
+
+ /**
+ * video_register_device - register video4linux devices
+@@ -633,19 +644,6 @@ void video_unregister_device(struct vide
+ }
+
+
+-static struct file_operations video_fops=
+-{
+- owner: THIS_MODULE,
+- llseek: no_llseek,
+- read: video_read,
+- write: video_write,
+- ioctl: video_ioctl,
+- mmap: video_mmap,
+- open: video_open,
+- release: video_release,
+- poll: video_poll,
+-};
+-
+ /*
+ * Initialise video for linux
+ */
+diff -rupN linux-2.4.32/drivers/net/3c507.c linux-2.4.32.more-gcc4-fixes-v1/drivers/net/3c507.c
+--- linux-2.4.32/drivers/net/3c507.c 2003-11-29 00:28:12.000000000 +0100
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/net/3c507.c 2005-11-17 13:31:16.000000000 +0100
+@@ -306,6 +306,7 @@ static void el16_tx_timeout (struct net_
+ static void hardware_send_packet(struct net_device *dev, void *buf, short length, short pad);
+ static void init_82586_mem(struct net_device *dev);
+ static struct ethtool_ops netdev_ethtool_ops;
++static void init_rx_bufs(struct net_device *);
+
+
+ /* Check for a network adaptor of this type, and return '0' iff one exists.
+@@ -602,7 +603,6 @@ static void el16_interrupt(int irq, void
+ }
+
+ if ((status & 0x0070) != 0x0040 && netif_running(dev)) {
+- static void init_rx_bufs(struct net_device *);
+ /* The Rx unit is not ready, it must be hung. Restart the receiver by
+ initializing the rx buffers, and issuing an Rx start command. */
+ if (net_debug)
+diff -rupN linux-2.4.32/drivers/net/acenic.c linux-2.4.32.more-gcc4-fixes-v1/drivers/net/acenic.c
+--- linux-2.4.32/drivers/net/acenic.c 2003-08-25 20:07:43.000000000 +0200
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/net/acenic.c 2005-11-17 13:31:16.000000000 +0100
+@@ -594,6 +594,7 @@ static struct net_device *root_dev;
+
+ static int probed __initdata = 0;
+
++static void ace_watchdog(struct net_device *dev);
+
+ int __devinit acenic_probe (ACE_PROBE_ARG)
+ {
+@@ -665,7 +666,6 @@ int __devinit acenic_probe (ACE_PROBE_AR
+ dev->vlan_rx_kill_vid = ace_vlan_rx_kill_vid;
+ #endif
+ if (1) {
+- static void ace_watchdog(struct net_device *dev);
+ dev->tx_timeout = &ace_watchdog;
+ dev->watchdog_timeo = 5*HZ;
+ }
+diff -rupN linux-2.4.32/drivers/net/arcnet/arcnet.c linux-2.4.32.more-gcc4-fixes-v1/drivers/net/arcnet/arcnet.c
+--- linux-2.4.32/drivers/net/arcnet/arcnet.c 2003-08-25 20:07:43.000000000 +0200
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/net/arcnet/arcnet.c 2005-11-17 13:31:16.000000000 +0100
+@@ -277,7 +277,7 @@ static void release_arcbuf(struct net_de
+ BUGLVL(D_DURING) {
+ BUGMSG(D_DURING, "release_arcbuf: freed #%d; buffer queue is now: ",
+ bufnum);
+- for (i = lp->next_buf; i != lp->first_free_buf; i = ++i % 5)
++ for (i = lp->next_buf; i != lp->first_free_buf; i = (i+1) % 5)
+ BUGMSG2(D_DURING, "#%d ", lp->buf_queue[i]);
+ BUGMSG2(D_DURING, "\n");
+ }
+@@ -310,7 +310,7 @@ static int get_arcbuf(struct net_device
+
+ BUGLVL(D_DURING) {
+ BUGMSG(D_DURING, "get_arcbuf: got #%d; buffer queue is now: ", buf);
+- for (i = lp->next_buf; i != lp->first_free_buf; i = ++i % 5)
++ for (i = lp->next_buf; i != lp->first_free_buf; i = (i+1) % 5)
+ BUGMSG2(D_DURING, "#%d ", lp->buf_queue[i]);
+ BUGMSG2(D_DURING, "\n");
+ }
+diff -rupN linux-2.4.32/drivers/net/arlan.c linux-2.4.32.more-gcc4-fixes-v1/drivers/net/arlan.c
+--- linux-2.4.32/drivers/net/arlan.c 2002-08-07 00:52:20.000000000 +0200
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/net/arlan.c 2005-11-17 13:31:16.000000000 +0100
+@@ -12,7 +12,7 @@
+ # error FIXME: this driver requires a 32-bit platform
+ #endif
+
+-static const char *arlan_version = "C.Jennigs 97 & Elmer.Joandi@ut.ee Oct'98, http://www.ylenurme.ee/~elmer/655/";
++const char *arlan_version = "C.Jennigs 97 & Elmer.Joandi@ut.ee Oct'98, http://www.ylenurme.ee/~elmer/655/";
+
+ struct net_device *arlan_device[MAX_ARLANS];
+ int last_arlan;
+diff -rupN linux-2.4.32/drivers/net/arlan.h linux-2.4.32.more-gcc4-fixes-v1/drivers/net/arlan.h
+--- linux-2.4.32/drivers/net/arlan.h 2001-03-30 19:05:06.000000000 +0200
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/net/arlan.h 2005-11-17 13:31:16.000000000 +0100
+@@ -47,7 +47,6 @@ extern int init_arlan_proc(void);
+
+ extern struct net_device *arlan_device[MAX_ARLANS];
+ extern int arlan_debug;
+-extern char * siteName;
+ extern int arlan_entry_debug;
+ extern int arlan_exit_debug;
+ extern int testMemory;
+diff -rupN linux-2.4.32/drivers/net/bonding/bond_alb.c linux-2.4.32.more-gcc4-fixes-v1/drivers/net/bonding/bond_alb.c
+--- linux-2.4.32/drivers/net/bonding/bond_alb.c 2004-04-14 20:22:20.000000000 +0200
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/net/bonding/bond_alb.c 2005-11-17 13:31:16.000000000 +0100
+@@ -1275,7 +1275,7 @@ void bond_alb_deinitialize(struct bondin
+ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
+ {
+ struct bonding *bond = bond_dev->priv;
+- struct ethhdr *eth_data = (struct ethhdr *)skb->mac.raw = skb->data;
++ struct ethhdr *eth_data;
+ struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
+ struct slave *tx_slave = NULL;
+ static u32 ip_bcast = 0xffffffff;
+@@ -1285,6 +1285,9 @@ int bond_alb_xmit(struct sk_buff *skb, s
+ u8 *hash_start = NULL;
+ int res = 1;
+
++ skb->mac.raw = (unsigned char *)skb->data;
++ eth_data = (struct ethhdr *)skb->mac.raw;
++
+ /* make sure that the curr_active_slave and the slaves list do
+ * not change during tx
+ */
+diff -rupN linux-2.4.32/drivers/net/de4x5.c linux-2.4.32.more-gcc4-fixes-v1/drivers/net/de4x5.c
+--- linux-2.4.32/drivers/net/de4x5.c 2004-02-18 15:16:23.000000000 +0100
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/net/de4x5.c 2005-11-17 13:31:16.000000000 +0100
+@@ -5109,7 +5109,7 @@ mii_get_phy(struct net_device *dev)
+ lp->useMII = TRUE;
+
+ /* Search the MII address space for possible PHY devices */
+- for (n=0, lp->mii_cnt=0, i=1; !((i==1) && (n==1)); i=(++i)%DE4X5_MAX_MII) {
++ for (n=0, lp->mii_cnt=0, i=1; !((i==1) && (n==1)); i=(i+1)%DE4X5_MAX_MII) {
+ lp->phy[lp->active].addr = i;
+ if (i==0) n++; /* Count cycles */
+ while (de4x5_reset_phy(dev)<0) udelay(100);/* Wait for reset */
+diff -rupN linux-2.4.32/drivers/net/depca.c linux-2.4.32.more-gcc4-fixes-v1/drivers/net/depca.c
+--- linux-2.4.32/drivers/net/depca.c 2003-06-14 13:30:23.000000000 +0200
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/net/depca.c 2005-11-17 13:31:16.000000000 +0100
+@@ -1746,7 +1746,7 @@ static int load_packet(struct net_device
+
+ /* set up the buffer descriptors */
+ len = (skb->len < ETH_ZLEN) ? ETH_ZLEN : skb->len;
+- for (i = entry; i != end; i = (++i) & lp->txRingMask) {
++ for (i = entry; i != end; i = (i+1) & lp->txRingMask) {
+ /* clean out flags */
+ writel(readl(&lp->tx_ring[i].base) & ~T_FLAGS, &lp->tx_ring[i].base);
+ writew(0x0000, &lp->tx_ring[i].misc); /* clears other error flags */
+diff -rupN linux-2.4.32/drivers/net/hamradio/baycom_epp.c linux-2.4.32.more-gcc4-fixes-v1/drivers/net/hamradio/baycom_epp.c
+--- linux-2.4.32/drivers/net/hamradio/baycom_epp.c 2002-11-30 17:12:25.000000000 +0100
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/net/hamradio/baycom_epp.c 2005-11-17 13:31:16.000000000 +0100
+@@ -60,8 +60,10 @@
+ #include <net/ax25.h>
+ #endif /* CONFIG_AX25 || CONFIG_AX25_MODULE */
+
++static int my_errno;
++#define errno my_errno
+ #define __KERNEL_SYSCALLS__
+-#include <linux/unistd.h>
++#include <asm/unistd.h>
+
+ /* --------------------------------------------------------------------- */
+
+@@ -370,8 +372,6 @@ static char eppconfig_path[256] = "/usr/
+
+ static char *envp[] = { "HOME=/", "TERM=linux", "PATH=/usr/bin:/bin", NULL };
+
+-static int errno;
+-
+ static int exec_eppfpga(void *b)
+ {
+ struct baycom_state *bc = (struct baycom_state *)b;
+diff -rupN linux-2.4.32/drivers/net/hamradio/soundmodem/sm.h linux-2.4.32.more-gcc4-fixes-v1/drivers/net/hamradio/soundmodem/sm.h
+--- linux-2.4.32/drivers/net/hamradio/soundmodem/sm.h 2002-08-07 00:52:20.000000000 +0200
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/net/hamradio/soundmodem/sm.h 2005-11-17 13:31:16.000000000 +0100
+@@ -151,7 +151,6 @@ struct hardware_info {
+ /* --------------------------------------------------------------------- */
+
+ extern const char sm_drvname[];
+-extern const char sm_drvinfo[];
+
+ /* --------------------------------------------------------------------- */
+ /*
+@@ -353,7 +352,6 @@ extern const struct hardware_info sm_hw_
+
+ extern const struct modem_tx_info *sm_modem_tx_table[];
+ extern const struct modem_rx_info *sm_modem_rx_table[];
+-extern const struct hardware_info *sm_hardware_table[];
+
+ /* --------------------------------------------------------------------- */
+
+diff -rupN linux-2.4.32/drivers/net/irda/donauboe.c linux-2.4.32.more-gcc4-fixes-v1/drivers/net/irda/donauboe.c
+--- linux-2.4.32/drivers/net/irda/donauboe.c 2003-06-14 13:30:23.000000000 +0200
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/net/irda/donauboe.c 2005-11-17 13:31:16.000000000 +0100
+@@ -209,7 +209,11 @@ static int do_probe = DO_PROBE;
+ #ifdef CRC_EXPORTED
+ extern __u16 const irda_crc16_table[];
+ #else
+-static __u16 const irda_crc16_table[256] = {
++/* Our local version of irda_crc16_table must have a unique
++ name to prevent extern-redefined-as-static compile errors.
++ This #define redirects the irda_fcs() macro to our version. */
++#define irda_crc16_table donauboe_irda_crc16_table
++static __u16 const donauboe_irda_crc16_table[256] = {
+ 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf,
+ 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7,
+ 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e,
+diff -rupN linux-2.4.32/drivers/net/rrunner.c linux-2.4.32.more-gcc4-fixes-v1/drivers/net/rrunner.c
+--- linux-2.4.32/drivers/net/rrunner.c 2003-06-14 13:30:23.000000000 +0200
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/net/rrunner.c 2005-11-17 13:31:16.000000000 +0100
+@@ -234,7 +234,7 @@ int __init rr_hippi_probe (struct net_de
+ * Don't access any registes before this point!
+ */
+ #ifdef __BIG_ENDIAN
+- writel(readl(&regs->HostCtrl) | NO_SWAP, &regs->HostCtrl);
++ writel(readl(&rrpriv->regs->HostCtrl) | NO_SWAP, &rrpriv->regs->HostCtrl);
+ #endif
+ /*
+ * Need to add a case for little-endian 64-bit hosts here.
+diff -rupN linux-2.4.32/drivers/net/sk98lin/skvpd.c linux-2.4.32.more-gcc4-fixes-v1/drivers/net/sk98lin/skvpd.c
+--- linux-2.4.32/drivers/net/sk98lin/skvpd.c 2005-04-04 19:56:04.000000000 +0200
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/net/sk98lin/skvpd.c 2005-11-17 13:31:16.000000000 +0100
+@@ -472,7 +472,7 @@ SK_IOC IoC) /* IO Context */
+ ((unsigned char)pAC->vpd.vpd_buf[0x40] == 0x3c) &&
+ ((unsigned char)pAC->vpd.vpd_buf[0x41] == 0x45) ) {
+ printk(KERN_INFO "sk98lin : humm... Asus mainboard with buggy VPD ? correcting data.\n");
+- (unsigned char)pAC->vpd.vpd_buf[0x40] = 0x38;
++ pAC->vpd.vpd_buf[0x40] = 0x38;
+ }
+
+ /* find the end tag of the RO area */
+diff -rupN linux-2.4.32/drivers/net/wan/comx-hw-comx.c linux-2.4.32.more-gcc4-fixes-v1/drivers/net/wan/comx-hw-comx.c
+--- linux-2.4.32/drivers/net/wan/comx-hw-comx.c 2002-11-30 17:12:26.000000000 +0100
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/net/wan/comx-hw-comx.c 2005-11-17 13:31:16.000000000 +0100
+@@ -92,9 +92,9 @@ struct comx_privdata {
+ };
+
+ static struct net_device *memory_used[(COMX_MEM_MAX - COMX_MEM_MIN) / 0x10000];
+-extern struct comx_hardware hicomx_hw;
+-extern struct comx_hardware comx_hw;
+-extern struct comx_hardware cmx_hw;
++static struct comx_hardware hicomx_hw;
++static struct comx_hardware comx_hw;
++static struct comx_hardware cmx_hw;
+
+ static void COMX_interrupt(int irq, void *dev_id, struct pt_regs *regs);
+
+diff -rupN linux-2.4.32/drivers/net/wan/comx.h linux-2.4.32.more-gcc4-fixes-v1/drivers/net/wan/comx.h
+--- linux-2.4.32/drivers/net/wan/comx.h 2001-08-16 23:47:01.000000000 +0200
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/net/wan/comx.h 2005-11-17 13:31:16.000000000 +0100
+@@ -212,8 +212,6 @@ typedef u16 word;
+ #define SEEK_END 2
+ #endif
+
+-extern struct proc_dir_entry * comx_root_dir;
+-
+ extern int comx_register_hardware(struct comx_hardware *comx_hw);
+ extern int comx_unregister_hardware(char *name);
+ extern int comx_register_protocol(struct comx_protocol *comx_line);
+diff -rupN linux-2.4.32/drivers/net/wan/sdla_fr.c linux-2.4.32.more-gcc4-fixes-v1/drivers/net/wan/sdla_fr.c
+--- linux-2.4.32/drivers/net/wan/sdla_fr.c 2003-11-29 00:28:12.000000000 +0100
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/net/wan/sdla_fr.c 2005-11-17 13:31:16.000000000 +0100
+@@ -3929,7 +3929,7 @@ static int process_udp_mgmt_pkt(sdla_t*
+ break;
+ }
+
+- (void *)ptr_trc_el = card->u.f.curr_trc_el;
++ ptr_trc_el = (void *)card->u.f.curr_trc_el;
+
+ buffer_length = 0;
+ fr_udp_pkt->data[0x00] = 0x00;
+@@ -3980,7 +3980,7 @@ static int process_udp_mgmt_pkt(sdla_t*
+
+ ptr_trc_el ++;
+ if((void *)ptr_trc_el > card->u.f.trc_el_last)
+- (void*)ptr_trc_el = card->u.f.trc_el_base;
++ ptr_trc_el = (void*)card->u.f.trc_el_base;
+
+ buffer_length += sizeof(fpipemon_trc_hdr_t);
+ if(fpipemon_trc->fpipemon_trc_hdr.data_passed) {
+diff -rupN linux-2.4.32/drivers/net/wan/sdladrv.c linux-2.4.32.more-gcc4-fixes-v1/drivers/net/wan/sdladrv.c
+--- linux-2.4.32/drivers/net/wan/sdladrv.c 2001-09-23 21:06:34.000000000 +0200
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/net/wan/sdladrv.c 2005-11-17 13:31:16.000000000 +0100
+@@ -1002,7 +1002,7 @@ int sdla_peek (sdlahw_t* hw, unsigned lo
+ peek_by_4 ((unsigned long)hw->dpmbase + curpos, buf,
+ curlen);
+ addr += curlen;
+- (char*)buf += curlen;
++ buf = (char*)buf + curlen;
+ len -= curlen;
+ }
+
+@@ -1086,7 +1086,7 @@ int sdla_poke (sdlahw_t* hw, unsigned lo
+ poke_by_4 ((unsigned long)hw->dpmbase + curpos, buf,
+ curlen);
+ addr += curlen;
+- (char*)buf += curlen;
++ buf = (char*)buf + curlen;
+ len -= curlen;
+ }
+
+@@ -2127,10 +2127,10 @@ static int detect_s514 (sdlahw_t* hw)
+ modname, hw->irq);
+
+ /* map the physical PCI memory to virtual memory */
+- (void *)hw->dpmbase = ioremap((unsigned long)S514_mem_base_addr,
++ hw->dpmbase = (void *)ioremap((unsigned long)S514_mem_base_addr,
+ (unsigned long)MAX_SIZEOF_S514_MEMORY);
+ /* map the physical control register memory to virtual memory */
+- (void *)hw->vector = ioremap(
++ hw->vector = (unsigned long)ioremap(
+ (unsigned long)(S514_mem_base_addr + S514_CTRL_REG_BYTE),
+ (unsigned long)16);
+
+diff -rupN linux-2.4.32/drivers/net/wan/sdlamain.c linux-2.4.32.more-gcc4-fixes-v1/drivers/net/wan/sdlamain.c
+--- linux-2.4.32/drivers/net/wan/sdlamain.c 2003-11-29 00:28:12.000000000 +0100
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/net/wan/sdlamain.c 2005-11-17 13:31:16.000000000 +0100
+@@ -1027,7 +1027,7 @@ static int ioctl_dump (sdla_t* card, sdl
+ #endif
+ dump.length -= len;
+ dump.offset += len;
+- (char*)dump.ptr += len;
++ dump.ptr = (char*)dump.ptr + len;
+ }
+
+ sdla_mapmem(&card->hw, oldvec);/* restore DPM window position */
+diff -rupN linux-2.4.32/drivers/scsi/advansys.c linux-2.4.32.more-gcc4-fixes-v1/drivers/scsi/advansys.c
+--- linux-2.4.32/drivers/scsi/advansys.c 2005-01-19 18:00:53.000000000 +0100
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/scsi/advansys.c 2005-11-17 13:31:16.000000000 +0100
+@@ -3456,9 +3456,9 @@ do { \
+ /*
+ * Default EEPROM Configuration structure defined in a_init.c.
+ */
+-extern ADVEEP_3550_CONFIG Default_3550_EEPROM_Config;
+-extern ADVEEP_38C0800_CONFIG Default_38C0800_EEPROM_Config;
+-extern ADVEEP_38C1600_CONFIG Default_38C1600_EEPROM_Config;
++static ADVEEP_3550_CONFIG Default_3550_EEPROM_Config;
++static ADVEEP_38C0800_CONFIG Default_38C0800_EEPROM_Config;
++static ADVEEP_38C1600_CONFIG Default_38C1600_EEPROM_Config;
+
+ /*
+ * DvcGetPhyAddr() flag arguments
+@@ -7171,7 +7171,7 @@ asc_isr_callback(ASC_DVC_VAR *asc_dvc_va
+ * then return the number of underrun bytes.
+ */
+ if (scp->request_bufflen != 0 && qdonep->remain_bytes != 0 &&
+- qdonep->remain_bytes <= scp->request_bufflen != 0) {
++ qdonep->remain_bytes <= scp->request_bufflen) {
+ ASC_DBG1(1, "asc_isr_callback: underrun condition %u bytes\n",
+ (unsigned) qdonep->remain_bytes);
+ scp->resid = qdonep->remain_bytes;
+diff -rupN linux-2.4.32/drivers/scsi/atp870u.c linux-2.4.32.more-gcc4-fixes-v1/drivers/scsi/atp870u.c
+--- linux-2.4.32/drivers/scsi/atp870u.c 2002-08-07 00:52:21.000000000 +0200
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/scsi/atp870u.c 2005-11-17 13:31:16.000000000 +0100
+@@ -807,19 +807,19 @@ oktosend:
+ bttl = virt_to_bus(sgpnt[j].address);
+ l = sgpnt[j].length;
+ while (l > 0x10000) {
+- (unsigned short int) (((unsigned short int *) (prd))[i + 3]) = 0x0000;
+- (unsigned short int) (((unsigned short int *) (prd))[i + 2]) = 0x0000;
+- (unsigned long) (((unsigned long *) (prd))[i >> 1]) = bttl;
++ (((unsigned short int *) (prd))[i + 3]) = 0x0000;
++ (((unsigned short int *) (prd))[i + 2]) = 0x0000;
++ (((unsigned long *) (prd))[i >> 1]) = bttl;
+ l -= 0x10000;
+ bttl += 0x10000;
+ i += 0x04;
+ }
+- (unsigned long) (((unsigned long *) (prd))[i >> 1]) = bttl;
+- (unsigned short int) (((unsigned short int *) (prd))[i + 2]) = l;
+- (unsigned short int) (((unsigned short int *) (prd))[i + 3]) = 0;
++ (((unsigned long *) (prd))[i >> 1]) = bttl;
++ (((unsigned short int *) (prd))[i + 2]) = l;
++ (((unsigned short int *) (prd))[i + 3]) = 0;
+ i += 0x04;
+ }
+- (unsigned short int) (((unsigned short int *) (prd))[i - 1]) = 0x8000;
++ (((unsigned short int *) (prd))[i - 1]) = 0x8000;
+ } else {
+ /*
+ * For a linear request write a chain of blocks
+@@ -828,16 +828,16 @@ oktosend:
+ l = workrequ->request_bufflen;
+ i = 0;
+ while (l > 0x10000) {
+- (unsigned short int) (((unsigned short int *) (prd))[i + 3]) = 0x0000;
+- (unsigned short int) (((unsigned short int *) (prd))[i + 2]) = 0x0000;
+- (unsigned long) (((unsigned long *) (prd))[i >> 1]) = bttl;
++ (((unsigned short int *) (prd))[i + 3]) = 0x0000;
++ (((unsigned short int *) (prd))[i + 2]) = 0x0000;
++ (((unsigned long *) (prd))[i >> 1]) = bttl;
+ l -= 0x10000;
+ bttl += 0x10000;
+ i += 0x04;
+ }
+- (unsigned short int) (((unsigned short int *) (prd))[i + 3]) = 0x8000;
+- (unsigned short int) (((unsigned short int *) (prd))[i + 2]) = l;
+- (unsigned long) (((unsigned long *) (prd))[i >> 1]) = bttl;
++ (((unsigned short int *) (prd))[i + 3]) = 0x8000;
++ (((unsigned short int *) (prd))[i + 2]) = l;
++ (((unsigned long *) (prd))[i >> 1]) = bttl;
+ }
+ tmpcip = tmpcip + 4;
+ dev->id[target_id].prdaddru = virt_to_bus(dev->id[target_id].prd_tableu);
+diff -rupN linux-2.4.32/drivers/scsi/cpqfcTSstructs.h linux-2.4.32.more-gcc4-fixes-v1/drivers/scsi/cpqfcTSstructs.h
+--- linux-2.4.32/drivers/scsi/cpqfcTSstructs.h 2004-02-18 15:16:23.000000000 +0100
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/scsi/cpqfcTSstructs.h 2005-11-17 13:31:16.000000000 +0100
+@@ -965,7 +965,6 @@ void fcSestReset(CPQFCHBA *);
+
+ void cpqfc_pci_unmap(struct pci_dev *pcidev, Scsi_Cmnd * cmd, PTACHYON fcChip, __u32 x_ID);
+
+-extern const __u8 valid_al_pa[];
+ extern const int number_of_al_pa;
+
+ #define FCP_RESID_UNDER 0x80000
+diff -rupN linux-2.4.32/drivers/scsi/cpqfcTSworker.c linux-2.4.32.more-gcc4-fixes-v1/drivers/scsi/cpqfcTSworker.c
+--- linux-2.4.32/drivers/scsi/cpqfcTSworker.c 2003-06-14 13:30:24.000000000 +0200
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/scsi/cpqfcTSworker.c 2005-11-17 13:31:16.000000000 +0100
+@@ -48,6 +48,7 @@
+ #include "cpqfcTSchip.h"
+ #include "cpqfcTSstructs.h"
+ #include "cpqfcTStrigger.h"
++static const __u8 valid_al_pa[];
+
+ //#define LOGIN_DBG 1
+
+diff -rupN linux-2.4.32/drivers/sound/wavfront.c linux-2.4.32.more-gcc4-fixes-v1/drivers/sound/wavfront.c
+--- linux-2.4.32/drivers/sound/wavfront.c 2001-10-11 13:34:42.000000000 +0200
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/sound/wavfront.c 2005-11-17 13:31:16.000000000 +0100
+@@ -2484,11 +2484,11 @@ static int __init detect_wavefront (int
+ #include <linux/fs.h>
+ #include <linux/mm.h>
+ #include <linux/slab.h>
+-#include <linux/unistd.h>
++static int my_errno;
++#define errno my_errno
++#include <asm/unistd.h>
+ #include <asm/uaccess.h>
+
+-static int errno;
+-
+ static int
+ wavefront_download_firmware (char *path)
+
+diff -rupN linux-2.4.32/drivers/usb/audio.c linux-2.4.32.more-gcc4-fixes-v1/drivers/usb/audio.c
+--- linux-2.4.32/drivers/usb/audio.c 2004-11-17 18:36:42.000000000 +0100
++++ linux-2.4.32.more-gcc4-fixes-v1/drivers/usb/audio.c 2005-11-17 13:31:16.000000000 +0100
+@@ -462,6 +462,7 @@ struct usb_audio_state {
+
+ /* prevent picking up a bogus abs macro */
+ #undef abs
++#define abs my_abs
+ static inline int abs(int x)
+ {
+ if (x < 0)
+diff -rupN linux-2.4.32/fs/intermezzo/presto.c linux-2.4.32.more-gcc4-fixes-v1/fs/intermezzo/presto.c
+--- linux-2.4.32/fs/intermezzo/presto.c 2002-11-30 17:12:28.000000000 +0100
++++ linux-2.4.32.more-gcc4-fixes-v1/fs/intermezzo/presto.c 2005-11-17 13:31:16.000000000 +0100
+@@ -344,8 +344,8 @@ int izo_mark_cache(struct dentry *dentry
+ return -EBADF;
+ }
+
+- ((int)cache->cache_flags) &= and_flag;
+- ((int)cache->cache_flags) |= or_flag;
++ cache->cache_flags &= and_flag;
++ cache->cache_flags |= or_flag;
+ if (res)
+ *res = (int)cache->cache_flags;
+
+@@ -383,8 +383,8 @@ int izo_mark_fset(struct dentry *dentry,
+ make_bad_inode(dentry->d_inode);
+ return -EBADF;
+ }
+- ((int)fset->fset_flags) &= and_flag;
+- ((int)fset->fset_flags) |= or_flag;
++ fset->fset_flags &= and_flag;
++ fset->fset_flags |= or_flag;
+ if (res)
+ *res = (int)fset->fset_flags;
+
+diff -rupN linux-2.4.32/include/asm-ppc/spinlock.h linux-2.4.32.more-gcc4-fixes-v1/include/asm-ppc/spinlock.h
+--- linux-2.4.32/include/asm-ppc/spinlock.h 2003-06-14 13:30:28.000000000 +0200
++++ linux-2.4.32.more-gcc4-fixes-v1/include/asm-ppc/spinlock.h 2005-11-17 13:31:16.000000000 +0100
+@@ -40,7 +40,6 @@ typedef struct {
+ extern void _spin_lock(spinlock_t *lock);
+ extern void _spin_unlock(spinlock_t *lock);
+ extern int spin_trylock(spinlock_t *lock);
+-extern unsigned long __spin_trylock(volatile unsigned long *lock);
+
+ #define spin_lock(lp) _spin_lock(lp)
+ #define spin_unlock(lp) _spin_unlock(lp)
+diff -rupN linux-2.4.32/include/linux/fsfilter.h linux-2.4.32.more-gcc4-fixes-v1/include/linux/fsfilter.h
+--- linux-2.4.32/include/linux/fsfilter.h 2004-11-17 18:36:42.000000000 +0100
++++ linux-2.4.32.more-gcc4-fixes-v1/include/linux/fsfilter.h 2005-11-17 13:31:16.000000000 +0100
+@@ -70,7 +70,6 @@ struct filter_fs {
+ #define FILTER_FS_XFS 3
+ #define FILTER_FS_OBDFS 4
+ #define FILTER_FS_TMPFS 5
+-extern struct filter_fs filter_oppar[FILTER_FS_TYPES];
+
+ struct filter_fs *filter_get_filter_fs(const char *cache_type);
+ void filter_setup_journal_ops(struct filter_fs *ops, char *cache_type);
+diff -rupN linux-2.4.32/include/linux/generic_serial.h linux-2.4.32.more-gcc4-fixes-v1/include/linux/generic_serial.h
+--- linux-2.4.32/include/linux/generic_serial.h 2002-02-26 13:26:58.000000000 +0100
++++ linux-2.4.32.more-gcc4-fixes-v1/include/linux/generic_serial.h 2005-11-17 13:31:16.000000000 +0100
+@@ -98,6 +98,4 @@ int gs_setserial(struct gs_port *port,
+ int gs_getserial(struct gs_port *port, struct serial_struct *sp);
+ void gs_got_break(struct gs_port *port);
+
+-extern int gs_debug;
+-
+ #endif
+diff -rupN linux-2.4.32/include/linux/i2c.h linux-2.4.32.more-gcc4-fixes-v1/include/linux/i2c.h
+--- linux-2.4.32/include/linux/i2c.h 2005-06-01 18:02:21.000000000 +0200
++++ linux-2.4.32.more-gcc4-fixes-v1/include/linux/i2c.h 2005-11-17 13:31:16.000000000 +0100
+@@ -70,7 +70,7 @@ extern int i2c_master_recv(struct i2c_cl
+
+ /* Transfer num messages.
+ */
+-extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],int num);
++extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msg,int num);
+
+ /*
+ * Some adapter types (i.e. PCF 8584 based ones) may support slave behaviuor.
+@@ -197,7 +197,7 @@ struct i2c_algorithm {
+ to NULL. If an adapter algorithm can do SMBus access, set
+ smbus_xfer. If set to NULL, the SMBus protocol is simulated
+ using common I2C messages */
+- int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg msgs[],
++ int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg *msgs,
+ int num);
+ int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr,
+ unsigned short flags, char read_write,
+diff -rupN linux-2.4.32/include/linux/intermezzo_fs.h linux-2.4.32.more-gcc4-fixes-v1/include/linux/intermezzo_fs.h
+--- linux-2.4.32/include/linux/intermezzo_fs.h 2005-01-19 18:00:53.000000000 +0100
++++ linux-2.4.32.more-gcc4-fixes-v1/include/linux/intermezzo_fs.h 2005-11-17 13:31:16.000000000 +0100
+@@ -321,7 +321,6 @@ int presto_fwrite(struct file *file, con
+ int presto_ispresto(struct inode *);
+
+ /* super.c */
+-extern struct file_system_type presto_fs_type;
+ extern int init_intermezzo_fs(void);
+
+ /* fileset.c */
+diff -rupN linux-2.4.32/include/linux/nbd.h linux-2.4.32.more-gcc4-fixes-v1/include/linux/nbd.h
+--- linux-2.4.32/include/linux/nbd.h 2002-08-07 00:52:26.000000000 +0200
++++ linux-2.4.32.more-gcc4-fixes-v1/include/linux/nbd.h 2005-11-17 13:31:16.000000000 +0100
+@@ -29,34 +29,6 @@
+
+ #include <linux/blk.h>
+
+-#ifdef PARANOIA
+-extern int requests_in;
+-extern int requests_out;
+-#endif
+-
+-static void
+-nbd_end_request(struct request *req)
+-{
+- struct buffer_head *bh;
+- unsigned nsect;
+- unsigned long flags;
+- int uptodate = (req->errors == 0) ? 1 : 0;
+-
+-#ifdef PARANOIA
+- requests_out++;
+-#endif
+- spin_lock_irqsave(&io_request_lock, flags);
+- while((bh = req->bh) != NULL) {
+- nsect = bh->b_size >> 9;
+- blk_finished_io(nsect);
+- req->bh = bh->b_reqnext;
+- bh->b_reqnext = NULL;
+- bh->b_end_io(bh, uptodate);
+- }
+- blkdev_release_request(req);
+- spin_unlock_irqrestore(&io_request_lock, flags);
+-}
+-
+ #define MAX_NBD 128
+
+ struct nbd_device {
+diff -rupN linux-2.4.32/include/net/irda/irlan_event.h linux-2.4.32.more-gcc4-fixes-v1/include/net/irda/irlan_event.h
+--- linux-2.4.32/include/net/irda/irlan_event.h 1999-03-09 11:36:02.000000000 +0100
++++ linux-2.4.32.more-gcc4-fixes-v1/include/net/irda/irlan_event.h 2005-11-17 13:31:16.000000000 +0100
+@@ -67,8 +67,6 @@ typedef enum {
+ IRLAN_WATCHDOG_TIMEOUT,
+ } IRLAN_EVENT;
+
+-extern char *irlan_state[];
+-
+ void irlan_do_client_event(struct irlan_cb *self, IRLAN_EVENT event,
+ struct sk_buff *skb);
+
+diff -rupN linux-2.4.32/include/net/irda/irttp.h linux-2.4.32.more-gcc4-fixes-v1/include/net/irda/irttp.h
+--- linux-2.4.32/include/net/irda/irttp.h 2003-06-14 13:30:29.000000000 +0200
++++ linux-2.4.32.more-gcc4-fixes-v1/include/net/irda/irttp.h 2005-11-17 13:31:16.000000000 +0100
+@@ -209,6 +209,4 @@ static inline int irttp_is_primary(struc
+ return(irlap_is_primary(self->lsap->lap->irlap));
+ }
+
+-extern struct irttp_cb *irttp;
+-
+ #endif /* IRTTP_H */
+diff -rupN linux-2.4.32/include/net/irda/qos.h linux-2.4.32.more-gcc4-fixes-v1/include/net/irda/qos.h
+--- linux-2.4.32/include/net/irda/qos.h 2001-07-21 11:47:34.000000000 +0200
++++ linux-2.4.32.more-gcc4-fixes-v1/include/net/irda/qos.h 2005-11-17 13:31:16.000000000 +0100
+@@ -83,7 +83,6 @@ struct qos_info {
+ extern int sysctl_max_baud_rate;
+ extern int sysctl_max_inactive_time;
+
+-extern __u32 baud_rates[];
+ extern __u32 data_sizes[];
+ extern __u32 min_turn_times[];
+ extern __u32 add_bofs[];
+diff -rupN linux-2.4.32/include/net/udp.h linux-2.4.32.more-gcc4-fixes-v1/include/net/udp.h
+--- linux-2.4.32/include/net/udp.h 2005-01-19 18:00:53.000000000 +0100
++++ linux-2.4.32.more-gcc4-fixes-v1/include/net/udp.h 2005-11-17 13:31:16.000000000 +0100
+@@ -25,6 +25,7 @@
+ #include <linux/udp.h>
+ #include <linux/poll.h>
+ #include <net/sock.h>
++#include <net/snmp.h>
+
+ #define UDP_HTABLE_SIZE 128
+
+diff -rupN linux-2.4.32/net/ipv6/ip6_fib.c linux-2.4.32.more-gcc4-fixes-v1/net/ipv6/ip6_fib.c
+--- linux-2.4.32/net/ipv6/ip6_fib.c 2005-11-17 13:27:30.000000000 +0100
++++ linux-2.4.32.more-gcc4-fixes-v1/net/ipv6/ip6_fib.c 2005-11-17 13:31:16.000000000 +0100
+@@ -95,7 +95,7 @@ static __u32 rt_sernum = 0;
+
+ static struct timer_list ip6_fib_timer = { function: fib6_run_gc };
+
+-static struct fib6_walker_t fib6_walker_list = {
++struct fib6_walker_t fib6_walker_list = {
+ &fib6_walker_list, &fib6_walker_list,
+ };
+
+diff -rupN linux-2.4.32/net/ipv6/sysctl_net_ipv6.c linux-2.4.32.more-gcc4-fixes-v1/net/ipv6/sysctl_net_ipv6.c
+--- linux-2.4.32/net/ipv6/sysctl_net_ipv6.c 2004-04-14 20:22:21.000000000 +0200
++++ linux-2.4.32.more-gcc4-fixes-v1/net/ipv6/sysctl_net_ipv6.c 2005-11-17 13:31:16.000000000 +0100
+@@ -31,17 +31,14 @@ ctl_table ipv6_table[] = {
+
+ #ifdef MODULE
+ static struct ctl_table_header *ipv6_sysctl_header;
+-static struct ctl_table ipv6_root_table[];
+-static struct ctl_table ipv6_net_table[];
+
+-
+-ctl_table ipv6_root_table[] = {
+- {CTL_NET, "net", NULL, 0, 0555, ipv6_net_table},
++static ctl_table ipv6_net_table[] = {
++ {NET_IPV6, "ipv6", NULL, 0, 0555, ipv6_table},
+ {0}
+ };
+
+-ctl_table ipv6_net_table[] = {
+- {NET_IPV6, "ipv6", NULL, 0, 0555, ipv6_table},
++static ctl_table ipv6_root_table[] = {
++ {CTL_NET, "net", NULL, 0, 0555, ipv6_net_table},
+ {0}
+ };
+
+diff -rupN linux-2.4.32/net/irda/qos.c linux-2.4.32.more-gcc4-fixes-v1/net/irda/qos.c
+--- linux-2.4.32/net/irda/qos.c 2003-11-29 00:28:15.000000000 +0100
++++ linux-2.4.32.more-gcc4-fixes-v1/net/irda/qos.c 2005-11-17 13:31:16.000000000 +0100
+@@ -97,7 +97,7 @@ static int irlap_param_min_turn_time(voi
+ int get);
+
+ __u32 min_turn_times[] = { 10000, 5000, 1000, 500, 100, 50, 10, 0 }; /* us */
+-__u32 baud_rates[] = { 2400, 9600, 19200, 38400, 57600, 115200, 576000,
++static __u32 baud_rates[] = { 2400, 9600, 19200, 38400, 57600, 115200, 576000,
+ 1152000, 4000000, 16000000 }; /* bps */
+ __u32 data_sizes[] = { 64, 128, 256, 512, 1024, 2048 }; /* bytes */
+ __u32 add_bofs[] = { 48, 24, 12, 5, 3, 2, 1, 0 }; /* bytes */
+diff -rupN linux-2.4.32/net/khttpd/prototypes.h linux-2.4.32.more-gcc4-fixes-v1/net/khttpd/prototypes.h
+--- linux-2.4.32/net/khttpd/prototypes.h 2001-08-16 23:47:03.000000000 +0200
++++ linux-2.4.32.more-gcc4-fixes-v1/net/khttpd/prototypes.h 2005-11-17 13:31:16.000000000 +0100
+@@ -49,7 +49,6 @@ extern int sysctl_khttpd_stop;
+ extern struct khttpd_threadinfo threadinfo[CONFIG_KHTTPD_NUMCPU];
+ extern char CurrentTime[];
+ extern atomic_t ConnectCount;
+-extern struct wait_queue main_wait[CONFIG_KHTTPD_NUMCPU];
+
+ /* misc.c */
+
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/006-build_flags.patch b/openwrt/target/linux/linux-2.4/patches/generic/050-build_flags.patch
index 207dd0be2..14a207df2 100644
--- a/openwrt/target/linux/linux-2.4/patches/generic/006-build_flags.patch
+++ b/openwrt/target/linux/linux-2.4/patches/generic/050-build_flags.patch
@@ -1,56 +1,7 @@
-diff -urN linux.old/Makefile linux.dev/Makefile
---- linux.old/Makefile 2005-08-26 13:41:41.689634168 +0200
-+++ linux.dev/Makefile 2005-08-26 13:44:34.233403528 +0200
-@@ -17,9 +17,9 @@
- FINDHPATH = $(HPATH)/asm $(HPATH)/linux $(HPATH)/scsi $(HPATH)/net $(HPATH)/math-emu
-
- HOSTCC = gcc
--HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
-+HOSTCFLAGS = -Wall -Wstrict-prototypes -Os -fomit-frame-pointer
-
--CROSS_COMPILE =
-+CROSS_COMPILE=
-
- #
- # Include the make variables (CC, etc...)
-@@ -89,6 +89,8 @@
- # standard CFLAGS
- #
-
-+check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
-+
- CPPFLAGS := -D__KERNEL__ -I$(HPATH)
-
- CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -Os \
-@@ -91,8 +93,10 @@
-
- CPPFLAGS := -D__KERNEL__ -I$(HPATH)
-
--CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \
-+CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -Os \
- -fno-strict-aliasing -fno-common
-+
-+
- ifndef CONFIG_FRAME_POINTER
- CFLAGS += -fomit-frame-pointer
- endif
-@@ -100,6 +105,12 @@
- endif
- AFLAGS := -D__ASSEMBLY__ $(CPPFLAGS)
-
-+CFLAGS += $(call check_gcc, -funit-at-a-time,)
-+
-+
-+
-+
-+
- #
- # ROOT_DEV specifies the default root-device when making the image.
- # This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
-diff -urN linux.old/arch/mips/Makefile linux.dev/arch/mips/Makefile
---- linux.old/arch/mips/Makefile 2005-11-07 23:12:50.582887000 +0100
-+++ linux.dev/arch/mips/Makefile 2005-11-07 21:57:08.537629000 +0100
-@@ -46,10 +46,10 @@
+diff -ur linux-2.4.32/arch/mips/Makefile linux-2.4.32-openwrt/arch/mips/Makefile
+--- linux-2.4.32/arch/mips/Makefile 2005-12-15 13:53:59.000000000 +0100
++++ linux-2.4.32-openwrt/arch/mips/Makefile 2005-12-15 14:02:33.000000000 +0100
+@@ -44,10 +44,10 @@
GCCFLAGS := -I $(TOPDIR)/include/asm/gcc
GCCFLAGS += -G 0 -mno-abicalls -fno-pic -pipe
GCCFLAGS += $(call check_gcc, -finline-limit=100000,)
@@ -64,7 +15,7 @@ diff -urN linux.old/arch/mips/Makefile linux.dev/arch/mips/Makefile
GCCFLAGS += -g
ifdef CONFIG_SB1XXX_CORELIS
GCCFLAGS += -mno-sched-prolog -fno-omit-frame-pointer
-@@ -71,13 +71,13 @@
+@@ -69,13 +69,13 @@
set_gccflags = $(shell \
while :; do \
cpu=$(1); isa=-$(2); \
@@ -80,7 +31,7 @@ diff -urN linux.old/arch/mips/Makefile linux.dev/arch/mips/Makefile
$(CC) $$gcc_opt$$cpu $$isa -S -o /dev/null \
-xc /dev/null > /dev/null 2>&1 && \
break 2; \
-@@ -92,7 +92,7 @@
+@@ -90,7 +90,7 @@
fi; \
gas_abi=-Wa,-32; gas_cpu=$$cpu; gas_isa=-Wa,$$isa; \
while :; do \
@@ -89,7 +40,7 @@ diff -urN linux.old/arch/mips/Makefile linux.dev/arch/mips/Makefile
$(CC) $$gas_abi $$gas_opt$$cpu $$gas_isa -Wa,-Z -c \
-o /dev/null -xassembler /dev/null > /dev/null 2>&1 && \
break 2; \
-@@ -174,6 +174,7 @@
+@@ -172,6 +172,7 @@
endif
AFLAGS += $(GCCFLAGS)
@@ -97,3 +48,36 @@ diff -urN linux.old/arch/mips/Makefile linux.dev/arch/mips/Makefile
CFLAGS += $(GCCFLAGS)
LD += -m $(ld-emul)
+diff -ur linux-2.4.32/Makefile linux-2.4.32-openwrt/Makefile
+--- linux-2.4.32/Makefile 2005-12-15 13:53:59.000000000 +0100
++++ linux-2.4.32-openwrt/Makefile 2005-12-15 13:59:30.000000000 +0100
+@@ -17,7 +17,7 @@
+ FINDHPATH = $(HPATH)/asm $(HPATH)/linux $(HPATH)/scsi $(HPATH)/net $(HPATH)/math-emu
+
+ HOSTCC = gcc
+-HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
++HOSTCFLAGS = -Wall -Wstrict-prototypes -Os -fomit-frame-pointer
+
+ CROSS_COMPILE =
+
+@@ -88,10 +88,9 @@
+ #
+ # standard CFLAGS
+ #
+-
+ CPPFLAGS := -D__KERNEL__ -I$(HPATH)
+
+-CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \
++CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -Os \
+ -fno-strict-aliasing -fno-common
+ CFLAGS += -fno-builtin-sprintf
+ ifndef CONFIG_FRAME_POINTER
+@@ -104,6 +103,8 @@
+ # disable pointer signedness warnings in gcc 4.0
+ CFLAGS += $(call check_gcc,-Wno-pointer-sign,)
+
++CFLAGS += $(call check_gcc, -funit-at-a-time,)
++
+ #
+ # ROOT_DEV specifies the default root-device when making the image.
+ # This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
diff --git a/openwrt/target/linux/linux-2.4/patches/generic/113-even_more_gcc4_stuff.patch b/openwrt/target/linux/linux-2.4/patches/generic/113-even_more_gcc4_stuff.patch
new file mode 100644
index 000000000..1b9871788
--- /dev/null
+++ b/openwrt/target/linux/linux-2.4/patches/generic/113-even_more_gcc4_stuff.patch
@@ -0,0 +1,367 @@
+diff -Nur linux.old/arch/mips/kernel/mips_ksyms.c linux.dev/arch/mips/kernel/mips_ksyms.c
+--- linux.old/arch/mips/kernel/mips_ksyms.c 2004-02-18 14:36:30.000000000 +0100
++++ linux.dev/arch/mips/kernel/mips_ksyms.c 2005-10-24 14:21:53.702396250 +0200
+@@ -30,6 +30,10 @@
+ #include <asm/floppy.h>
+ #endif
+
++asmlinkage long long __ashldi3 (long long, int);
++asmlinkage long long __ashrdi3 (long long, int);
++asmlinkage long long __lshrdi3 (long long, int);
++asmlinkage long long __muldi3 (long long, long long);
+ extern void *__bzero(void *__s, size_t __count);
+ extern long __strncpy_from_user_nocheck_asm(char *__to,
+ const char *__from, long __len);
+@@ -78,6 +82,13 @@
+ EXPORT_SYMBOL_NOVERS(__strnlen_user_asm);
+
+
++/* Compiler stuff */
++EXPORT_SYMBOL_NOVERS(__ashldi3);
++EXPORT_SYMBOL_NOVERS(__ashrdi3);
++EXPORT_SYMBOL_NOVERS(__lshrdi3);
++EXPORT_SYMBOL_NOVERS(__muldi3);
++
++
+ /* Networking helper routines. */
+ EXPORT_SYMBOL(csum_partial_copy);
+
+diff -Nur linux.old/arch/mips/lib/Makefile linux.dev/arch/mips/lib/Makefile
+--- linux.old/arch/mips/lib/Makefile 2004-02-18 14:36:30.000000000 +0100
++++ linux.dev/arch/mips/lib/Makefile 2005-10-24 14:21:53.774400750 +0200
+@@ -9,7 +9,8 @@
+ obj-y += csum_partial.o csum_partial_copy.o \
+ promlib.o rtc-std.o rtc-no.o memcpy.o \
+ memset.o watch.o strlen_user.o \
+- strncpy_user.o strnlen_user.o
++ strncpy_user.o strnlen_user.o \
++ ashldi3.o ashrdi3.o lshrdi3.o muldi3.o
+
+ export-objs := rtc-std.o rtc-no.o
+
+diff -Nur linux.old/arch/mips/lib/ashldi3.c linux.dev/arch/mips/lib/ashldi3.c
+--- linux.old/arch/mips/lib/ashldi3.c 1970-01-01 01:00:00.000000000 +0100
++++ linux.dev/arch/mips/lib/ashldi3.c 2005-10-24 14:21:53.774400750 +0200
+@@ -0,0 +1,62 @@
++/* ashrdi3.c extracted from gcc-2.95.2/libgcc2.c which is: */
++/* Copyright (C) 1989, 92-98, 1999 Free Software Foundation, Inc.
++
++This file is part of GNU CC.
++
++GNU CC is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 2, or (at your option)
++any later version.
++
++GNU CC is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with GNU CC; see the file COPYING. If not, write to
++the Free Software Foundation, 59 Temple Place - Suite 330,
++Boston, MA 02111-1307, USA. */
++
++#define BITS_PER_UNIT 8
++
++typedef int SItype __attribute__ ((mode (SI)));
++typedef unsigned int USItype __attribute__ ((mode (SI)));
++typedef int DItype __attribute__ ((mode (DI)));
++typedef int word_type __attribute__ ((mode (__word__)));
++
++struct DIstruct {SItype high, low;};
++
++typedef union
++{
++ struct DIstruct s;
++ DItype ll;
++} DIunion;
++
++DItype
++__ashldi3 (DItype u, word_type b)
++{
++ DIunion w;
++ word_type bm;
++ DIunion uu;
++
++ if (b == 0)
++ return u;
++
++ uu.ll = u;
++
++ bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
++ if (bm <= 0)
++ {
++ w.s.low = 0;
++ w.s.high = (USItype)uu.s.low << -bm;
++ }
++ else
++ {
++ USItype carries = (USItype)uu.s.low >> bm;
++ w.s.low = (USItype)uu.s.low << b;
++ w.s.high = ((USItype)uu.s.high << b) | carries;
++ }
++
++ return w.ll;
++}
+diff -Nur linux.old/arch/mips/lib/ashrdi3.c linux.dev/arch/mips/lib/ashrdi3.c
+--- linux.old/arch/mips/lib/ashrdi3.c 1970-01-01 01:00:00.000000000 +0100
++++ linux.dev/arch/mips/lib/ashrdi3.c 2005-10-24 14:21:53.774400750 +0200
+@@ -0,0 +1,63 @@
++/* ashrdi3.c extracted from gcc-2.7.2/libgcc2.c which is: */
++/* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
++
++This file is part of GNU CC.
++
++GNU CC is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 2, or (at your option)
++any later version.
++
++GNU CC is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with GNU CC; see the file COPYING. If not, write to
++the Free Software Foundation, 59 Temple Place - Suite 330,
++Boston, MA 02111-1307, USA. */
++
++#define BITS_PER_UNIT 8
++
++typedef int SItype __attribute__ ((mode (SI)));
++typedef unsigned int USItype __attribute__ ((mode (SI)));
++typedef int DItype __attribute__ ((mode (DI)));
++typedef int word_type __attribute__ ((mode (__word__)));
++
++struct DIstruct {SItype high, low;};
++
++typedef union
++{
++ struct DIstruct s;
++ DItype ll;
++} DIunion;
++
++DItype
++__ashrdi3 (DItype u, word_type b)
++{
++ DIunion w;
++ word_type bm;
++ DIunion uu;
++
++ if (b == 0)
++ return u;
++
++ uu.ll = u;
++
++ bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
++ if (bm <= 0)
++ {
++ /* w.s.high = 1..1 or 0..0 */
++ w.s.high = uu.s.high >> (sizeof (SItype) * BITS_PER_UNIT - 1);
++ w.s.low = uu.s.high >> -bm;
++ }
++ else
++ {
++ USItype carries = (USItype)uu.s.high << bm;
++ w.s.high = uu.s.high >> b;
++ w.s.low = ((USItype)uu.s.low >> b) | carries;
++ }
++
++ return w.ll;
++}
+diff -Nur linux.old/arch/mips/lib/lshrdi3.c linux.dev/arch/mips/lib/lshrdi3.c
+--- linux.old/arch/mips/lib/lshrdi3.c 1970-01-01 01:00:00.000000000 +0100
++++ linux.dev/arch/mips/lib/lshrdi3.c 2005-10-24 14:21:53.774400750 +0200
+@@ -0,0 +1,62 @@
++/* lshrdi3.c extracted from gcc-2.7.2/libgcc2.c which is: */
++/* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
++
++This file is part of GNU CC.
++
++GNU CC is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 2, or (at your option)
++any later version.
++
++GNU CC is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with GNU CC; see the file COPYING. If not, write to
++the Free Software Foundation, 59 Temple Place - Suite 330,
++Boston, MA 02111-1307, USA. */
++
++#define BITS_PER_UNIT 8
++
++typedef int SItype __attribute__ ((mode (SI)));
++typedef unsigned int USItype __attribute__ ((mode (SI)));
++typedef int DItype __attribute__ ((mode (DI)));
++typedef int word_type __attribute__ ((mode (__word__)));
++
++struct DIstruct {SItype high, low;};
++
++typedef union
++{
++ struct DIstruct s;
++ DItype ll;
++} DIunion;
++
++DItype
++__lshrdi3 (DItype u, word_type b)
++{
++ DIunion w;
++ word_type bm;
++ DIunion uu;
++
++ if (b == 0)
++ return u;
++
++ uu.ll = u;
++
++ bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
++ if (bm <= 0)
++ {
++ w.s.high = 0;
++ w.s.low = (USItype)uu.s.high >> -bm;
++ }
++ else
++ {
++ USItype carries = (USItype)uu.s.high << bm;
++ w.s.high = (USItype)uu.s.high >> b;
++ w.s.low = ((USItype)uu.s.low >> b) | carries;
++ }
++
++ return w.ll;
++}
+diff -Nur linux.old/arch/mips/lib/muldi3.c linux.dev/arch/mips/lib/muldi3.c
+--- linux.old/arch/mips/lib/muldi3.c 1970-01-01 01:00:00.000000000 +0100
++++ linux.dev/arch/mips/lib/muldi3.c 2005-10-24 14:21:53.774400750 +0200
+@@ -0,0 +1,63 @@
++/* muldi3.c extracted from gcc-2.7.2.3/libgcc2.c and
++ gcc-2.7.2.3/longlong.h which is: */
++/* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
++
++This file is part of GNU CC.
++
++GNU CC is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 2, or (at your option)
++any later version.
++
++GNU CC is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with GNU CC; see the file COPYING. If not, write to
++the Free Software Foundation, 59 Temple Place - Suite 330,
++Boston, MA 02111-1307, USA. */
++
++#define BITS_PER_UNIT 8
++
++#define umul_ppmm(w1, w0, u, v) \
++ __asm__ ("multu %2,%3" \
++ : "=l" ((USItype)(w0)), \
++ "=h" ((USItype)(w1)) \
++ : "d" ((USItype)(u)), \
++ "d" ((USItype)(v)))
++
++#define __umulsidi3(u, v) \
++ ({DIunion __w; \
++ umul_ppmm (__w.s.high, __w.s.low, u, v); \
++ __w.ll; })
++
++typedef int SItype __attribute__ ((mode (SI)));
++typedef unsigned int USItype __attribute__ ((mode (SI)));
++typedef int DItype __attribute__ ((mode (DI)));
++typedef int word_type __attribute__ ((mode (__word__)));
++
++struct DIstruct {SItype high, low;};
++
++typedef union
++{
++ struct DIstruct s;
++ DItype ll;
++} DIunion;
++
++DItype
++__muldi3 (DItype u, DItype v)
++{
++ DIunion w;
++ DIunion uu, vv;
++
++ uu.ll = u,
++ vv.ll = v;
++
++ w.ll = __umulsidi3 (uu.s.low, vv.s.low);
++ w.s.high += ((USItype) uu.s.low * (USItype) vv.s.high
++ + (USItype) uu.s.high * (USItype) vv.s.low);
++
++ return w.ll;
++}
+diff -Nur linux.old/fs/cifs/cifsfs.c linux.dev/fs/cifs/cifsfs.c
+--- linux.old/fs/cifs/cifsfs.c 2005-10-24 13:48:27.599659000 +0200
++++ linux.dev/fs/cifs/cifsfs.c 2005-10-24 14:25:06.526447000 +0200
+@@ -50,8 +50,6 @@
+ static struct quotactl_ops cifs_quotactl_ops;
+ #endif
+
+-extern struct file_system_type cifs_fs_type;
+-
+ int cifsFYI = 0;
+ int cifsERROR = 1;
+ int traceSMB = 0;
+diff -Nur linux.old/include/asm-mips/uaccess.h linux.dev/include/asm-mips/uaccess.h
+--- linux.old/include/asm-mips/uaccess.h 2005-01-19 15:10:12.000000000 +0100
++++ linux.dev/include/asm-mips/uaccess.h 2005-10-24 14:11:48.563214250 +0200
+@@ -149,7 +149,7 @@
+ * Returns zero on success, or -EFAULT on error.
+ */
+ #define put_user(x,ptr) \
+- __put_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
++ __put_user_check((x),(ptr),sizeof(*(ptr)))
+
+ /*
+ * get_user: - Get a simple variable from user space.
+@@ -169,7 +169,7 @@
+ * On error, the variable @x is set to zero.
+ */
+ #define get_user(x,ptr) \
+- __get_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
++ __get_user_check((x),(ptr),sizeof(*(ptr)))
+
+ /*
+ * __put_user: - Write a simple value into user space, with less checking.
+@@ -191,7 +191,7 @@
+ * Returns zero on success, or -EFAULT on error.
+ */
+ #define __put_user(x,ptr) \
+- __put_user_nocheck((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
++ __put_user_nocheck((x),(ptr),sizeof(*(ptr)))
+
+ /*
+ * __get_user: - Get a simple variable from user space, with less checking.
+@@ -214,7 +214,7 @@
+ * On error, the variable @x is set to zero.
+ */
+ #define __get_user(x,ptr) \
+- __get_user_nocheck((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
++ __get_user_nocheck((x),(ptr),sizeof(*(ptr)))
+
+ struct __large_struct { unsigned long buf[100]; };
+ #define __m(x) (*(struct __large_struct *)(x))
+@@ -232,7 +232,7 @@
+ #define __get_user_nocheck(x,ptr,size) \
+ ({ \
+ long __gu_err = 0; \
+- __typeof(*(ptr)) __gu_val = 0; \
++ __typeof(*(ptr)) __gu_val = (__typeof(*(ptr))) 0; \
+ long __gu_addr; \
+ __gu_addr = (long) (ptr); \
+ switch (size) { \