## Automatically generated incremental diff
## From:   linux-2.5.71-bk1
## To:     linux-2.5.71-bk2
## Robot:  $Id: make-incremental-diff,v 1.11 2002/02/20 02:59:33 hpa Exp $

diff -urN linux-2.5.71-bk1/Makefile linux-2.5.71-bk2/Makefile
--- linux-2.5.71-bk1/Makefile	2003-06-16 04:45:23.000000000 -0700
+++ linux-2.5.71-bk2/Makefile	2003-06-16 04:45:31.000000000 -0700
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 5
 SUBLEVEL = 71
-EXTRAVERSION = -bk1
+EXTRAVERSION = -bk2
 
 # *DOCUMENTATION*
 # To see a list of typical targets execute "make help"
diff -urN linux-2.5.71-bk1/arch/i386/kernel/cpu/cpufreq/powernow-k7.c linux-2.5.71-bk2/arch/i386/kernel/cpu/cpufreq/powernow-k7.c
--- linux-2.5.71-bk1/arch/i386/kernel/cpu/cpufreq/powernow-k7.c	2003-06-14 12:17:56.000000000 -0700
+++ linux-2.5.71-bk2/arch/i386/kernel/cpu/cpufreq/powernow-k7.c	2003-06-16 04:45:31.000000000 -0700
@@ -260,7 +260,7 @@
 	/* Now do the magic poking into the MSRs.  */
 
 	if (have_a0 == 1)	/* A0 errata 5 */
-		__asm__("\tcli\n");
+		local_irq_disable();
 
 	if (freqs.old > freqs.new) {
 		/* Going down, so change FID first */
@@ -274,7 +274,7 @@
 	
 
 	if (have_a0 == 1)
-		__asm__("\tsti\n");
+		local_irq_enable();
 
 	cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
 }
diff -urN linux-2.5.71-bk1/arch/m68knommu/kernel/setup.c linux-2.5.71-bk2/arch/m68knommu/kernel/setup.c
--- linux-2.5.71-bk1/arch/m68knommu/kernel/setup.c	2003-06-14 12:18:24.000000000 -0700
+++ linux-2.5.71-bk2/arch/m68knommu/kernel/setup.c	2003-06-16 04:45:31.000000000 -0700
@@ -206,7 +206,7 @@
 	printk("based on 2.0.38 port by Lineo Inc. <mleslie@lineo.com>.\n");
 #endif
 #ifdef CONFIG_DRAGEN2
-	printk("Dragon Engine II board support by Georges Menie\n");
+	printk("DragonEngine II board support by Georges Menie\n");
 #endif
 
 #ifdef DEBUG
diff -urN linux-2.5.71-bk1/arch/m68knommu/platform/5206e/eLITE/crt0_ram.S linux-2.5.71-bk2/arch/m68knommu/platform/5206e/eLITE/crt0_ram.S
--- linux-2.5.71-bk1/arch/m68knommu/platform/5206e/eLITE/crt0_ram.S	2003-06-14 12:18:30.000000000 -0700
+++ linux-2.5.71-bk2/arch/m68knommu/platform/5206e/eLITE/crt0_ram.S	2003-06-16 04:45:31.000000000 -0700
@@ -290,6 +290,7 @@
 	movec	%d0, %CACR			/* Enable cache */
 
 
+#ifdef CONFIG_ROMFS_FS
 	/*
 	 *	Move ROM filesystem above bss :-)
 	 */
@@ -311,6 +312,12 @@
 	cmp.l	%a0, %a2			/* Check if at end */
 	bne	_copy_romfs
 
+#else /* CONFIG_ROMFS_FS */
+	lea.l	_ebss, %a1
+	move.l	%a1, _ramstart
+#endif /* CONFIG_ROMFS_FS */
+
+
 	/*
 	 *	Zero out the bss region.
 	 */
diff -urN linux-2.5.71-bk1/arch/m68knommu/platform/68328/config.c linux-2.5.71-bk2/arch/m68knommu/platform/68328/config.c
--- linux-2.5.71-bk1/arch/m68knommu/platform/68328/config.c	2003-06-14 12:18:52.000000000 -0700
+++ linux-2.5.71-bk2/arch/m68knommu/platform/68328/config.c	2003-06-16 04:45:31.000000000 -0700
@@ -122,6 +122,4 @@
   mach_hwclk           = NULL;
   mach_set_clock_mmss  = NULL;
   mach_reset           = BSP_reset;
-
-  config_M68328_irq();
 }
diff -urN linux-2.5.71-bk1/arch/parisc/Kconfig linux-2.5.71-bk2/arch/parisc/Kconfig
--- linux-2.5.71-bk1/arch/parisc/Kconfig	2003-06-16 04:45:23.000000000 -0700
+++ linux-2.5.71-bk2/arch/parisc/Kconfig	2003-06-16 04:45:31.000000000 -0700
@@ -103,11 +103,6 @@
 	  enable this option otherwise. The 64bit kernel is significantly bigger
 	  and slower than the 32bit one.
 
-config COMPAT
-	bool
-	depends on PARISC64
-	default y
-
 config PDC_NARROW
 	bool "32-bit firmware"
 	depends on PARISC64
@@ -145,6 +140,14 @@
 #	bool "Preemptible Kernel"
 	default n
 
+config COMPAT
+	bool
+	depends on PARISC64
+	default y
+
+config HPUX
+	bool "Support for HP-UX binaries"
+
 config NR_CPUS
 	int "Maximum number of CPUs (2-32)"
 	depends on SMP
@@ -165,6 +168,7 @@
 
 config BINFMT_SOM
 	tristate "Kernel support for SOM binaries"
+	depends on HPUX
 	help
 	  SOM is a binary executable format inherited from HP/UX.  Say Y here
 	  to be able to load and execute SOM binaries directly.
diff -urN linux-2.5.71-bk1/arch/parisc/Makefile linux-2.5.71-bk2/arch/parisc/Makefile
--- linux-2.5.71-bk1/arch/parisc/Makefile	2003-06-14 12:18:33.000000000 -0700
+++ linux-2.5.71-bk2/arch/parisc/Makefile	2003-06-16 04:45:31.000000000 -0700
@@ -57,8 +57,10 @@
 
 CFLAGS	+= $(cflags-y)
 
-core-y	+= $(addprefix arch/parisc/, kernel/pdc_cons.o kernel/process.o   \
-		mm/ kernel/ hpux/ math-emu/ kernel/init_task.o )
+kernel-y			:= mm/ kernel/ math-emu/ kernel/init_task.o
+kernel-$(CONFIG_HPUX)		+= hpux/
+
+core-y	+= $(addprefix arch/parisc/, $(kernel-y))
 libs-y	+= arch/parisc/lib/ `$(CC) -print-libgcc-file-name`
 
 drivers-$(CONFIG_OPROFILE)		+= arch/parisc/oprofile/
diff -urN linux-2.5.71-bk1/arch/parisc/kernel/Makefile linux-2.5.71-bk2/arch/parisc/kernel/Makefile
--- linux-2.5.71-bk1/arch/parisc/kernel/Makefile	2003-06-14 12:18:06.000000000 -0700
+++ linux-2.5.71-bk2/arch/parisc/kernel/Makefile	2003-06-16 04:45:31.000000000 -0700
@@ -4,8 +4,7 @@
 
 head-y			:= head.o
 head-$(CONFIG_PARISC64)	:= head64.o
-extra-y			:= init_task.o pdc_cons.o process.o \
-			   unaligned.o $(head-y)
+extra-y			:= init_task.o $(head-y)
 
 AFLAGS_entry.o	:= -traditional
 AFLAGS_pacache.o := -traditional
@@ -14,7 +13,7 @@
 		   pa7300lc.o syscall.o entry.o sys_parisc.o firmware.o \
 		   ptrace.o hardware.o inventory.o drivers.o semaphore.o \
 		   signal.o hpmc.o real2.o parisc_ksyms.o unaligned.o \
-		   processor.o pdc_chassis.o
+		   process.o processor.o pdc_cons.o pdc_chassis.o
 
 obj-$(CONFIG_SMP)	+= smp.o
 obj-$(CONFIG_PA11)	+= pci-dma.o
diff -urN linux-2.5.71-bk1/arch/parisc/kernel/entry.S linux-2.5.71-bk2/arch/parisc/kernel/entry.S
--- linux-2.5.71-bk1/arch/parisc/kernel/entry.S	2003-06-14 12:18:01.000000000 -0700
+++ linux-2.5.71-bk2/arch/parisc/kernel/entry.S	2003-06-16 04:45:31.000000000 -0700
@@ -546,7 +546,7 @@
 	LDREG	-PT_SZ_ALGN-RP_OFFSET(%r30), %r2
 	ldo	-PT_SZ_ALGN(%r30), %r30
 	bv	%r0(%r2)
-	ldw	TASK_PID(%r28), %r28
+	nop
 
 	/*
 	 * Child Returns here
diff -urN linux-2.5.71-bk1/arch/parisc/kernel/ioctl32.c linux-2.5.71-bk2/arch/parisc/kernel/ioctl32.c
--- linux-2.5.71-bk1/arch/parisc/kernel/ioctl32.c	2003-06-14 12:17:56.000000000 -0700
+++ linux-2.5.71-bk2/arch/parisc/kernel/ioctl32.c	2003-06-16 04:45:32.000000000 -0700
@@ -1785,9 +1785,6 @@
         return -EINVAL;
 }
 
-#ifdef CONFIG_GENRTC
-#endif
-
 #if defined(CONFIG_DRM) || defined(CONFIG_DRM_MODULE)
 /* This really belongs in include/linux/drm.h -DaveM */
 #include "../../../drivers/char/drm/drm.h"
diff -urN linux-2.5.71-bk1/arch/parisc/kernel/irq.c linux-2.5.71-bk2/arch/parisc/kernel/irq.c
--- linux-2.5.71-bk1/arch/parisc/kernel/irq.c	2003-06-14 12:18:07.000000000 -0700
+++ linux-2.5.71-bk2/arch/parisc/kernel/irq.c	2003-06-16 04:45:32.000000000 -0700
@@ -43,8 +43,8 @@
 #undef DEBUG_IRQ
 #undef PARISC_IRQ_CR16_COUNTS
 
-extern void timer_interrupt(int, void *, struct pt_regs *);
-extern void ipi_interrupt(int, void *, struct pt_regs *);
+extern irqreturn_t timer_interrupt(int, void *, struct pt_regs *);
+extern irqreturn_t ipi_interrupt(int, void *, struct pt_regs *);
 
 #ifdef DEBUG_IRQ
 #define DBG_IRQ(irq, x)	if ((irq) != TIMER_IRQ) printk x
@@ -583,7 +583,7 @@
 /* FIXME: SMP, flags, bottom halves, rest */
 
 int request_irq(unsigned int irq,
-		void (*handler)(int, void *, struct pt_regs *),
+		irqreturn_t (*handler)(int, void *, struct pt_regs *),
 		unsigned long irqflags,
 		const char * devname,
 		void *dev_id)
diff -urN linux-2.5.71-bk1/arch/parisc/kernel/module.c linux-2.5.71-bk2/arch/parisc/kernel/module.c
--- linux-2.5.71-bk1/arch/parisc/kernel/module.c	2003-06-14 12:18:52.000000000 -0700
+++ linux-2.5.71-bk2/arch/parisc/kernel/module.c	2003-06-16 04:45:32.000000000 -0700
@@ -27,12 +27,39 @@
 #include <linux/string.h>
 #include <linux/kernel.h>
 
-#if 1
+#if 0
 #define DEBUGP printk
 #else
 #define DEBUGP(fmt...)
 #endif
 
+#define CHECK_RELOC(val, bits) \
+	if ( ( !((val) & (1<<((bits)-1))) && ((val)>>(bits)) != 0 )  ||	\
+	     ( ((val) & (1<<((bits)-1))) && ((val)>>(bits)) != (((__typeof__(val))(~0))>>((bits)+2)))) { \
+		printk(KERN_ERR "module %s relocation of symbol %s is out of range (0x%lx in %d bits)\n", \
+		me->name, strtab + sym->st_name, (unsigned long)val, bits); \
+		return -ENOEXEC;			\
+	}
+
+/* three functions to determine where in the module core
+ * or init pieces the location is */
+static inline int is_init(struct module *me, void *loc)
+{
+	return (loc >= me->module_init &&
+		loc <= (me->module_init + me->init_size));
+}
+
+static inline int is_core(struct module *me, void *loc)
+{
+	return (loc >= me->module_core &&
+		loc <= (me->module_core + me->core_size));
+}
+
+static inline int is_local(struct module *me, void *loc)
+{
+	return is_init(me, loc) || is_core(me, loc);
+}
+
 
 #ifndef __LP64__
 struct got_entry {
@@ -40,8 +67,8 @@
 };
 
 struct fdesc_entry {
-	Elf32_Addr gp;
 	Elf32_Addr addr;
+	Elf32_Addr gp;
 };
 
 struct stub_entry {
@@ -54,8 +81,8 @@
 
 struct fdesc_entry {
 	Elf64_Addr dummy[2];
-	Elf64_Addr gp;
 	Elf64_Addr addr;
+	Elf64_Addr gp;
 };
 
 struct stub_entry {
@@ -167,7 +194,7 @@
 
 static inline unsigned long count_fdescs(const Elf_Rela *rela, unsigned long n)
 {
-	unsigned long cnt = 3; /* 3 for finalize */
+	unsigned long cnt = 0;
 
 	for (; n > 0; n--, rela++)
 	{
@@ -211,7 +238,7 @@
 			      CONST char *secstrings,
 			      struct module *me)
 {
-	unsigned long gots = 0, fdescs = 0, stubs = 0;
+	unsigned long gots = 0, fdescs = 0, stubs = 0, init_stubs = 0;
 	unsigned int i;
 
 	for (i = 1; i < hdr->e_shnum; i++) {
@@ -228,7 +255,11 @@
 		 */
 		gots += count_gots(rels, nrels);
 		fdescs += count_fdescs(rels, nrels);
-		stubs += count_stubs(rels, nrels);
+		if(strncmp(secstrings + sechdrs[i].sh_name,
+			   ".rela.init", 10) == 0)
+			init_stubs += count_stubs(rels, nrels);
+		else
+			stubs += count_stubs(rels, nrels);
 	}
 
 	/* align things a bit */
@@ -238,16 +269,26 @@
 
 	me->core_size = ALIGN(me->core_size, 16);
 	me->arch.fdesc_offset = me->core_size;
-	me->core_size += stubs * sizeof(struct fdesc_entry);
+	me->core_size += fdescs * sizeof(struct fdesc_entry);
 
 	me->core_size = ALIGN(me->core_size, 16);
 	me->arch.stub_offset = me->core_size;
 	me->core_size += stubs * sizeof(struct stub_entry);
 
+	me->init_size = ALIGN(me->init_size, 16);
+	me->arch.init_stub_offset = me->init_size;
+	me->init_size += init_stubs * sizeof(struct stub_entry);
+
+	me->arch.got_max = gots;
+	me->arch.fdesc_max = fdescs;
+	me->arch.stub_max = stubs;
+	me->arch.init_stub_max = init_stubs;
+
 	return 0;
 }
 
-static Elf_Addr get_got(struct module *me, unsigned long value, long addend)
+#ifdef __LP64__
+static Elf64_Word get_got(struct module *me, unsigned long value, long addend)
 {
 	unsigned int i;
 	struct got_entry *got;
@@ -261,10 +302,14 @@
 		if (got[i].addr == value)
 			return i * sizeof(struct got_entry);
 
+	BUG_ON(++me->arch.got_count > me->arch.got_max);
+
 	got[i].addr = value;
 	return i * sizeof(struct got_entry);
 }
+#endif /* __LP64__ */
 
+#ifdef __LP64__
 static Elf_Addr get_fdesc(struct module *me, unsigned long value)
 {
 	struct fdesc_entry *fdesc = me->module_core + me->arch.fdesc_offset;
@@ -281,32 +326,46 @@
 		fdesc++;
 	}
 
+	BUG_ON(++me->arch.fdesc_count > me->arch.fdesc_max);
+
 	/* Create new one */
 	fdesc->addr = value;
 	fdesc->gp = (Elf_Addr)me->module_core + me->arch.got_offset;
 	return (Elf_Addr)fdesc;
 }
+#endif /* __LP64__ */
 
 static Elf_Addr get_stub(struct module *me, unsigned long value, long addend,
-	int millicode)
+	int millicode, int init_section)
 {
 	unsigned long i;
 	struct stub_entry *stub;
 
-	i = me->arch.stub_count++;
-	stub = me->module_core + me->arch.stub_offset + 
-	       i * sizeof(struct stub_entry);
+	if(init_section) {
+		i = me->arch.init_stub_count++;
+		BUG_ON(me->arch.init_stub_count > me->arch.init_stub_max);
+		stub = me->module_init + me->arch.init_stub_offset + 
+			i * sizeof(struct stub_entry);
+	} else {
+		i = me->arch.stub_count++;
+		BUG_ON(me->arch.stub_count > me->arch.stub_max);
+		stub = me->module_core + me->arch.stub_offset + 
+			i * sizeof(struct stub_entry);
+	}
 
 #ifndef __LP64__
 /* for 32-bit the stub looks like this:
  * 	ldil L'XXX,%r1
  * 	be,n R'XXX(%sr4,%r1)
  */
+	//value = *(unsigned long *)((value + addend) & ~3); /* why? */
+
 	stub->insns[0] = 0x20200000;	/* ldil L'XXX,%r1	*/
 	stub->insns[1] = 0xe0202002;	/* be,n R'XXX(%sr4,%r1)	*/
 
 	stub->insns[0] |= reassemble_21(lrsel(value, addend));
 	stub->insns[1] |= reassemble_17(rrsel(value, addend) / 4);
+
 #else
 /* for 64-bit we have two kinds of stubs:
  * for normal function calls:
@@ -328,7 +387,7 @@
 		stub->insns[2] = 0xe820d000;	/* bve (%r1)		*/
 		stub->insns[3] = 0x537b0030;	/* ldd 18(%dp),%dp	*/
 
-		stub->insns[0] |= reassemble_21(get_got(me, value, addend));
+		stub->insns[0] |= reassemble_14(rrsel(get_got(me, value, addend),0));
 	}
 	else
 	{
@@ -371,6 +430,7 @@
 	Elf32_Addr val;
 	Elf32_Sword addend;
 	Elf32_Addr dot;
+	//unsigned long dp = (unsigned long)$global$;
 	register unsigned long dp asm ("r27");
 
 	DEBUGP("Applying relocate section %u to %u\n", relsec,
@@ -387,7 +447,8 @@
 			       me->name, strtab + sym->st_name);
 			return -ENOENT;
 		}
-		dot = (sechdrs[relsec].sh_addr + rel->r_offset) & ~0x03;
+		//dot = (sechdrs[relsec].sh_addr + rel->r_offset) & ~0x03;
+		dot =  (Elf32_Addr)loc & ~0x03;
 
 		val = sym->st_value;
 		addend = rel[i].r_addend;
@@ -422,11 +483,13 @@
 			break;
 		case R_PARISC_DIR21L:
 			/* left 21 bits of effective address */
-			*loc = mask(*loc, 21) | reassemble_21(lrsel(val, addend));
+			val = lrsel(val, addend);
+			*loc = mask(*loc, 21) | reassemble_21(val);
 			break;
 		case R_PARISC_DIR14R:
 			/* right 14 bits of effective address */
-			*loc = mask(*loc, 14) | reassemble_14(rrsel(val, addend));
+			val = rrsel(val, addend);
+			*loc = mask(*loc, 14) | reassemble_14(val);
 			break;
 		case R_PARISC_SEGREL32:
 			/* 32-bit segment relative address */
@@ -435,23 +498,27 @@
 			break;
 		case R_PARISC_DPREL21L:
 			/* left 21 bit of relative address */
-			val -= dp;
-			*loc = mask(*loc, 21) | reassemble_21(lrsel(val, addend) - dp);
+			val = lrsel(val - dp, addend);
+			*loc = mask(*loc, 21) | reassemble_21(val);
 			break;
 		case R_PARISC_DPREL14R:
 			/* right 14 bit of relative address */
-			val -= dp;
-			*loc = mask(*loc, 14) | reassemble_14(rrsel(val, addend) - dp);
+			val = rrsel(val - dp, addend);
+			*loc = mask(*loc, 14) | reassemble_14(val);
 			break;
 		case R_PARISC_PCREL17F:
 			/* 17-bit PC relative address */
-			val = get_stub(me, val, addend, 0) - dot - 8;
-			*loc = (*loc&0x1f1ffd) | reassemble_17(val);
+			val = get_stub(me, val, addend, 0, is_init(me, loc));
+			val = (val - dot - 8)/4;
+			CHECK_RELOC(val, 17)
+			*loc = (*loc & ~0x1f1ffd) | reassemble_17(val);
 			break;
 		case R_PARISC_PCREL22F:
 			/* 22-bit PC relative address; only defined for pa20 */
-			val = get_stub(me, val, addend, 0) - dot - 8;
-			*loc = (*loc&0x3ff1ffd) | reassemble_22(val);
+			val = get_stub(me, val, addend, 0, is_init(me, loc));
+			val = (val - dot - 8)/4;
+			CHECK_RELOC(val, 22);
+			*loc = (*loc & ~0x3ff1ffd) | reassemble_22(val);
 			break;
 
 		default:
@@ -475,6 +542,7 @@
 	Elf64_Rela *rel = (void *)sechdrs[relsec].sh_addr;
 	Elf64_Sym *sym;
 	Elf64_Word *loc;
+	Elf64_Xword *loc64;
 	Elf64_Addr val;
 	Elf64_Sxword addend;
 	Elf64_Addr dot;
@@ -493,14 +561,16 @@
 			       me->name, strtab + sym->st_name);
 			return -ENOENT;
 		}
-		dot = (sechdrs[relsec].sh_addr + rel->r_offset) & ~0x03;
+		//dot = (sechdrs[relsec].sh_addr + rel->r_offset) & ~0x03;
+		dot = (Elf64_Addr)loc & ~0x03;
+		loc64 = (Elf64_Xword *)loc;
 
 		val = sym->st_value;
 		addend = rel[i].r_addend;
 
-#if 1
+#if 0
 #define r(t) ELF64_R_TYPE(rel[i].r_info)==t ? #t :
-		DEBUGP("Symbol %s loc %p val 0x%Lx addend 0x%Lx: %s\n",
+		printk("Symbol %s loc %p val 0x%Lx addend 0x%Lx: %s\n",
 			strtab + sym->st_name,
 			loc, val, addend,
 			r(R_PARISC_LTOFF14R)
@@ -516,24 +586,56 @@
 		switch (ELF64_R_TYPE(rel[i].r_info)) {
 		case R_PARISC_LTOFF21L:
 			/* LT-relative; left 21 bits */
-			*loc = mask(*loc, 21) | reassemble_21(get_got(me, val, addend));
+			val = get_got(me, val, addend);
+			DEBUGP("LTOFF21L Symbol %s loc %p val %lx\n",
+			       strtab + sym->st_name,
+			       loc, val);
+			val = lrsel(val, 0);
+			*loc = mask(*loc, 21) | reassemble_21(val);
 			break;
 		case R_PARISC_LTOFF14R:
 			/* L(ltoff(val+addend)) */
 			/* LT-relative; right 14 bits */
-			*loc = mask(*loc, 14) | reassemble_14(get_got(me, val, addend));
+			val = get_got(me, val, addend);
+			val = rrsel(val, 0);
+			DEBUGP("LTOFF14R Symbol %s loc %p val %lx\n",
+			       strtab + sym->st_name,
+			       loc, val);
+			*loc = mask(*loc, 14) | reassemble_14(val);
 			break;
 		case R_PARISC_PCREL22F:
 			/* PC-relative; 22 bits */
-			if (strncmp(strtab + sym->st_name, "$$", 2) == 0)
-				val = get_stub(me, val, addend, 1) - dot - 8;
-			else
-				val = get_stub(me, val, addend, 0) - dot - 8;
-			*loc = (*loc&0x3ff1ffd) | reassemble_22(val);
+			DEBUGP("PCREL22F Symbol %s loc %p val %lx\n",
+			       strtab + sym->st_name,
+			       loc, val);
+			/* can we reach it locally? */
+			if(!is_local(me, (void *)val)) {
+				if (strncmp(strtab + sym->st_name, "$$", 2)
+				    == 0)
+					val = get_stub(me, val, addend, 1,
+						       is_init(me, loc));
+				else
+					val = get_stub(me, val, addend, 0,
+						       is_init(me, loc));
+			}
+			/* FIXME: local symbols work as long as the
+			 * core and init pieces aren't separated too
+			 * far.  If this is ever broken, you will trip
+			 * the check below.  The way to fix it would
+			 * be to generate local stubs to go between init
+			 * and core */
+			if((Elf64_Sxword)(val - dot - 8) > 0x800000 -1 ||
+			   (Elf64_Sxword)(val - dot - 8) < -0x800000) {
+				printk(KERN_ERR "Module %s, symbol %s is out of range for PCREL22F relocation\n",
+				       me->name, strtab + sym->st_name);
+				return -ENOEXEC;
+			}
+			val = (val - dot - 8)/4;
+			*loc = (*loc & ~0x3ff1ffd) | reassemble_22(val);
 			break;
 		case R_PARISC_DIR64:
 			/* 64-bit effective address */
-			*loc = fsel(val, addend);
+			*loc64 = val + addend;
 			break;
 		case R_PARISC_SEGREL32:
 			/* 32-bit segment relative address */
@@ -542,7 +644,17 @@
 			break;
 		case R_PARISC_FPTR64:
 			/* 64-bit function address */
-			*loc = get_fdesc(me, val+addend);
+			if(is_local(me, (void *)(val + addend))) {
+				*loc64 = get_fdesc(me, val+addend);
+			} else {
+				/* if the symbol is not local to this
+				 * module then val+addend is a pointer
+				 * to the function descriptor */
+				DEBUGP("Non local FPTR64 Symbol %s loc %p val %lx\n",
+				       strtab + sym->st_name,
+				       loc, val);
+				*loc64 = val + addend;
+			}
 			break;
 
 		default:
@@ -559,13 +671,26 @@
 		    const Elf_Shdr *sechdrs,
 		    struct module *me)
 {
-#ifdef __LP64__
-	me->init = (void *)get_fdesc(me, (Elf_Addr)me->init);
-#ifdef CONFIG_MODULE_UNLOAD
-	if (me->exit)
-		me->exit = (void *)get_fdesc(me, (Elf_Addr)me->exit);
-#endif
+#ifdef DEBUG
+	struct fdesc_entry *entry;
+	u32 *addr;
+
+	entry = (struct fdesc_entry *)me->init;
+	printk("FINALIZE, ->init FPTR is %p, GP %lx ADDR %lx\n", entry,
+	       entry->gp, entry->addr);
+	addr = (u32 *)entry->addr;
+	printk("INSNS: %x %x %x %x\n",
+	       addr[0], addr[1], addr[2], addr[3]);
+	printk("stubs used %ld, stubs max %ld\n"
+	       "init_stubs used %ld, init stubs max %ld\n"
+	       "got entries used %ld, gots max %ld\n"
+	       "fdescs used %ld, fdescs max %ld\n",
+	       me->arch.stub_count, me->arch.stub_max,
+	       me->arch.init_stub_count, me->arch.init_stub_max,
+	       me->arch.got_count, me->arch.got_max,
+	       me->arch.fdesc_count, me->arch.fdesc_max);
 #endif
+		
 	return 0;
 }
 
diff -urN linux-2.5.71-bk1/arch/parisc/kernel/parisc_ksyms.c linux-2.5.71-bk2/arch/parisc/kernel/parisc_ksyms.c
--- linux-2.5.71-bk1/arch/parisc/kernel/parisc_ksyms.c	2003-06-14 12:18:51.000000000 -0700
+++ linux-2.5.71-bk2/arch/parisc/kernel/parisc_ksyms.c	2003-06-16 04:45:32.000000000 -0700
@@ -7,22 +7,24 @@
 #include <linux/kernel.h>
 
 #include <linux/string.h>
-EXPORT_SYMBOL_NOVERS(memscan);
-EXPORT_SYMBOL_NOVERS(memset);
+EXPORT_SYMBOL(memchr);
 EXPORT_SYMBOL(memcmp);
-EXPORT_SYMBOL_NOVERS(memcpy);
+EXPORT_SYMBOL(memcpy);
 EXPORT_SYMBOL(memmove);
+EXPORT_SYMBOL(memscan);
+EXPORT_SYMBOL(memset);
 EXPORT_SYMBOL(strcat);
 EXPORT_SYMBOL(strchr);
-EXPORT_SYMBOL(strrchr);
 EXPORT_SYMBOL(strcmp);
 EXPORT_SYMBOL(strcpy);
 EXPORT_SYMBOL(strlen);
-EXPORT_SYMBOL(strnlen);
 EXPORT_SYMBOL(strncat);
 EXPORT_SYMBOL(strncmp);
 EXPORT_SYMBOL(strncpy);
+EXPORT_SYMBOL(strnlen);
+EXPORT_SYMBOL(strrchr);
 EXPORT_SYMBOL(strstr);
+EXPORT_SYMBOL(strpbrk);
 
 #include <asm/hardware.h>	/* struct parisc_device for asm/pci.h */
 #include <linux/pci.h>
@@ -39,7 +41,6 @@
 #include <asm/processor.h>
 EXPORT_SYMBOL(kernel_thread);
 EXPORT_SYMBOL(boot_cpu_data);
-EXPORT_SYMBOL(map_hpux_gateway_page);
 #ifdef CONFIG_EISA
 EXPORT_SYMBOL(EISA_bus);
 #endif
@@ -72,12 +73,16 @@
 #ifndef __LP64__
 /* Needed so insmod can set dp value */
 extern int $global$;
-EXPORT_SYMBOL_NOVERS($global$);
+EXPORT_SYMBOL($global$);
 #endif
 
 EXPORT_SYMBOL(register_parisc_driver);
 EXPORT_SYMBOL(unregister_parisc_driver);
+EXPORT_SYMBOL(print_pci_hwpath);
+EXPORT_SYMBOL(print_pa_hwpath);
 EXPORT_SYMBOL(pdc_iodc_read);
+EXPORT_SYMBOL(pdc_tod_read);
+EXPORT_SYMBOL(pdc_tod_set);
 
 #include <asm/io.h>
 EXPORT_SYMBOL(__ioremap);
@@ -105,7 +110,12 @@
 #include <asm/cache.h>
 EXPORT_SYMBOL(flush_kernel_dcache_range_asm);
 EXPORT_SYMBOL(flush_kernel_dcache_page);
+EXPORT_SYMBOL(flush_data_cache_local);
+EXPORT_SYMBOL(flush_kernel_icache_range_asm);
+EXPORT_SYMBOL(__flush_dcache_page);
 EXPORT_SYMBOL(flush_all_caches);
+EXPORT_SYMBOL(dcache_stride);
+EXPORT_SYMBOL(flush_cache_all_local);
 
 #include <asm/unistd.h>
 extern long sys_open(const char *, int, int);
@@ -131,6 +141,7 @@
 EXPORT_SYMBOL(pdc_add_valid);
 EXPORT_SYMBOL(pdc_lan_station_id);
 EXPORT_SYMBOL(pdc_get_initiator);
+EXPORT_SYMBOL(pdc_sti_call);
 
 extern void $$divI(void);
 extern void $$divU(void);
@@ -156,39 +167,39 @@
 extern void $$divI_14(void);
 extern void $$divI_15(void);
 
-EXPORT_SYMBOL_NOVERS($$divI);
-EXPORT_SYMBOL_NOVERS($$divU);
-EXPORT_SYMBOL_NOVERS($$remI);
-EXPORT_SYMBOL_NOVERS($$remU);
-EXPORT_SYMBOL_NOVERS($$mulI);
-EXPORT_SYMBOL_NOVERS($$divU_3);
-EXPORT_SYMBOL_NOVERS($$divU_5);
-EXPORT_SYMBOL_NOVERS($$divU_6);
-EXPORT_SYMBOL_NOVERS($$divU_9);
-EXPORT_SYMBOL_NOVERS($$divU_10);
-EXPORT_SYMBOL_NOVERS($$divU_12);
-EXPORT_SYMBOL_NOVERS($$divU_7);
-EXPORT_SYMBOL_NOVERS($$divU_14);
-EXPORT_SYMBOL_NOVERS($$divU_15);
-EXPORT_SYMBOL_NOVERS($$divI_3);
-EXPORT_SYMBOL_NOVERS($$divI_5);
-EXPORT_SYMBOL_NOVERS($$divI_6);
-EXPORT_SYMBOL_NOVERS($$divI_7);
-EXPORT_SYMBOL_NOVERS($$divI_9);
-EXPORT_SYMBOL_NOVERS($$divI_10);
-EXPORT_SYMBOL_NOVERS($$divI_12);
-EXPORT_SYMBOL_NOVERS($$divI_14);
-EXPORT_SYMBOL_NOVERS($$divI_15);
+EXPORT_SYMBOL($$divI);
+EXPORT_SYMBOL($$divU);
+EXPORT_SYMBOL($$remI);
+EXPORT_SYMBOL($$remU);
+EXPORT_SYMBOL($$mulI);
+EXPORT_SYMBOL($$divU_3);
+EXPORT_SYMBOL($$divU_5);
+EXPORT_SYMBOL($$divU_6);
+EXPORT_SYMBOL($$divU_9);
+EXPORT_SYMBOL($$divU_10);
+EXPORT_SYMBOL($$divU_12);
+EXPORT_SYMBOL($$divU_7);
+EXPORT_SYMBOL($$divU_14);
+EXPORT_SYMBOL($$divU_15);
+EXPORT_SYMBOL($$divI_3);
+EXPORT_SYMBOL($$divI_5);
+EXPORT_SYMBOL($$divI_6);
+EXPORT_SYMBOL($$divI_7);
+EXPORT_SYMBOL($$divI_9);
+EXPORT_SYMBOL($$divI_10);
+EXPORT_SYMBOL($$divI_12);
+EXPORT_SYMBOL($$divI_14);
+EXPORT_SYMBOL($$divI_15);
 
 extern void __ashrdi3(void);
 extern void __ashldi3(void);
 extern void __lshrdi3(void);
 extern void __muldi3(void);
 
-EXPORT_SYMBOL_NOVERS(__ashrdi3);
-EXPORT_SYMBOL_NOVERS(__ashldi3);
-EXPORT_SYMBOL_NOVERS(__lshrdi3);
-EXPORT_SYMBOL_NOVERS(__muldi3);
+EXPORT_SYMBOL(__ashrdi3);
+EXPORT_SYMBOL(__ashldi3);
+EXPORT_SYMBOL(__lshrdi3);
+EXPORT_SYMBOL(__muldi3);
 
 #ifdef __LP64__
 extern void __divdi3(void);
@@ -196,16 +207,16 @@
 extern void __umoddi3(void);
 extern void __moddi3(void);
 
-EXPORT_SYMBOL_NOVERS(__divdi3);
-EXPORT_SYMBOL_NOVERS(__udivdi3);
-EXPORT_SYMBOL_NOVERS(__umoddi3);
-EXPORT_SYMBOL_NOVERS(__moddi3);
+EXPORT_SYMBOL(__divdi3);
+EXPORT_SYMBOL(__udivdi3);
+EXPORT_SYMBOL(__umoddi3);
+EXPORT_SYMBOL(__moddi3);
 #endif
 
 #ifndef __LP64__
 extern void $$dyncall(void);
-EXPORT_SYMBOL_NOVERS($$dyncall);
+EXPORT_SYMBOL($$dyncall);
 #endif
 
 #include <asm/pgtable.h>
-EXPORT_SYMBOL_NOVERS(vmalloc_start);
+EXPORT_SYMBOL(vmalloc_start);
diff -urN linux-2.5.71-bk1/arch/parisc/kernel/pdc_cons.c linux-2.5.71-bk2/arch/parisc/kernel/pdc_cons.c
--- linux-2.5.71-bk1/arch/parisc/kernel/pdc_cons.c	2003-06-14 12:18:04.000000000 -0700
+++ linux-2.5.71-bk2/arch/parisc/kernel/pdc_cons.c	2003-06-16 04:45:32.000000000 -0700
@@ -24,6 +24,7 @@
 #include <linux/sched.h>
 #include <linux/interrupt.h>
 #include <linux/major.h>
+#include <linux/tty.h>
 #include <asm/page.h>
 #include <asm/types.h>
 #include <asm/system.h>
@@ -52,12 +53,24 @@
 	return 0;
 }
 
-#if defined(CONFIG_PDC_CONSOLE) || defined(CONFIG_SERIAL_MUX)
+#if defined(CONFIG_PDC_CONSOLE)
 #define PDC_CONSOLE_DEVICE pdc_console_device
-static kdev_t pdc_console_device (struct console *c)
+static struct tty_driver * pdc_console_device (struct console *c, int *index)
+{
+	extern struct tty_driver console_driver;
+	*index = c->index ? c->index-1 : fg_console;
+	return &console_driver;
+}
+
+#elif defined(CONFIG_SERIAL_MUX)
+#warning CONFIG_SERIAL_MUX
+#define PDC_CONSOLE_DEVICE pdc_console_device
+#warning "FIXME - should be: static struct tty_driver * pdc_console_device (struct console *c, int *index)"
+static kdev_t pdc_console_device (struct console *c, int *index)
 {
         return mk_kdev(MUX_MAJOR, 0);
 }
+
 #else
 #define PDC_CONSOLE_DEVICE NULL
 #endif
diff -urN linux-2.5.71-bk1/arch/parisc/kernel/process.c linux-2.5.71-bk2/arch/parisc/kernel/process.c
--- linux-2.5.71-bk1/arch/parisc/kernel/process.c	2003-06-14 12:18:51.000000000 -0700
+++ linux-2.5.71-bk2/arch/parisc/kernel/process.c	2003-06-16 04:45:32.000000000 -0700
@@ -10,33 +10,23 @@
 #define __KERNEL_SYSCALLS__
 #include <stdarg.h>
 
+#include <linux/elf.h>
 #include <linux/errno.h>
-#include <linux/sched.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
-#include <linux/smp.h>
-#include <linux/smp_lock.h>
+#include <linux/personality.h>
+#include <linux/ptrace.h>
+#include <linux/sched.h>
 #include <linux/stddef.h>
 #include <linux/unistd.h>
-#include <linux/ptrace.h>
-#include <linux/slab.h>
-#include <linux/vmalloc.h>
-#include <linux/interrupt.h>
-#include <linux/reboot.h>
-#include <linux/init.h>
 #include <linux/version.h>
-#include <linux/elf.h>
-#include <linux/personality.h>
 
-#include <asm/machdep.h>
-#include <asm/offsets.h>
-#include <asm/uaccess.h>
-#include <asm/pgtable.h>
-#include <asm/pgalloc.h>
-#include <asm/system.h>
 #include <asm/io.h>
-#include <asm/processor.h>
+#include <asm/offsets.h>
+#include <asm/pdc.h>
 #include <asm/pdc_chassis.h>
+#include <asm/pgalloc.h>
+#include <asm/uaccess.h>
 
 int hlt_counter;
 
@@ -224,18 +214,14 @@
 sys_clone(unsigned long clone_flags, unsigned long usp,
 	  struct pt_regs *regs)
 {
-	struct task_struct *p;
 	int *user_tid = (int *)regs->gr[26];
-	p = do_fork(clone_flags & ~CLONE_IDLETASK, usp, regs, 0, user_tid, NULL);
-	return IS_ERR(p) ? PTR_ERR(p) : p->pid;
+	return do_fork(clone_flags & ~CLONE_IDLETASK, usp, regs, 0, user_tid, NULL);
 }
 
 int
 sys_vfork(struct pt_regs *regs)
 {
-	struct task_struct *p;
-	p = do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->gr[30], regs, 0, NULL, NULL);
-	return IS_ERR(p) ? PTR_ERR(p) : p->pid;
+	return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->gr[30], regs, 0, NULL, NULL);
 }
 
 int
@@ -251,7 +237,9 @@
 	 * Make them const so the compiler knows they live in .text */
 	extern void * const ret_from_kernel_thread;
 	extern void * const child_return;
+#ifdef CONFIG_HPUX
 	extern void * const hpux_child_return;
+#endif
 
 	*cregs = *pregs;
 
@@ -295,7 +283,11 @@
 			+ (pregs->gr[21] & (INIT_THREAD_SIZE - 1));
 		cregs->gr[30] = usp;
 		if (p->personality == PER_HPUX) {
+#ifdef CONFIG_HPUX
 			cregs->kpc = (unsigned long) &hpux_child_return;
+#else
+			BUG();
+#endif
 		} else {
 			cregs->kpc = (unsigned long) &child_return;
 		}
diff -urN linux-2.5.71-bk1/arch/parisc/kernel/processor.c linux-2.5.71-bk2/arch/parisc/kernel/processor.c
--- linux-2.5.71-bk1/arch/parisc/kernel/processor.c	2003-06-14 12:18:35.000000000 -0700
+++ linux-2.5.71-bk2/arch/parisc/kernel/processor.c	2003-06-16 04:45:32.000000000 -0700
@@ -145,6 +145,7 @@
 	/* initialize counters */
 	memset(p, 0, sizeof(struct cpuinfo_parisc));
 
+	p->loops_per_jiffy = loops_per_jiffy;
 	p->dev = dev;		/* Save IODC data in case we need it */
 	p->hpa = dev->hpa;	/* save CPU hpa */
 	p->cpuid = cpuid;	/* save CPU id */
@@ -356,8 +357,8 @@
 		show_cache_info(m);
 
 		seq_printf(m, "bogomips\t: %lu.%02lu\n",
-			     loops_per_jiffy / (500000 / HZ),
-			     (loops_per_jiffy / (5000 / HZ)) % 100);
+			     cpu_data[n].loops_per_jiffy / (500000 / HZ),
+			     (cpu_data[n].loops_per_jiffy / (5000 / HZ)) % 100);
 
 		seq_printf(m, "software id\t: %ld\n\n",
 				boot_cpu_data.pdc.model.sw_id);
diff -urN linux-2.5.71-bk1/arch/parisc/kernel/signal.c linux-2.5.71-bk2/arch/parisc/kernel/signal.c
--- linux-2.5.71-bk1/arch/parisc/kernel/signal.c	2003-06-14 12:18:35.000000000 -0700
+++ linux-2.5.71-bk2/arch/parisc/kernel/signal.c	2003-06-16 04:45:32.000000000 -0700
@@ -309,7 +309,8 @@
 	}
 #endif
 
-#if CACHE_FLUSHING_IS_NOT_BROKEN
+#undef CACHE_FLUSHING_IS_NOT_BROKEN
+#ifdef CACHE_FLUSHING_IS_NOT_BROKEN
 	flush_user_icache_range((unsigned long) &frame->tramp[0],
 			   (unsigned long) &frame->tramp[4]);
 #else
diff -urN linux-2.5.71-bk1/arch/parisc/kernel/smp.c linux-2.5.71-bk2/arch/parisc/kernel/smp.c
--- linux-2.5.71-bk1/arch/parisc/kernel/smp.c	2003-06-14 12:18:49.000000000 -0700
+++ linux-2.5.71-bk2/arch/parisc/kernel/smp.c	2003-06-16 04:45:32.000000000 -0700
@@ -147,7 +147,7 @@
 }
 
 
-void
+irqreturn_t
 ipi_interrupt(int irq, void *dev_id, struct pt_regs *regs) 
 {
 	int this_cpu = smp_processor_id();
@@ -256,7 +256,7 @@
 			} /* Switch */
 		} /* while (ops) */
 	}
-	return;
+	return IRQ_HANDLED;
 }
 
 
@@ -515,14 +515,14 @@
 	 * don't care about the regs settings since
 	 * we'll never reschedule the forked task.
 	 */
-	return do_fork(CLONE_VM|CLONE_IDLETASK, 0, &regs, 0, NULL, NULL);
+	return copy_process(CLONE_VM|CLONE_IDLETASK, 0, &regs, 0, NULL, NULL);
 }
 
 
 /*
  * Bring one cpu online.
  */
-static int smp_boot_one_cpu(int cpuid, int cpunum)
+static int __init smp_boot_one_cpu(int cpuid, int cpunum)
 {
 	struct task_struct *idle;
 	long timeout;
@@ -537,9 +537,11 @@
 	 * Sheesh . . .
 	 */
 
-	if ((idle = fork_by_hand()) == 0) 
+	idle = fork_by_hand();
+	if (IS_ERR(idle))
 		panic("SMP: fork failed for CPU:%d", cpuid);
 
+	wake_up_forked_process(idle);
 	init_idle(idle, cpunum);
 	unhash_process(idle);
 	idle->thread_info->cpu = cpunum;
@@ -613,7 +615,7 @@
 void __init smp_boot_cpus(void)
 {
 	int i, cpu_count = 1;
-	unsigned long bogosum = loops_per_jiffy; /* Count Monarch */
+	unsigned long bogosum = cpu_data[0].loops_per_jiffy; /* Count Monarch */
 
 	/* REVISIT - assumes first CPU reported by PAT PDC is BSP */
 	int bootstrap_processor=cpu_data[0].cpuid;	/* CPU ID of BSP */
@@ -650,7 +652,7 @@
 			if (smp_boot_one_cpu(cpu_data[i].cpuid, cpu_count) < 0)
 				continue;
 
-			bogosum += loops_per_jiffy;
+			bogosum += cpu_data[i].loops_per_jiffy;
 			cpu_count++; /* Count good CPUs only... */
 			
 			cpu_present_mask |= 1UL << i;
diff -urN linux-2.5.71-bk1/arch/parisc/kernel/sys_parisc32.c linux-2.5.71-bk2/arch/parisc/kernel/sys_parisc32.c
--- linux-2.5.71-bk1/arch/parisc/kernel/sys_parisc32.c	2003-06-14 12:18:06.000000000 -0700
+++ linux-2.5.71-bk2/arch/parisc/kernel/sys_parisc32.c	2003-06-16 04:45:32.000000000 -0700
@@ -30,10 +30,7 @@
 #include <linux/slab.h>
 #include <linux/uio.h>
 #include <linux/nfs_fs.h>
-#include <linux/smb_fs.h>
-#include <linux/smb_mount.h>
 #include <linux/ncp_fs.h>
-#include <linux/quota.h>
 #include <linux/sunrpc/svc.h>
 #include <linux/nfsd/nfsd.h>
 #include <linux/nfsd/cache.h>
@@ -42,11 +39,6 @@
 #include <linux/poll.h>
 #include <linux/personality.h>
 #include <linux/stat.h>
-#include <linux/filter.h>			/* for setsockopt() */
-#include <linux/icmpv6.h>			/* for setsockopt() */
-#include <linux/netfilter_ipv4/ip_queue.h>	/* for setsockopt() */
-#include <linux/netfilter_ipv4/ip_tables.h>	/* for setsockopt() */
-#include <linux/netfilter_ipv6/ip6_tables.h>	/* for setsockopt() */
 #include <linux/highmem.h>
 #include <linux/highuid.h>
 #include <linux/mman.h>
@@ -62,9 +54,6 @@
 
 #include "sys32.h"
 
-#define A(__x) ((unsigned long)(__x))
-
-
 #undef DEBUG
 
 #ifdef DEBUG
@@ -73,34 +62,6 @@
 #define DBG(x)
 #endif
 
-/* For this source file, we want overflow handling. */
-
-#undef high2lowuid
-#undef high2lowgid
-#undef low2highuid
-#undef low2highgid
-#undef SET_UID16
-#undef SET_GID16
-#undef NEW_TO_OLD_UID
-#undef NEW_TO_OLD_GID
-#undef SET_OLDSTAT_UID
-#undef SET_OLDSTAT_GID
-#undef SET_STAT_UID
-#undef SET_STAT_GID
-
-#define high2lowuid(uid) ((uid) > 65535) ? (u16)overflowuid : (u16)(uid)
-#define high2lowgid(gid) ((gid) > 65535) ? (u16)overflowgid : (u16)(gid)
-#define low2highuid(uid) ((uid) == (u16)-1) ? (uid_t)-1 : (uid_t)(uid)
-#define low2highgid(gid) ((gid) == (u16)-1) ? (gid_t)-1 : (gid_t)(gid)
-#define SET_UID16(var, uid)	var = high2lowuid(uid)
-#define SET_GID16(var, gid)	var = high2lowgid(gid)
-#define NEW_TO_OLD_UID(uid)	high2lowuid(uid)
-#define NEW_TO_OLD_GID(gid)	high2lowgid(gid)
-#define SET_OLDSTAT_UID(stat, uid)	(stat).st_uid = high2lowuid(uid)
-#define SET_OLDSTAT_GID(stat, gid)	(stat).st_gid = high2lowgid(gid)
-#define SET_STAT_UID(stat, uid)		(stat).st_uid = high2lowuid(uid)
-#define SET_STAT_GID(stat, gid)		(stat).st_gid = high2lowgid(gid)
-
 /*
  * count32() counts the number of arguments/envelopes. It is basically
  *           a copy of count() from fs/exec.c, except that it works
@@ -145,7 +106,7 @@
 
 		if (get_user(str, argv + argc) ||
 		    !str ||
-		    !(len = strnlen_user((char *)A(str), bprm->p)))
+		    !(len = strnlen_user((char *)compat_ptr(str), bprm->p)))
 			return -EFAULT;
 
 		if (bprm->p < len) 
@@ -181,7 +142,7 @@
 				if (new)
 					memset(kaddr+offset+len, 0, PAGE_SIZE-offset-len);
 			}
-			err = copy_from_user(kaddr + offset, (char *)A(str), bytes_to_copy);
+			err = copy_from_user(kaddr + offset, (char *)compat_ptr(str), bytes_to_copy);
 			flush_dcache_page(page);
 			kunmap(page);
 
@@ -784,7 +745,7 @@
 		__get_user(len, &vector->iov_len);
 		__get_user(buf, &vector->iov_base);
 		tot_len += len;
-		ivp->iov_base = (void *)A(buf);
+		ivp->iov_base = compat_ptr(buf);
 		ivp->iov_len = (compat_size_t) len;
 		vector++;
 		ivp++;
@@ -1215,67 +1176,6 @@
 	return ret;
 }
 
-#include <linux/quota.h>
-
-struct dqblk32 {
-    __u32 dqb_bhardlimit;
-    __u32 dqb_bsoftlimit;
-    __u32 dqb_curblocks;
-    __u32 dqb_ihardlimit;
-    __u32 dqb_isoftlimit;
-    __u32 dqb_curinodes;
-    compat_time_t dqb_btime;
-    compat_time_t dqb_itime;
-};
-                                
-
-asmlinkage int sys32_quotactl(int cmd, const char *special, int id, unsigned long addr)
-{
-#if 0
-	extern int sys_quotactl(int cmd, const char *special, int id, caddr_t addr);
-	int cmds = cmd >> SUBCMDSHIFT;
-	int err;
-	struct dqblk d;
-	char *spec;
-	
-	switch (cmds) {
-	case Q_GETQUOTA:
-		break;
-	case Q_SETQUOTA:
-	case Q_SETUSE:
-	case Q_SETQLIM:
-		if (copy_from_user (&d, (struct dqblk32 *)addr,
-				    sizeof (struct dqblk32)))
-			return -EFAULT;
-		d.dqb_itime = ((struct dqblk32 *)&d)->dqb_itime;
-		d.dqb_btime = ((struct dqblk32 *)&d)->dqb_btime;
-		break;
-	default:
-		return sys_quotactl(cmd, special,
-				    id, (caddr_t)addr);
-	}
-	spec = getname (special);
-	err = PTR_ERR(spec);
-	if (IS_ERR(spec)) return err;
-	KERNEL_SYSCALL(err, sys_quotactl, cmd, (const char *)spec, id, (caddr_t)&d);
-	putname (spec);
-	if (cmds == Q_GETQUOTA) {
-		__kernel_time_t b = d.dqb_btime, i = d.dqb_itime;
-		((struct dqblk32 *)&d)->dqb_itime = i;
-		((struct dqblk32 *)&d)->dqb_btime = b;
-		if (copy_to_user ((struct dqblk32 *)addr, &d,
-				  sizeof (struct dqblk32)))
-			return -EFAULT;
-	}
-	return err;
-#endif
-	/* TODO */
-	BUG();
-	return -EINVAL;
-}
-
-
-
 extern asmlinkage ssize_t sys_sendfile64(int out_fd, int in_fd, loff_t *offset, size_t count);
 typedef long __kernel_loff_t32;		/* move this to asm/posix_types.h? */
 
diff -urN linux-2.5.71-bk1/arch/parisc/kernel/syscall.S linux-2.5.71-bk2/arch/parisc/kernel/syscall.S
--- linux-2.5.71-bk1/arch/parisc/kernel/syscall.S	2003-06-14 12:18:51.000000000 -0700
+++ linux-2.5.71-bk2/arch/parisc/kernel/syscall.S	2003-06-16 04:45:32.000000000 -0700
@@ -496,7 +496,7 @@
 	ENTRY_SAME(delete_module)
 	ENTRY_SAME(ni_syscall)		/* 130: get_kernel_syms */
 	/* time_t inside struct dqblk */
-	ENTRY_DIFF(quotactl) /* -- FIXME, doesn't work */
+	ENTRY_SAME(quotactl)
 	ENTRY_SAME(getpgid)
 	ENTRY_SAME(fchdir)
 	ENTRY_SAME(bdflush)
diff -urN linux-2.5.71-bk1/arch/parisc/kernel/time.c linux-2.5.71-bk2/arch/parisc/kernel/time.c
--- linux-2.5.71-bk1/arch/parisc/kernel/time.c	2003-06-16 04:45:23.000000000 -0700
+++ linux-2.5.71-bk2/arch/parisc/kernel/time.c	2003-06-16 04:45:32.000000000 -0700
@@ -76,7 +76,7 @@
 	atomic_inc((atomic_t *)&prof_buffer[pc]);
 }
 
-void timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 {
 	long now;
 	long next_tick;
@@ -127,6 +127,8 @@
 	/* check soft power switch status */
 	if (cpu == 0 && !atomic_read(&power_tasklet.count))
 		tasklet_schedule(&power_tasklet);
+
+	return IRQ_HANDLED;
 }
 
 /*** converted from ia64 ***/
diff -urN linux-2.5.71-bk1/arch/parisc/kernel/traps.c linux-2.5.71-bk2/arch/parisc/kernel/traps.c
--- linux-2.5.71-bk1/arch/parisc/kernel/traps.c	2003-06-14 12:18:52.000000000 -0700
+++ linux-2.5.71-bk2/arch/parisc/kernel/traps.c	2003-06-16 04:45:32.000000000 -0700
@@ -114,6 +114,12 @@
 	printk("%s CPU: %8d   CR30: " RFMT " CR31: " RFMT "\n",
 	       level, current_thread_info()->cpu, cr30, cr31);
 	printk("%s ORIG_R28: " RFMT "\n", level, regs->orig_r28);
+	printk(level);
+	print_symbol(" IAOQ[0]: %s\n", regs->iaoq[0]);
+	printk(level);
+	print_symbol(" IAOQ[1]: %s\n", regs->iaoq[1]);
+	printk(level);
+	print_symbol(" RP(r2): %s\n", regs->gr[2]);
 }
 
 
diff -urN linux-2.5.71-bk1/arch/parisc/mm/init.c linux-2.5.71-bk2/arch/parisc/mm/init.c
--- linux-2.5.71-bk1/arch/parisc/mm/init.c	2003-06-14 12:18:21.000000000 -0700
+++ linux-2.5.71-bk2/arch/parisc/mm/init.c	2003-06-16 04:45:33.000000000 -0700
@@ -10,6 +10,7 @@
 
 #include <linux/config.h>
 
+#include <linux/module.h>
 #include <linux/mm.h>
 #include <linux/bootmem.h>
 #include <linux/delay.h>
@@ -666,6 +667,7 @@
 		PAGE_SIZE, PAGE_GATEWAY);
 }
 
+#ifdef CONFIG_HPUX
 void
 map_hpux_gateway_page(struct task_struct *tsk, struct mm_struct *mm)
 {
@@ -734,6 +736,8 @@
 	pg_table = (pte_t *) __va(pg_table) + start_pte;
 	set_pte(pg_table, __mk_pte(address, PAGE_GATEWAY));
 }
+EXPORT_SYMBOL(map_hpux_gateway_page);
+#endif
 
 extern void flush_tlb_all_local(void);
 
diff -urN linux-2.5.71-bk1/arch/parisc/oprofile/init.c linux-2.5.71-bk2/arch/parisc/oprofile/init.c
--- linux-2.5.71-bk1/arch/parisc/oprofile/init.c	2003-06-14 12:18:21.000000000 -0700
+++ linux-2.5.71-bk2/arch/parisc/oprofile/init.c	2003-06-16 04:45:33.000000000 -0700
@@ -7,10 +7,11 @@
  * @author John Levon <levon@movementarian.org>
  */
 
+#include <linux/errno.h>
+#include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/oprofile.h>
-#include <linux/init.h>
- 
+
 extern void timer_init(struct oprofile_operations ** ops);
 
 int __init oprofile_arch_init(struct oprofile_operations ** ops)
diff -urN linux-2.5.71-bk1/arch/sh/Kconfig linux-2.5.71-bk2/arch/sh/Kconfig
--- linux-2.5.71-bk1/arch/sh/Kconfig	2003-06-16 04:45:23.000000000 -0700
+++ linux-2.5.71-bk2/arch/sh/Kconfig	2003-06-16 04:45:33.000000000 -0700
@@ -722,7 +722,7 @@
 
 source "drivers/pcmcia/Kconfig"
 
-source "drivers/hotplug/Kconfig"
+source "drivers/pci/hotplug/Kconfig"
 
 endmenu
 
diff -urN linux-2.5.71-bk1/arch/sh/tools/Makefile linux-2.5.71-bk2/arch/sh/tools/Makefile
--- linux-2.5.71-bk1/arch/sh/tools/Makefile	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.71-bk2/arch/sh/tools/Makefile	2003-06-16 04:45:33.000000000 -0700
@@ -0,0 +1,16 @@
+#
+# arch/sh/tools/Makefile
+#
+# Copyright (C) 2003  Paul Mundt
+#
+# This file is subject to the terms and conditions of the GNU General Public
+# License.  See the file "COPYING" in the main directory of this archive
+# for more details.
+#
+# Shamelessly cloned from ARM.
+#
+
+include/asm-sh/machtypes.h: $(obj)/machgen.sh $(obj)/mach-types
+	@echo '  Generating $@'
+	@$(CONFIG_SHELL) $(obj)/machgen.sh $(obj)/mach-types > $@
+
diff -urN linux-2.5.71-bk1/arch/sh/tools/mach-types linux-2.5.71-bk2/arch/sh/tools/mach-types
--- linux-2.5.71-bk1/arch/sh/tools/mach-types	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.71-bk2/arch/sh/tools/mach-types	2003-06-16 04:45:33.000000000 -0700
@@ -0,0 +1,22 @@
+#
+# List of boards.
+#
+
+#
+# MACH_<xxx>		CONFIG_<xxx>
+#
+SE			SH_SOLUTION_ENGINE
+7751SE			SH_7751_SOLUTION_ENGINE		
+HP600			SH_HP600
+HP620			SH_HP620
+HP680			SH_HP680
+HP690			SH_HP690
+HD64461			HD64461
+HD64465			HD64465
+SH2000			SH_SH2000
+SATURN			SH_SATURN
+DREAMCAST		SH_DREAMCAST
+BIGSUR			SH_BIGSUR
+ADX			SH_ADX
+MPC1211			SH_MPC1211
+
diff -urN linux-2.5.71-bk1/arch/sh/tools/machgen.sh linux-2.5.71-bk2/arch/sh/tools/machgen.sh
--- linux-2.5.71-bk1/arch/sh/tools/machgen.sh	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.71-bk2/arch/sh/tools/machgen.sh	2003-06-16 04:45:33.000000000 -0700
@@ -0,0 +1,71 @@
+#!/bin/sh
+#
+# include/asm-sh/machtype.h header generation script for SuperH
+#
+# Copyright (C) 2003 Paul Mundt
+#
+# This is pretty much a quick and dirty hack based off of the awk
+# script written by rmk that ARM uses to achieve the same sort of
+# thing.
+#
+# Unfortunately this script has a dependance on bash/sed/cut/tr,
+# though they should be prevalent enough for this dependancy not
+# to matter overly much.
+#
+# As a note for anyone attempting to manually invoke this script,
+# it expects to be run straight out of the arch/sh/tools/ directory
+# as it doesn't look at TOPDIR to figure out where asm-sh is
+# located.
+#
+# See the note at the top of the generated header for additional
+# information.
+#
+# Released under the terms of the GNU GPL v2.0.
+#
+
+[ $# -ne 1 ] && echo "Usage: $0 <mach defs>" && exit 1
+
+cat << EOF > tmp.h
+/*
+ * Automagically generated, don't touch.
+ */
+#ifndef __ASM_SH_MACHTYPES_H
+#define __ASM_SH_MACHTYPES_H
+
+#include <linux/config.h>
+
+/*
+ * We'll use the following MACH_xxx defs for placeholders for the time
+ * being .. these will all go away once sh_machtype is assigned per-board.
+ *
+ * For now we leave things the way they are for backwards compatibility.
+ */
+
+/* Mach types */
+EOF
+
+newline='
+'
+IFS=$newline
+
+rm -f tmp2.h
+
+for entry in `cat $1 | sed -e 's/\#.*$//g;/^$/d' | tr '\t' ' ' | tr -s ' '`; do
+	board=`echo $entry | cut -f1 -d' '`
+
+	printf "#ifdef CONFIG_`echo $entry | cut -f2 -d' '`\n" >> tmp.h
+	printf "  #define MACH_$board\t\t1\n#else\n  #define MACH_$board\t\t0\n#endif\n" >> tmp.h
+	printf "#define mach_is_`echo $board | tr '[A-Z]' '[a-z]'`()\t\t\t(MACH_$board)\n" >> tmp2.h
+done
+
+printf "\n/* Machtype checks */\n" >> tmp.h
+cat tmp2.h >> tmp.h && rm -f tmp2.h
+
+cat << EOF >> tmp.h
+
+#endif /* __ASM_SH_MACHTYPES_H */
+EOF
+
+cat tmp.h
+rm -f tmp.h
+
diff -urN linux-2.5.71-bk1/arch/sparc64/defconfig linux-2.5.71-bk2/arch/sparc64/defconfig
--- linux-2.5.71-bk1/arch/sparc64/defconfig	2003-06-14 12:18:06.000000000 -0700
+++ linux-2.5.71-bk2/arch/sparc64/defconfig	2003-06-16 04:45:33.000000000 -0700
@@ -58,6 +58,7 @@
 CONFIG_SUN_AUXIO=y
 CONFIG_SUN_IO=y
 CONFIG_PCI=y
+CONFIG_PCI_DOMAINS=y
 CONFIG_RTC=y
 # CONFIG_PCI_LEGACY_PROC is not set
 # CONFIG_PCI_NAMES is not set
@@ -197,7 +198,7 @@
 # CONFIG_BLK_DEV_RAM is not set
 
 #
-# ATA/ATAPI/MFM/RLL device support
+# ATA/ATAPI/MFM/RLL support
 #
 CONFIG_IDE=y
 
@@ -217,6 +218,7 @@
 # CONFIG_BLK_DEV_IDEFLOPPY is not set
 # CONFIG_BLK_DEV_IDESCSI is not set
 # CONFIG_IDE_TASK_IOCTL is not set
+CONFIG_IDE_TASKFILE_IO=y
 
 #
 # IDE chipset support/bugfixes
@@ -287,18 +289,8 @@
 #
 CONFIG_SCSI_SUNESP=y
 CONFIG_SCSI_QLOGICPTI=m
-CONFIG_SCSI_AIC7XXX=m
-CONFIG_AIC7XXX_CMDS_PER_DEVICE=253
-CONFIG_AIC7XXX_RESET_DELAY_MS=5000
-# CONFIG_AIC7XXX_PROBE_EISA_VL is not set
-# CONFIG_AIC7XXX_BUILD_FIRMWARE is not set
-# CONFIG_AIC7XXX_DEBUG_ENABLE is not set
-CONFIG_AIC7XXX_DEBUG_MASK=0
-# CONFIG_AIC7XXX_REG_PRETTY_PRINT is not set
-CONFIG_SCSI_AIC7XXX_OLD=m
-CONFIG_AIC7XXX_OLD_TCQ_ON_BY_DEFAULT=y
-CONFIG_AIC7XXX_OLD_CMDS_PER_DEVICE=8
-CONFIG_AIC7XXX_OLD_PROC_STATS=y
+# CONFIG_SCSI_AIC7XXX is not set
+# CONFIG_SCSI_AIC7XXX_OLD is not set
 CONFIG_SCSI_SYM53C8XX_2=y
 CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
 CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
@@ -448,6 +440,7 @@
 CONFIG_INET6_AH=m
 CONFIG_INET6_ESP=m
 CONFIG_INET6_IPCOMP=m
+CONFIG_IPV6_TUNNEL=m
 
 #
 # IPv6: Netfilter Configuration
@@ -891,6 +884,7 @@
 # CONFIG_SERIO_SERPORT is not set
 # CONFIG_SERIO_CT82C710 is not set
 # CONFIG_SERIO_PARKBD is not set
+CONFIG_SERIO_PCIPS2=m
 
 #
 # Input Device Drivers
@@ -902,6 +896,7 @@
 # CONFIG_KEYBOARD_NEWTON is not set
 CONFIG_INPUT_MOUSE=y
 CONFIG_MOUSE_PS2=y
+CONFIG_MOUSE_PS2_SYNAPTICS=y
 CONFIG_MOUSE_SERIAL=y
 # CONFIG_INPUT_JOYSTICK is not set
 # CONFIG_INPUT_TOUCHSCREEN is not set
@@ -1092,6 +1087,7 @@
 # PCI devices
 #
 CONFIG_SND_ALI5451=m
+CONFIG_SND_AZT3328=m
 CONFIG_SND_CS46XX=m
 # CONFIG_SND_CS46XX_NEW_DSP is not set
 CONFIG_SND_CS4281=m
@@ -1361,12 +1357,12 @@
 CONFIG_CRYPTO_TWOFISH=m
 CONFIG_CRYPTO_SERPENT=m
 CONFIG_CRYPTO_AES=m
-CONFIG_CRYPTO_DEFLATE=m
+CONFIG_CRYPTO_DEFLATE=y
 # CONFIG_CRYPTO_TEST is not set
 
 #
 # Library routines
 #
 CONFIG_CRC32=y
-CONFIG_ZLIB_INFLATE=m
-CONFIG_ZLIB_DEFLATE=m
+CONFIG_ZLIB_INFLATE=y
+CONFIG_ZLIB_DEFLATE=y
diff -urN linux-2.5.71-bk1/arch/sparc64/kernel/sys_sparc32.c linux-2.5.71-bk2/arch/sparc64/kernel/sys_sparc32.c
--- linux-2.5.71-bk1/arch/sparc64/kernel/sys_sparc32.c	2003-06-14 12:18:24.000000000 -0700
+++ linux-2.5.71-bk2/arch/sparc64/kernel/sys_sparc32.c	2003-06-16 04:45:33.000000000 -0700
@@ -2312,7 +2312,6 @@
    sorts of things, like timeval and itimerval.  */
 
 extern struct timezone sys_tz;
-extern int do_sys_settimeofday(struct timeval *tv, struct timezone *tz);
 
 asmlinkage int sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz)
 {
@@ -2329,13 +2328,27 @@
 	return 0;
 }
 
+static inline long get_ts32(struct timespec *o, struct compat_timeval *i)
+{
+	long usec;
+
+	if (!access_ok(VERIFY_READ, i, sizeof(*i)))
+		return -EFAULT;
+	if (__get_user(o->tv_sec, &i->tv_sec))
+		return -EFAULT;
+	if (__get_user(usec, &i->tv_usec))
+		return -EFAULT;
+	o->tv_nsec = usec * 1000;
+	return 0;
+}
+
 asmlinkage int sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz)
 {
-	struct timeval ktv;
+	struct timespec kts;
 	struct timezone ktz;
 
  	if (tv) {
-		if (get_tv32(&ktv, tv))
+		if (get_ts32(&kts, tv))
 			return -EFAULT;
 	}
 	if (tz) {
@@ -2343,7 +2356,7 @@
 			return -EFAULT;
 	}
 
-	return do_sys_settimeofday(tv ? &ktv : NULL, tz ? &ktz : NULL);
+	return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
 }
 
 asmlinkage int sys32_utimes(char *filename, struct compat_timeval *tvs)
diff -urN linux-2.5.71-bk1/arch/x86_64/ia32/sys_ia32.c linux-2.5.71-bk2/arch/x86_64/ia32/sys_ia32.c
--- linux-2.5.71-bk1/arch/x86_64/ia32/sys_ia32.c	2003-06-14 12:18:08.000000000 -0700
+++ linux-2.5.71-bk2/arch/x86_64/ia32/sys_ia32.c	2003-06-16 04:45:33.000000000 -0700
@@ -452,7 +452,6 @@
    sorts of things, like timeval and itimerval.  */
 
 extern struct timezone sys_tz;
-extern int do_sys_settimeofday(struct timeval *tv, struct timezone *tz);
 
 asmlinkage long
 sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz)
@@ -474,18 +473,21 @@
 sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz)
 {
 	struct timeval ktv;
+	struct timespec kts;
 	struct timezone ktz;
 
  	if (tv) {
 		if (get_tv32(&ktv, tv))
 			return -EFAULT;
+		kts.tv_sec = ktv.tv_sec;
+		kts.tv_nsec = ktv.tv_usec * NSEC_PER_USEC;
 	}
 	if (tz) {
 		if (copy_from_user(&ktz, tz, sizeof(ktz)))
 			return -EFAULT;
 	}
 
-	return do_sys_settimeofday(tv ? &ktv : NULL, tz ? &ktz : NULL);
+	return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
 }
 
 struct linux32_dirent {
diff -urN linux-2.5.71-bk1/drivers/char/sonypi.c linux-2.5.71-bk2/drivers/char/sonypi.c
--- linux-2.5.71-bk1/drivers/char/sonypi.c	2003-06-14 12:18:28.000000000 -0700
+++ linux-2.5.71-bk2/drivers/char/sonypi.c	2003-06-16 04:45:34.000000000 -0700
@@ -120,9 +120,9 @@
 
 static int ec_read16(u8 addr, u16 *value) {
 	u8 val_lb, val_hb;
-	if (ec_read(addr, &val_lb))
+	if (sonypi_ec_read(addr, &val_lb))
 		return -1;
-	if (ec_read(addr + 1, &val_hb))
+	if (sonypi_ec_read(addr + 1, &val_hb))
 		return -1;
 	*value = val_lb | (val_hb << 8);
 	return 0;
@@ -152,17 +152,17 @@
 }
 
 static void __devinit sonypi_type2_srs(void) {
-	if (ec_write(SONYPI_SHIB, (sonypi_device.ioport1 & 0xFF00) >> 8))
+	if (sonypi_ec_write(SONYPI_SHIB, (sonypi_device.ioport1 & 0xFF00) >> 8))
 		printk(KERN_WARNING "ec_write failed\n");
-	if (ec_write(SONYPI_SLOB,  sonypi_device.ioport1 & 0x00FF))
+	if (sonypi_ec_write(SONYPI_SLOB,  sonypi_device.ioport1 & 0x00FF))
 		printk(KERN_WARNING "ec_write failed\n");
-	if (ec_write(SONYPI_SIRQ,  sonypi_device.bits))
+	if (sonypi_ec_write(SONYPI_SIRQ,  sonypi_device.bits))
 		printk(KERN_WARNING "ec_write failed\n");
 	udelay(10);
 }
 
 /* Disables the device - this comes from the AML code in the ACPI bios */
-static void __devexit sonypi_type1_dis(void) {
+static void sonypi_type1_dis(void) {
 	u32 v;
 
 	pci_read_config_dword(sonypi_device.dev, SONYPI_G10A, &v);
@@ -174,12 +174,12 @@
 	outl(v, SONYPI_IRQ_PORT);
 }
 
-static void __devexit sonypi_type2_dis(void) {
-	if (ec_write(SONYPI_SHIB, 0))
+static void sonypi_type2_dis(void) {
+	if (sonypi_ec_write(SONYPI_SHIB, 0))
 		printk(KERN_WARNING "ec_write failed\n");
-	if (ec_write(SONYPI_SLOB, 0))
+	if (sonypi_ec_write(SONYPI_SLOB, 0))
 		printk(KERN_WARNING "ec_write failed\n");
-	if (ec_write(SONYPI_SIRQ, 0))
+	if (sonypi_ec_write(SONYPI_SIRQ, 0))
 		printk(KERN_WARNING "ec_write failed\n");
 }
 
@@ -265,7 +265,7 @@
 
 	for (j = 5; j > 0; j--) {
 
-		while (sonypi_call2(0x91, 0x1) != 0) {
+		while (sonypi_call2(0x91, 0x1)) {
 			set_current_state(TASK_UNINTERRUPTIBLE);
 			schedule_timeout(1);
 		}
@@ -277,7 +277,7 @@
 			set_current_state(TASK_UNINTERRUPTIBLE);
 			schedule_timeout(1);
 		}
-		if (i != 0)
+		if (i)
 			break;
 	}
 	
@@ -293,14 +293,12 @@
 /* sets the bluetooth subsystem power state */
 static void sonypi_setbluetoothpower(u8 state) {
 
-	state = (state != 0);
-	if (sonypi_device.bluetooth_power && state) 
-		return;
-	if (!sonypi_device.bluetooth_power && !state) 
+	state = !!state;
+	if (sonypi_device.bluetooth_power == state) 
 		return;
 	
 	sonypi_call2(0x96, state);
-	sonypi_call1(0x93);
+	sonypi_call1(0x82);
 	sonypi_device.bluetooth_power = state;
 }
 
@@ -312,10 +310,6 @@
 	v1 = inb_p(sonypi_device.ioport1);
 	v2 = inb_p(sonypi_device.ioport2);
 
-	if (verbose > 1)
-		printk(KERN_INFO 
-		       "sonypi: event port1=0x%02x,port2=0x%02x\n", v1, v2);
-
 	for (i = 0; sonypi_eventtypes[i].model; i++) {
 		if (sonypi_device.model != sonypi_eventtypes[i].model)
 			continue;
@@ -334,10 +328,17 @@
 	if (verbose)
 		printk(KERN_WARNING 
 		       "sonypi: unknown event port1=0x%02x,port2=0x%02x\n",v1,v2);
-	return IRQ_NONE;
+	/* We need to return IRQ_HANDLED here because there *are*
+	 * events belonging to the sonypi device we don't know about, 
+	 * but we still don't want those to pollute the logs... */
+	return IRQ_HANDLED;
 
 found:
-#if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE)
+	if (verbose > 1)
+		printk(KERN_INFO 
+		       "sonypi: event port1=0x%02x,port2=0x%02x\n", v1, v2);
+
+#ifdef SONYPI_USE_INPUT
 	if (useinput) {
 		struct input_dev *jog_dev = &sonypi_device.jog_dev;
 		if (event == SONYPI_EVENT_JOGDIAL_PRESSED)
@@ -352,7 +353,7 @@
 			input_report_rel(jog_dev, REL_WHEEL, -1);
 		input_sync(jog_dev);
 	}
-#endif /* CONFIG_INPUT || CONFIG_INPUT_MODULE */
+#endif /* SONYPI_USE_INPUT */
 	sonypi_pushq(event);
 	return IRQ_HANDLED;
 }
@@ -509,7 +510,7 @@
 	down(&sonypi_device.lock);
 	switch (cmd) {
 	case SONYPI_IOCGBRT:
-		if (ec_read(SONYPI_LCD_LIGHT, &val8)) {
+		if (sonypi_ec_read(SONYPI_LCD_LIGHT, &val8)) {
 			ret = -EIO;
 			break;
 		}
@@ -521,7 +522,7 @@
 			ret = -EFAULT;
 			break;
 		}
-		if (ec_write(SONYPI_LCD_LIGHT, val8))
+		if (sonypi_ec_write(SONYPI_LCD_LIGHT, val8))
 			ret = -EIO;
 		break;
 	case SONYPI_IOCGBAT1CAP:
@@ -557,7 +558,7 @@
 			ret = -EFAULT;
 		break;
 	case SONYPI_IOCGBATFLAGS:
-		if (ec_read(SONYPI_BAT_FLAGS, &val8)) {
+		if (sonypi_ec_read(SONYPI_BAT_FLAGS, &val8)) {
 			ret = -EIO;
 			break;
 		}
@@ -613,18 +614,14 @@
 			sonypi_type2_dis();
 		else
 			sonypi_type1_dis();
-#ifndef CONFIG_ACPI
 		/* disable ACPI mode */
-		if (fnkeyinit)
+		if (!SONYPI_ACPI_ACTIVE && fnkeyinit)
 			outb(0xf1, 0xb2);
-#endif
 		break;
 	case PM_RESUME:
-#ifndef CONFIG_ACPI
 		/* Enable ACPI mode to get Fn key events */
-		if (fnkeyinit)
+		if (!SONYPI_ACPI_ACTIVE && fnkeyinit)
 			outb(0xf0, 0xb2);
-#endif
 		if (sonypi_device.model == SONYPI_DEVICE_MODEL_TYPE2)
 			sonypi_type2_srs();
 		else
@@ -698,36 +695,44 @@
 	}
 
 	for (i = 0; irq_list[i].irq; i++) {
-		if (!request_irq(irq_list[i].irq, sonypi_irq, 
-				 SA_SHIRQ, "sonypi", sonypi_irq)) {
-			sonypi_device.irq = irq_list[i].irq;
-			sonypi_device.bits = irq_list[i].bits;
+
+		sonypi_device.irq = irq_list[i].irq;
+		sonypi_device.bits = irq_list[i].bits;
+
+		/* Enable sonypi IRQ settings */
+		if (sonypi_device.model == SONYPI_DEVICE_MODEL_TYPE2)
+			sonypi_type2_srs();
+		else
+			sonypi_type1_srs();
+
+		sonypi_call1(0x82);
+		sonypi_call2(0x81, 0xff);
+		if (compat)
+			sonypi_call1(0x92); 
+		else
+			sonypi_call1(0x82);
+
+		/* Now try requesting the irq from the system */
+		if (!request_irq(sonypi_device.irq, sonypi_irq, 
+				 SA_SHIRQ, "sonypi", sonypi_irq))
 			break;
-		}
+
+		/* If request_irq failed, disable sonypi IRQ settings */
+		if (sonypi_device.model == SONYPI_DEVICE_MODEL_TYPE2)
+			sonypi_type2_dis();
+		else
+			sonypi_type1_dis();
 	}
-	if (!sonypi_device.irq ) {
+
+	if (!irq_list[i].irq) {
 		printk(KERN_ERR "sonypi: request_irq failed\n");
 		ret = -ENODEV;
 		goto out3;
 	}
 
-#ifndef CONFIG_ACPI
 	/* Enable ACPI mode to get Fn key events */
-	if (fnkeyinit)
+	if (!SONYPI_ACPI_ACTIVE && fnkeyinit)
 		outb(0xf0, 0xb2);
-#endif
-
-	if (sonypi_device.model == SONYPI_DEVICE_MODEL_TYPE2)
-		sonypi_type2_srs();
-	else
-		sonypi_type1_srs();
-
-	sonypi_call1(0x82);
-	sonypi_call2(0x81, 0xff);
-	if (compat)
-		sonypi_call1(0x92); 
-	else
-		sonypi_call1(0x82);
 
 	printk(KERN_INFO "sonypi: Sony Programmable I/O Controller Driver v%d.%d.\n",
 	       SONYPI_DRIVER_MAJORVERSION,
@@ -750,7 +755,7 @@
 		printk(KERN_INFO "sonypi: device allocated minor is %d\n",
 		       sonypi_misc_device.minor);
 
-#if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE)
+#ifdef SONYPI_USE_INPUT
 	if (useinput) {
 		/* Initialize the Input Drivers: */
 		sonypi_device.jog_dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
@@ -765,7 +770,7 @@
 		input_register_device(&sonypi_device.jog_dev);
 		printk(KERN_INFO "%s installed.\n", sonypi_device.jog_dev.name);
 	}
-#endif /* CONFIG_INPUT || CONFIG_INPUT_MODULE */
+#endif /* SONYPI_USE_INPUT */
 
 #ifdef CONFIG_PM
 	sonypi_device.pm = pm_register(PM_PCI_DEV, 0, sonypi_pm_callback);
@@ -789,12 +794,12 @@
 
 	sonypi_call2(0x81, 0); /* make sure we don't get any more events */
 	
-#if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE)
+#ifdef SONYPI_USE_INPUT
 	if (useinput) {
 		input_unregister_device(&sonypi_device.jog_dev);
 		kfree(sonypi_device.jog_dev.name);
 	}
-#endif /* CONFIG_INPUT || CONFIG_INPUT_MODULE */
+#endif /* SONYPI_USE_INPUT */
 
 	if (camera)
 		sonypi_camera_off();
@@ -802,11 +807,9 @@
 		sonypi_type2_dis();
 	else
 		sonypi_type1_dis();
-#ifndef CONFIG_ACPI
 	/* disable ACPI mode */
-	if (fnkeyinit)
+	if (!SONYPI_ACPI_ACTIVE && fnkeyinit)
 		outb(0xf1, 0xb2);
-#endif
 	free_irq(sonypi_device.irq, sonypi_irq);
 	release_region(sonypi_device.ioport1, sonypi_device.region_size);
 	misc_deregister(&sonypi_misc_device);
diff -urN linux-2.5.71-bk1/drivers/char/sonypi.h linux-2.5.71-bk2/drivers/char/sonypi.h
--- linux-2.5.71-bk1/drivers/char/sonypi.h	2003-06-14 12:18:23.000000000 -0700
+++ linux-2.5.71-bk2/drivers/char/sonypi.h	2003-06-16 04:45:34.000000000 -0700
@@ -37,7 +37,7 @@
 #ifdef __KERNEL__
 
 #define SONYPI_DRIVER_MAJORVERSION	 1
-#define SONYPI_DRIVER_MINORVERSION	18
+#define SONYPI_DRIVER_MINORVERSION	20
 
 #define SONYPI_DEVICE_MODEL_TYPE1	1
 #define SONYPI_DEVICE_MODEL_TYPE2	2
@@ -335,6 +335,15 @@
 	unsigned char buf[SONYPI_BUF_SIZE];
 };
 
+/* We enable input subsystem event forwarding if the input 
+ * subsystem is compiled in, but only if sonypi is not into the
+ * kernel and input as a module... */
+#if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE)
+#if ! (defined(CONFIG_SONYPI) && defined(CONFIG_INPUT_MODULE))
+#define SONYPI_USE_INPUT
+#endif
+#endif
+
 /* The name of the Jog Dial for the input device drivers */
 #define SONYPI_INPUTNAME	"Sony VAIO Jog Dial"
 
@@ -351,7 +360,7 @@
 	struct sonypi_queue queue;
 	int open_count;
 	int model;
-#if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE)
+#ifdef SONYPI_USE_INPUT
 	struct input_dev jog_dev;
 #endif
 #ifdef CONFIG_PM
@@ -370,10 +379,20 @@
 		printk(KERN_WARNING "sonypi command failed at %s : %s (line %d)\n", __FILE__, __FUNCTION__, __LINE__); \
 }
 
-#ifndef CONFIG_ACPI
+#ifdef CONFIG_ACPI
+extern int acpi_disabled;
+#define SONYPI_ACPI_ACTIVE (!acpi_disabled)
+#else
+#define SONYPI_ACPI_ACTIVE 0
+#endif /* CONFIG_ACPI */
+
 extern int verbose;
 
-static inline int ec_write(u8 addr, u8 value) {
+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);
@@ -384,7 +403,11 @@
 	return 0;
 }
 
-static inline int ec_read(u8 addr, u8 *value) {
+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);
@@ -393,7 +416,6 @@
 	*value = inb_p(SONYPI_DATA_IOPORT);
 	return 0;
 }
-#endif /* !CONFIG_ACPI */
 
 #endif /* __KERNEL__ */
 
diff -urN linux-2.5.71-bk1/drivers/media/video/meye.c linux-2.5.71-bk2/drivers/media/video/meye.c
--- linux-2.5.71-bk1/drivers/media/video/meye.c	2003-06-14 12:18:23.000000000 -0700
+++ linux-2.5.71-bk2/drivers/media/video/meye.c	2003-06-16 04:45:34.000000000 -0700
@@ -167,9 +167,10 @@
 
 	memset(meye.mchip_ptable, 0, sizeof(meye.mchip_ptable));
 
-	meye.mchip_ptable[MCHIP_NB_PAGES] = pci_alloc_consistent(meye.mchip_dev, 
-								 PAGE_SIZE, 
-								 &meye.mchip_dmahandle);
+	meye.mchip_ptable[MCHIP_NB_PAGES] = dma_alloc_coherent(&meye.mchip_dev->dev, 
+							       PAGE_SIZE, 
+							       &meye.mchip_dmahandle,
+							       GFP_KERNEL);
 	if (!meye.mchip_ptable[MCHIP_NB_PAGES]) {
 		meye.mchip_dmahandle = 0;
 		return -1;
@@ -177,16 +178,17 @@
 
 	pt = (u32 *)meye.mchip_ptable[MCHIP_NB_PAGES];
 	for (i = 0; i < MCHIP_NB_PAGES; i++) {
-		meye.mchip_ptable[i] = pci_alloc_consistent(meye.mchip_dev, 
-							    PAGE_SIZE,
-							    pt);
+		meye.mchip_ptable[i] = dma_alloc_coherent(&meye.mchip_dev->dev, 
+							  PAGE_SIZE,
+							  pt,
+							  GFP_KERNEL);
 		if (!meye.mchip_ptable[i]) {
 			int j;
 			pt = (u32 *)meye.mchip_ptable[MCHIP_NB_PAGES];
 			for (j = 0; j < i; ++j) {
-				pci_free_consistent(meye.mchip_dev,
-						    PAGE_SIZE,
-						    meye.mchip_ptable[j], *pt);
+				dma_free_coherent(&meye.mchip_dev->dev,
+						  PAGE_SIZE,
+						  meye.mchip_ptable[j], *pt);
 				pt++;
 			}
 			meye.mchip_dmahandle = 0;
@@ -204,17 +206,17 @@
 	pt = (u32 *)meye.mchip_ptable[MCHIP_NB_PAGES];
 	for (i = 0; i < MCHIP_NB_PAGES; i++) {
 		if (meye.mchip_ptable[i])
-			pci_free_consistent(meye.mchip_dev, 
-					    PAGE_SIZE, 
-					    meye.mchip_ptable[i], *pt);
+			dma_free_coherent(&meye.mchip_dev->dev, 
+					  PAGE_SIZE, 
+					  meye.mchip_ptable[i], *pt);
 		pt++;
 	}
 
 	if (meye.mchip_ptable[MCHIP_NB_PAGES])
-		pci_free_consistent(meye.mchip_dev, 
-				    PAGE_SIZE, 
-				    meye.mchip_ptable[MCHIP_NB_PAGES], 
-				    meye.mchip_dmahandle);
+		dma_free_coherent(&meye.mchip_dev->dev, 
+				  PAGE_SIZE, 
+				  meye.mchip_ptable[MCHIP_NB_PAGES],
+				  meye.mchip_dmahandle);
 
 	memset(meye.mchip_ptable, 0, sizeof(meye.mchip_ptable));
 	meye.mchip_dmahandle = 0;
@@ -613,25 +615,25 @@
 /* stop any existing HIC action and wait for any dma to complete then
    reset the dma engine */
 static void mchip_hic_stop(void) {
-	int i = 0;
+	int i, j;
 
 	meye.mchip_mode = MCHIP_HIC_MODE_NOOP;
-	if (!(mchip_read(MCHIP_HIC_STATUS) & MCHIP_HIC_STATUS_BUSY)) 
+	if (!(mchip_read(MCHIP_HIC_STATUS) & MCHIP_HIC_STATUS_BUSY))
 		return;
-	mchip_set(MCHIP_HIC_CMD, MCHIP_HIC_CMD_STOP);
-	mchip_delay(MCHIP_HIC_CMD, 0);
-	while (!mchip_delay(MCHIP_HIC_STATUS, MCHIP_HIC_STATUS_IDLE)) {
-		/*  resetting HIC */
+	for (i = 0; i < 20; ++i) {
 		mchip_set(MCHIP_HIC_CMD, MCHIP_HIC_CMD_STOP);
 		mchip_delay(MCHIP_HIC_CMD, 0);
+		for (j = 0; j < 100; ++j) {
+			if (mchip_delay(MCHIP_HIC_STATUS, MCHIP_HIC_STATUS_IDLE))
+				return;
+			wait_ms(1);
+		}
+		printk(KERN_ERR "meye: need to reset HIC!\n");
+	
 		mchip_set(MCHIP_HIC_CTL, MCHIP_HIC_CTL_SOFT_RESET);
 		wait_ms(250);
-		if (i++ > 20) {
-			printk(KERN_ERR "meye: resetting HIC hanged!\n");
-			break;
-		}
 	}
-	wait_ms(100);
+	printk(KERN_ERR "meye: resetting HIC hanged!\n");
 }
 
 /****************************************************************************/
@@ -832,7 +834,7 @@
 /* Interrupt handling                                                       */
 /****************************************************************************/
 
-static void meye_irq(int irq, void *dev_id, struct pt_regs *regs) {
+static irqreturn_t meye_irq(int irq, void *dev_id, struct pt_regs *regs) {
 	u32 v;
 	int reqnr;
 	v = mchip_read(MCHIP_MM_INTA);
@@ -840,7 +842,7 @@
 	while (1) {
 		v = mchip_get_frame();
 		if (!(v & MCHIP_MM_FIR_RDY))
-			return;
+			return IRQ_NONE;
 		switch (meye.mchip_mode) {
 
 		case MCHIP_HIC_MODE_CONT_OUT:
@@ -873,11 +875,12 @@
 
 		default:
 			/* do not free frame, since it can be a snap */
-			return;
+			return IRQ_NONE;
 		} /* switch */
 
 		mchip_free_frame();
 	}
+	return IRQ_HANDLED;
 }
 
 /****************************************************************************/
@@ -1391,6 +1394,8 @@
 
 	mchip_hic_stop();
 
+	mchip_dma_free();
+
 	/* disable interrupts */
 	mchip_set(MCHIP_MM_INTA, 0x0);
 
@@ -1403,8 +1408,6 @@
 
 	pci_disable_device(meye.mchip_dev);
 
-	mchip_dma_free();
-
 	if (meye.grab_fbuffer)
 		rvfree(meye.grab_fbuffer, gbuffers*gbufsize);
 
diff -urN linux-2.5.71-bk1/drivers/media/video/meye.h linux-2.5.71-bk2/drivers/media/video/meye.h
--- linux-2.5.71-bk1/drivers/media/video/meye.h	2003-06-14 12:18:22.000000000 -0700
+++ linux-2.5.71-bk2/drivers/media/video/meye.h	2003-06-16 04:45:34.000000000 -0700
@@ -31,7 +31,7 @@
 #define _MEYE_PRIV_H_
 
 #define MEYE_DRIVER_MAJORVERSION	1
-#define MEYE_DRIVER_MINORVERSION	6
+#define MEYE_DRIVER_MINORVERSION	7
 
 #include <linux/config.h>
 #include <linux/types.h>
diff -urN linux-2.5.71-bk1/drivers/net/irda/ma600.c linux-2.5.71-bk2/drivers/net/irda/ma600.c
--- linux-2.5.71-bk1/drivers/net/irda/ma600.c	2003-06-14 12:18:09.000000000 -0700
+++ linux-2.5.71-bk2/drivers/net/irda/ma600.c	2003-06-16 04:45:34.000000000 -0700
@@ -52,7 +52,7 @@
 	if(!(expr)) { \
 	        printk( "Assertion failed! %s,%s,%s,line=%d\n",\
         	#expr,__FILE__,__FUNCTION__,__LINE__); \
-	        ##func}
+	        func}
 #endif
 
 /* convert hex value to ascii hex */
diff -urN linux-2.5.71-bk1/drivers/net/ppp_generic.c linux-2.5.71-bk2/drivers/net/ppp_generic.c
--- linux-2.5.71-bk1/drivers/net/ppp_generic.c	2003-06-14 12:18:34.000000000 -0700
+++ linux-2.5.71-bk2/drivers/net/ppp_generic.c	2003-06-16 04:45:35.000000000 -0700
@@ -2343,14 +2343,9 @@
 	dev = ppp->dev;
 	ppp->dev = 0;
 	ppp_unlock(ppp);
-	if (dev) {
-		rtnl_lock();
-
-		/* This will call dev_close() for us. */
-		unregister_netdevice(dev);
-
-		rtnl_unlock();
-	}
+	/* This will call dev_close() for us. */
+	if (dev)
+		unregister_netdev(dev);
 	cardmap_set(&all_ppp_units, ppp->file.index, NULL);
 	ppp->file.dead = 1;
 	ppp->owner = NULL;
diff -urN linux-2.5.71-bk1/drivers/net/slip.c linux-2.5.71-bk2/drivers/net/slip.c
--- linux-2.5.71-bk1/drivers/net/slip.c	2003-06-14 12:18:52.000000000 -0700
+++ linux-2.5.71-bk2/drivers/net/slip.c	2003-06-16 04:45:35.000000000 -0700
@@ -83,12 +83,7 @@
 
 #define SLIP_VERSION	"0.8.4-NET3.019-NEWTTY"
 
-
-typedef struct slip_ctrl {
-	struct slip	ctrl;		/* SLIP things			*/
-	struct net_device	dev;		/* the device			*/
-} slip_ctrl_t;
-static slip_ctrl_t	**slip_ctrls;
+static struct net_device **slip_devs;
 
 int slip_maxdev = SL_NRUNIT;		/* Can be overridden with insmod! */
 MODULE_PARM(slip_maxdev, "i");
@@ -624,32 +619,45 @@
 	 */
 
 	dev->mtu		= sl->mtu;
-	dev->hard_start_xmit	= sl_xmit;
+	dev->type		= ARPHRD_SLIP + sl->mode;
 #ifdef SL_CHECK_TRANSMIT
 	dev->tx_timeout		= sl_tx_timeout;
 	dev->watchdog_timeo	= 20*HZ;
 #endif
+	return 0;
+}
+
+
+static void sl_uninit(struct net_device *dev)
+{
+	struct slip *sl = (struct slip*)(dev->priv);
+
+	sl_free_bufs(sl);
+}
+
+static void sl_setup(struct net_device *dev)
+{
+	dev->init		= sl_init;
+	dev->uninit	  	= sl_uninit;
 	dev->open		= sl_open;
+	dev->destructor		= (void (*)(struct net_device *))kfree;
 	dev->stop		= sl_close;
 	dev->get_stats	        = sl_get_stats;
 	dev->change_mtu		= sl_change_mtu;
+	dev->hard_start_xmit	= sl_xmit;
 #ifdef CONFIG_SLIP_SMART
 	dev->do_ioctl		= sl_ioctl;
 #endif
 	dev->hard_header_len	= 0;
 	dev->addr_len		= 0;
-	dev->type		= ARPHRD_SLIP + sl->mode;
 	dev->tx_queue_len	= 10;
 
 	SET_MODULE_OWNER(dev);
 
 	/* New-style flags. */
 	dev->flags		= IFF_NOARP|IFF_POINTOPOINT|IFF_MULTICAST;
-
-	return 0;
 }
 
-
 /******************************************
   Routines looking at TTY side.
  ******************************************/
@@ -702,52 +710,57 @@
 static void sl_sync(void)
 {
 	int i;
+	struct net_device *dev;
+	struct slip	  *sl;
 
 	for (i = 0; i < slip_maxdev; i++) {
-		slip_ctrl_t *slp = slip_ctrls[i];
-		if (slp == NULL)
+		if ((dev = slip_devs[i]) == NULL)
 			break;
-		if (slp->ctrl.tty || slp->ctrl.leased)
+
+		sl = dev->priv;
+		if (sl->tty || sl->leased)
 			continue;
-		if (slp->dev.flags&IFF_UP)
-			dev_close(&slp->dev);
+		if (dev->flags&IFF_UP)
+			dev_close(dev);
 	}
 }
 
+
 /* Find a free SLIP channel, and link in this `tty' line. */
 static struct slip *
 sl_alloc(dev_t line)
 {
-	struct slip *sl;
-	slip_ctrl_t *slp = NULL;
 	int i;
 	int sel = -1;
 	int score = -1;
+	struct net_device *dev = NULL;
+	struct slip       *sl;
 
-	if (slip_ctrls == NULL)
+	if (slip_devs == NULL) 
 		return NULL;	/* Master array missing ! */
 
 	for (i = 0; i < slip_maxdev; i++) {
-		slp = slip_ctrls[i];
-		if (slp == NULL)
+		dev = slip_devs[i];
+		if (dev == NULL)
 			break;
 
-		if (slp->ctrl.leased) {
-			if (slp->ctrl.line != line)
+		sl = dev->priv;
+		if (sl->leased) {
+			if (sl->line != line)
 				continue;
-			if (slp->ctrl.tty)
+			if (sl->tty)
 				return NULL;
 
 			/* Clear ESCAPE & ERROR flags */
-			slp->ctrl.flags &= (1 << SLF_INUSE);
-			return &slp->ctrl;
+			sl->flags &= (1 << SLF_INUSE);
+			return sl;
 		}
 
-		if (slp->ctrl.tty)
+		if (sl->tty)
 			continue;
 
-		if (current->pid == slp->ctrl.pid) {
-			if (slp->ctrl.line == line && score < 3) {
+		if (current->pid == sl->pid) {
+			if (sl->line == line && score < 3) {
 				sel = i;
 				score = 3;
 				continue;
@@ -758,7 +771,7 @@
 			}
 			continue;
 		}
-		if (slp->ctrl.line == line && score < 1) {
+		if (sl->line == line && score < 1) {
 			sel = i;
 			score = 1;
 			continue;
@@ -771,10 +784,11 @@
 
 	if (sel >= 0) {
 		i = sel;
-		slp = slip_ctrls[i];
+		dev = slip_devs[i];
 		if (score > 1) {
-			slp->ctrl.flags &= (1 << SLF_INUSE);
-			return &slp->ctrl;
+			sl = dev->priv;
+			sl->flags &= (1 << SLF_INUSE);
+			return sl;
 		}
 	}
 
@@ -782,26 +796,32 @@
 	if (i >= slip_maxdev)
 		return NULL;
 
-	if (slp) {
-		if (test_bit(SLF_INUSE, &slp->ctrl.flags)) {
-			unregister_netdevice(&slp->dev);
-			sl_free_bufs(&slp->ctrl);
+	if (dev) {
+		sl = dev->priv;
+		if (test_bit(SLF_INUSE, &sl->flags)) {
+			unregister_netdevice(dev);
+			dev = NULL;
+			slip_devs[i] = NULL;
 		}
-	} else if ((slp = (slip_ctrl_t *)kmalloc(sizeof(slip_ctrl_t),GFP_KERNEL)) == NULL)
-		return NULL;
+	}
+	
+	if (!dev) {
+		char name[IFNAMSIZ];
+		sprintf(name, "sl%d", i);
 
-	memset(slp, 0, sizeof(slip_ctrl_t));
+		dev = alloc_netdev(sizeof(*sl), name, sl_setup);
+		if (!dev)
+			return NULL;
+		dev->base_addr  = i;
+	}
+
+	sl = dev->priv;
 
-	sl = &slp->ctrl;
 	/* Initialize channel control data */
 	sl->magic       = SLIP_MAGIC;
-	sl->dev	      	= &slp->dev;
+	sl->dev	      	= dev;
 	spin_lock_init(&sl->lock);
 	sl->mode        = SL_MODE_DEFAULT;
-	sprintf(slp->dev.name, "sl%d", i);
-	slp->dev.base_addr    = i;
-	slp->dev.priv         = (void*)sl;
-	slp->dev.init         = sl_init;
 #ifdef CONFIG_SLIP_SMART
 	init_timer(&sl->keepalive_timer);	/* initialize timer_list struct */
 	sl->keepalive_timer.data=(unsigned long)sl;
@@ -810,8 +830,9 @@
 	sl->outfill_timer.data=(unsigned long)sl;
 	sl->outfill_timer.function=sl_outfill;
 #endif
-	slip_ctrls[i] 	      = slp;
-	return &slp->ctrl;
+	slip_devs[i] = dev;
+				   
+	return sl;
 }
 
 /*
@@ -865,12 +886,10 @@
 		if ((err = sl_alloc_bufs(sl, SL_MTU)) != 0)
 			goto err_free_chan;
 
-		if (register_netdevice(sl->dev)) {
-			sl_free_bufs(sl);
-			goto err_free_chan;
-		}
-
 		set_bit(SLF_INUSE, &sl->flags);
+
+		if ((err = register_netdevice(sl->dev)))
+			goto err_free_bufs;
 	}
 
 #ifdef CONFIG_SLIP_SMART
@@ -888,6 +907,9 @@
 	rtnl_unlock();
 	return sl->dev->base_addr;
 
+err_free_bufs:
+	sl_free_bufs(sl);
+
 err_free_chan:
 	sl->tty = NULL;
 	tty->disc_data = NULL;
@@ -1335,14 +1357,14 @@
 	printk(KERN_INFO "SLIP linefill/keepalive option.\n");
 #endif
 
-	slip_ctrls = kmalloc(sizeof(void*)*slip_maxdev, GFP_KERNEL);
-	if (!slip_ctrls) {
-		printk(KERN_ERR "SLIP: Can't allocate slip_ctrls[] array!  Uaargh! (-> No SLIP available)\n");
+	slip_devs = kmalloc(sizeof(struct net_device *)*slip_maxdev, GFP_KERNEL);
+	if (!slip_devs) {
+		printk(KERN_ERR "SLIP: Can't allocate slip devices array!  Uaargh! (-> No SLIP available)\n");
 		return -ENOMEM;
 	}
 
 	/* Clear the pointer array, we allocate devices when we need them */
-	memset(slip_ctrls, 0, sizeof(void*)*slip_maxdev); /* Pointers */
+	memset(slip_devs, 0, sizeof(struct net_device *)*slip_maxdev); 
 
 	/* Fill in our line protocol discipline, and register it */
 	if ((status = tty_register_ldisc(N_SLIP, &sl_ldisc)) != 0)  {
@@ -1354,51 +1376,59 @@
 static void __exit slip_exit(void)
 {
 	int i;
+	struct net_device *dev;
+	struct slip *sl;
+	unsigned long timeout = jiffies + HZ;
+	int busy = 0;
 
-	if (slip_ctrls != NULL) {
-		unsigned long timeout = jiffies + HZ;
-		int busy = 0;
+	if (slip_devs == NULL) 
+		return;
 
-		/* First of all: check for active disciplines and hangup them.
-		 */
-		do {
-			if (busy)
-				yield();
-
-			busy = 0;
-			local_bh_disable();
-			for (i = 0; i < slip_maxdev; i++) {
-				struct slip_ctrl *slc = slip_ctrls[i];
-				if (!slc)
-					continue;
-				spin_lock(&slc->ctrl.lock);
-				if (slc->ctrl.tty) {
-					busy++;
-					tty_hangup(slc->ctrl.tty);
-				}
-				spin_unlock(&slc->ctrl.lock);
-			}
-			local_bh_enable();
-		} while (busy && time_before(jiffies, timeout));
+	/* First of all: check for active disciplines and hangup them.
+	 */
+	do {
+		if (busy) {
+			current->state = TASK_INTERRUPTIBLE;
+			schedule_timeout(HZ / 10);
+			current->state = TASK_RUNNING;
+		}
 
+		busy = 0;
 		for (i = 0; i < slip_maxdev; i++) {
-			struct slip_ctrl *slc = slip_ctrls[i];
-			if (slc) {
-				unregister_netdev(&slc->dev);
-				if (slc->ctrl.tty) {
-					printk(KERN_ERR "%s: tty discipline is still running\n", slc->dev.name);
-					/* Intentionally leak the control block. */
-				} else {
-					sl_free_bufs(&slc->ctrl);
-					kfree(slc);
-				}
-				slip_ctrls[i] = NULL;
+			dev = slip_devs[i];
+			if (!dev)
+				continue;
+			sl = dev->priv;
+			spin_lock_bh(&sl->lock);
+			if (sl->tty) {
+				busy++;
+				tty_hangup(sl->tty);
 			}
+			spin_unlock_bh(&sl->lock);
 		}
+	} while (busy && time_before(jiffies, timeout));
+
+
+	for (i = 0; i < slip_maxdev; i++) {
+		dev = slip_devs[i];
+		if (!dev)
+			continue;
+		slip_devs[i] = NULL;
+
+		sl = dev->priv;
+		if (sl->tty) {
+			printk(KERN_ERR "%s: tty discipline still running\n",
+			       dev->name);
+			/* Intentionally leak the control block. */
+			dev->destructor = NULL;
+		} 
 
-		kfree(slip_ctrls);
-		slip_ctrls = NULL;
+		unregister_netdev(dev);
 	}
+
+	kfree(slip_devs);
+	slip_devs = NULL;
+
 	if ((i = tty_register_ldisc(N_SLIP, NULL)))
 	{
 		printk(KERN_ERR "SLIP: can't unregister line discipline (err = %d)\n", i);
diff -urN linux-2.5.71-bk1/drivers/parisc/Kconfig linux-2.5.71-bk2/drivers/parisc/Kconfig
--- linux-2.5.71-bk1/drivers/parisc/Kconfig	2003-06-14 12:18:24.000000000 -0700
+++ linux-2.5.71-bk2/drivers/parisc/Kconfig	2003-06-16 04:45:35.000000000 -0700
@@ -125,4 +125,27 @@
 	
 	  If unsure, say Y.
 
+config HOTPLUG
+	bool "Support for hot-pluggable devices"
+	---help---
+	  Say Y here if you want to plug devices into your computer while
+	  the system is running, and be able to use them quickly.  In many
+	  cases, the devices can likewise be unplugged at any time too.
+
+	  One well known example of this is PCMCIA- or PC-cards, credit-card
+	  size devices such as network cards, modems or hard drives which are
+	  plugged into slots found on all modern laptop computers.  Another
+	  example, used on modern desktops as well as laptops, is USB.
+
+	  Enable HOTPLUG and KMOD, and build a modular kernel.  Get agent
+	  software (at <http://linux-hotplug.sourceforge.net/>) and install it.
+	  Then your kernel will automatically call out to a user mode "policy
+	  agent" (/sbin/hotplug) to load modules and set up software needed
+	  to use devices as you hotplug them.
+
+source "drivers/pcmcia/Kconfig"
+
+source "drivers/pci/hotplug/Kconfig"
+
+
 endmenu
diff -urN linux-2.5.71-bk1/drivers/parisc/dino.c linux-2.5.71-bk2/drivers/parisc/dino.c
--- linux-2.5.71-bk1/drivers/parisc/dino.c	2003-06-14 12:17:57.000000000 -0700
+++ linux-2.5.71-bk2/drivers/parisc/dino.c	2003-06-16 04:45:35.000000000 -0700
@@ -381,7 +381,7 @@
  * ilr_loop counter is a kluge to prevent a "stuck" IRQ line from
  * wedging the CPU. Could be removed or made optional at some point.
  */
-static void
+static irqreturn_t
 dino_isr(int irq, void *intr_dev, struct pt_regs *regs)
 {
 	struct dino_device *dino_dev = DINO_DEV(intr_dev);
@@ -441,7 +441,9 @@
 		if (--ilr_loop > 0)
 			goto ilr_again;
 		printk("Dino %lx: stuck interrupt %d\n", dino_dev->hba.base_addr, mask);
+		return IRQ_NONE;
 	}
+	return IRQ_HANDLED;
 }
 
 static int dino_choose_irq(struct parisc_device *dev)
diff -urN linux-2.5.71-bk1/drivers/parisc/eisa.c linux-2.5.71-bk2/drivers/parisc/eisa.c
--- linux-2.5.71-bk1/drivers/parisc/eisa.c	2003-06-14 12:17:56.000000000 -0700
+++ linux-2.5.71-bk2/drivers/parisc/eisa.c	2003-06-16 04:45:35.000000000 -0700
@@ -213,7 +213,7 @@
 	.action	= action,
 };
 
-static void eisa_irq(int _, void *intr_dev, struct pt_regs *regs)
+static irqreturn_t eisa_irq(int _, void *intr_dev, struct pt_regs *regs)
 {
 	extern void do_irq(struct irqaction *a, int i, struct pt_regs *p);
 	int irq = gsc_readb(0xfc01f000); /* EISA supports 16 irqs */
@@ -262,11 +262,13 @@
 		eisa_out8(master_mask, 0x21);
 	}
 	spin_unlock_irqrestore(&eisa_irq_lock, flags);
+	return IRQ_HANDLED;
 }
 
-static void dummy_irq2_handler(int _, void *dev, struct pt_regs *regs)
+static irqreturn_t dummy_irq2_handler(int _, void *dev, struct pt_regs *regs)
 {
 	printk(KERN_ALERT "eisa: uhh, irq2?\n");
+	return IRQ_HANDLED;
 }
 
 static void init_eisa_pic(void)
diff -urN linux-2.5.71-bk1/drivers/parisc/eisa_eeprom.c linux-2.5.71-bk2/drivers/parisc/eisa_eeprom.c
--- linux-2.5.71-bk1/drivers/parisc/eisa_eeprom.c	2003-06-14 12:18:32.000000000 -0700
+++ linux-2.5.71-bk2/drivers/parisc/eisa_eeprom.c	2003-06-16 04:45:35.000000000 -0700
@@ -4,6 +4,7 @@
 #include <linux/kernel.h>
 #include <linux/miscdevice.h>
 #include <linux/slab.h>
+#include <linux/fs.h>
 #include <asm/io.h>
 #include <asm/uaccess.h>
 #include <asm/eisa_eeprom.h>
diff -urN linux-2.5.71-bk1/drivers/parisc/gsc.c linux-2.5.71-bk2/drivers/parisc/gsc.c
--- linux-2.5.71-bk1/drivers/parisc/gsc.c	2003-06-14 12:18:34.000000000 -0700
+++ linux-2.5.71-bk2/drivers/parisc/gsc.c	2003-06-16 04:45:35.000000000 -0700
@@ -79,7 +79,7 @@
 #define GSC_MASK_IRQ(x)	(1<<(GSC_FIX_IRQ(x)))
 
 /* Common interrupt demultiplexer used by Asp, Lasi & Wax.  */
-void busdev_barked(int busdev_irq, void *dev, struct pt_regs *regs)
+irqreturn_t busdev_barked(int busdev_irq, void *dev, struct pt_regs *regs)
 {
 	unsigned long irq;
 	struct busdevice *busdev = (struct busdevice *) dev;
@@ -101,6 +101,7 @@
 
 		do_irq_mask(irq, busdev->busdev_region, regs);
 	}
+	return IRQ_HANDLED;
 }
 
 static void
diff -urN linux-2.5.71-bk1/drivers/parisc/gsc.h linux-2.5.71-bk2/drivers/parisc/gsc.h
--- linux-2.5.71-bk1/drivers/parisc/gsc.h	2003-06-14 12:17:58.000000000 -0700
+++ linux-2.5.71-bk2/drivers/parisc/gsc.h	2003-06-16 04:45:35.000000000 -0700
@@ -43,4 +43,4 @@
 extern int gsc_alloc_irq(struct gsc_irq *dev);	/* dev needs an irq */
 extern int gsc_claim_irq(struct gsc_irq *dev, int irq);	/* dev needs this irq */
 
-void busdev_barked(int busdev_irq, void *dev, struct pt_regs *regs);
+irqreturn_t busdev_barked(int busdev_irq, void *dev, struct pt_regs *regs);
diff -urN linux-2.5.71-bk1/drivers/parisc/iosapic.c linux-2.5.71-bk2/drivers/parisc/iosapic.c
--- linux-2.5.71-bk1/drivers/parisc/iosapic.c	2003-06-14 12:17:59.000000000 -0700
+++ linux-2.5.71-bk2/drivers/parisc/iosapic.c	2003-06-16 04:45:35.000000000 -0700
@@ -605,7 +605,7 @@
 }
 
 
-static void
+static irqreturn_t
 iosapic_interrupt(int irq, void *dev_id, struct pt_regs * regs)
 {
 	struct vector_info *vi = (struct vector_info *)dev_id;
@@ -623,6 +623,8 @@
 	** I/O SAPIC must always issue EOI.
 	*/
 	IOSAPIC_EOI(vi->vi_eoi_addr, vi->vi_eoi_data);
+
+	return IRQ_HANDLED;
 }
 
 
diff -urN linux-2.5.71-bk1/drivers/parisc/led.c linux-2.5.71-bk2/drivers/parisc/led.c
--- linux-2.5.71-bk1/drivers/parisc/led.c	2003-06-14 12:18:06.000000000 -0700
+++ linux-2.5.71-bk2/drivers/parisc/led.c	2003-06-16 04:45:35.000000000 -0700
@@ -3,7 +3,7 @@
  *
  *      (c) Copyright 2000 Red Hat Software
  *      (c) Copyright 2000 Helge Deller <hdeller@redhat.com>
- *      (c) Copyright 2001-2002 Helge Deller <deller@gmx.de>
+ *      (c) Copyright 2001-2003 Helge Deller <deller@gmx.de>
  *      (c) Copyright 2001 Randolph Chung <tausq@debian.org>
  *
  *      This program is free software; you can redistribute it and/or modify
@@ -13,7 +13,7 @@
  *
  * TODO:
  *	- speed-up calculations with inlined assembler
- *	- interface to write to second row of LCD from /proc
+ *	- interface to write to second row of LCD from /proc (if technically possible)
  */
 
 #include <linux/config.h>
@@ -22,10 +22,11 @@
 #include <linux/init.h>
 #include <linux/types.h>
 #include <linux/ioport.h>
-#include <linux/bitops.h>
 #include <linux/version.h>
 #include <linux/delay.h>
 #include <linux/netdevice.h>
+#include <linux/inetdevice.h>
+#include <linux/in.h>
 #include <linux/interrupt.h>
 #include <linux/kernel_stat.h>
 #include <linux/reboot.h>
@@ -59,10 +60,6 @@
 #endif
 
 
-#define CALC_ADD(val, comp, add) \
- (val<=(comp/8) ? add/16 : val<=(comp/4) ? add/8 : val<=(comp/2) ? add/4 : add)
-
-
 struct lcd_block {
 	unsigned char command;	/* stores the command byte      */
 	unsigned char on;	/* value for turning LED on     */
@@ -341,93 +338,81 @@
 
 /*
    ** 
-   ** led_get_net_stats()
+   ** led_get_net_activity()
    ** 
-   ** calculate the TX- & RX-troughput on the network interfaces in
-   ** the system for usage in the LED code
-   **
+   ** calculate if there was TX- or RX-troughput on the network interfaces
    ** (analog to dev_get_info() from net/core/dev.c)
    **   
  */
-static unsigned long led_net_rx_counter, led_net_tx_counter;
-
-static void led_get_net_stats(int addvalue)
+static __inline__ int led_get_net_activity(void)
 { 
-#ifdef CONFIG_NET
+#ifndef CONFIG_NET
+	return 0;
+#else
 	static unsigned long rx_total_last, tx_total_last;
 	unsigned long rx_total, tx_total;
 	struct net_device *dev;
-	struct net_device_stats *stats;
+	int retval;
 
 	rx_total = tx_total = 0;
 	
-	/* we are running as a tasklet, so locking dev_base 
+	/* we are running as tasklet, so locking dev_base 
 	 * for reading should be OK */
 	read_lock(&dev_base_lock);
-	for (dev = dev_base; dev != NULL; dev = dev->next) {
-	    if (dev->get_stats) { 
-	        stats = dev->get_stats(dev);
-		rx_total += stats->rx_packets;
-		tx_total += stats->tx_packets;
-	    }
+	for (dev = dev_base; dev; dev = dev->next) {
+	    struct net_device_stats *stats;
+	    struct in_device *in_dev = __in_dev_get(dev);
+	    if (!in_dev || !in_dev->ifa_list)
+		continue;
+	    if (LOOPBACK(in_dev->ifa_list->ifa_local))
+		continue;
+	    if (!dev->get_stats) 
+		continue;
+	    stats = dev->get_stats(dev);
+	    rx_total += stats->rx_packets;
+	    tx_total += stats->tx_packets;
 	}
 	read_unlock(&dev_base_lock);
 
-	rx_total -= rx_total_last;
-	tx_total -= tx_total_last;
-	
-	if (rx_total)
-	    led_net_rx_counter += CALC_ADD(rx_total, tx_total, addvalue);
+	retval = 0;
 
-	if (tx_total)
-	    led_net_tx_counter += CALC_ADD(tx_total, rx_total, addvalue);
-        
-	rx_total_last += rx_total;
-        tx_total_last += tx_total;
+	if (rx_total != rx_total_last) {
+		rx_total_last = rx_total;
+		retval |= LED_LAN_RCV;
+	}
+
+	if (tx_total != tx_total_last) {
+		tx_total_last = tx_total;
+		retval |= LED_LAN_TX;
+	}
+
+	return retval;
 #endif
 }
 
 
 /*
    ** 
-   ** led_get_diskio_stats()
+   ** led_get_diskio_activity()
    ** 
-   ** calculate the disk-io througput in the system
-   ** (analog to linux/fs/proc/proc_misc.c)
+   ** calculate if there was disk-io in the system
    **   
  */
-static unsigned long led_diskio_counter;
-
-static void led_get_diskio_stats(int addvalue)
+static __inline__ int led_get_diskio_activity(void)
 {	
-	static unsigned int diskio_total_last, diskio_max;
-	int major, disk, total;
+	static unsigned long last_pgpgin, last_pgpgout;
+	struct page_state pgstat;
+	int changed;
+	
+	get_full_page_state(&pgstat); /* get no of sectors in & out */
+
+	/* Just use a very simple calculation here. Do not care about overflow,
+	   since we only want to know if there was activity or not. */
+	changed = (pgstat.pgpgin != last_pgpgin) || (pgstat.pgpgout != last_pgpgout);
+	last_pgpgin  = pgstat.pgpgin;
+	last_pgpgout = pgstat.pgpgout;
 	
-	total = 0;
-#if 0
-	/*
-	 * this section will no longer work in 2.5, as we no longer
-	 * have either kstat.dk_drive nor DK_MAX_*.  It can probably
-	 * be rewritten to use the per-disk statistics now kept in the
-	 * gendisk, but since I have no HP machines to test it on, I'm
-	 * not really up to that.  ricklind@us.ibm.com 11/7/02
-	 */
-	for (major = 0; major < DK_MAX_MAJOR; major++) {
-	    for (disk = 0; disk < DK_MAX_DISK; disk++)
-		total += dkstat.drive[major][disk];
-	}
-	total -= diskio_total_last;
-	
-	if (total) {
-	    if (total >= diskio_max) {
-		led_diskio_counter += addvalue;
-	        diskio_max = total; /* new maximum value found */ 
-	    } else
-		led_diskio_counter += CALC_ADD(total, diskio_max, addvalue);
-	}
-#endif
-	
-	diskio_total_last += total; 
+	return (changed ? LED_DISK_IO : 0);
 }
 
 
@@ -443,16 +428,23 @@
     - optimizations
  */
 
-static unsigned char currentleds;	/* stores current value of the LEDs */
-
 #define HEARTBEAT_LEN (HZ*6/100)
 #define HEARTBEAT_2ND_RANGE_START (HZ*22/100)
 #define HEARTBEAT_2ND_RANGE_END   (HEARTBEAT_2ND_RANGE_START + HEARTBEAT_LEN)
 
+#if HZ==100
+ #define NORMALIZED_COUNT(count) (count)
+#else
+ #warning "Untested situation HZ != 100 !!"
+ #define NORMALIZED_COUNT(count) (count/(HZ/100))
+#endif
+
 static void led_tasklet_func(unsigned long unused)
 {
-	static unsigned int count, count_HZ;
 	static unsigned char lastleds;
+	unsigned char currentleds; /* stores current value of the LEDs */
+	static unsigned long count; /* static incremented value, not wrapped */
+	static unsigned long count_HZ; /* counter in range 0..HZ */
 
 	/* exit if not initialized */
 	if (!led_func_ptr)
@@ -463,6 +455,8 @@
 	if (++count_HZ == HZ)
 	    count_HZ = 0;
 
+	currentleds = lastleds;
+
 	if (led_heartbeat)
 	{
 		/* flash heartbeat-LED like a real heart (2 x short then a long delay) */
@@ -473,42 +467,25 @@
 		    currentleds &= ~LED_HEARTBEAT;
 	}
 
-	/* gather network and diskio statistics and flash LEDs respectively */
-
-	if (led_lanrxtx)
+	/* look for network activity and flash LEDs respectively */
+	if (led_lanrxtx && ((NORMALIZED_COUNT(count)+(8/2)) & 7) == 0)
 	{
-		if ((count & 31) == 0)
-			led_get_net_stats(30);
-
-		if (led_net_rx_counter) {
-			led_net_rx_counter--;
-			currentleds |= LED_LAN_RCV;
-		}
-		else    
-			currentleds &= ~LED_LAN_RCV;
-
-		if (led_net_tx_counter) {
-			led_net_tx_counter--;
-			currentleds |= LED_LAN_TX;
-		}
-		else    
-			currentleds &= ~LED_LAN_TX;
+		currentleds &= ~(LED_LAN_RCV | LED_LAN_TX);
+		currentleds |= led_get_net_activity();
 	}
 
-	if (led_diskio)
+	/* avoid to calculate diskio-stats at same irq  as netio-stats */
+	if (led_diskio && (NORMALIZED_COUNT(count) & 7) == 0)
 	{
-		/* avoid to calculate diskio-stats at same irq as netio-stats ! */
-		if ((count & 31) == 15) 
-			led_get_diskio_stats(30);
-
-		if (led_diskio_counter) {
-			led_diskio_counter--;
-			currentleds |= LED_DISK_IO;
-		}
-		else    
-			currentleds &= ~LED_DISK_IO;
+		currentleds &= ~LED_DISK_IO;
+		currentleds |= led_get_diskio_activity();
 	}
 
+	/* blink all LEDs twice a second if we got an Oops (HPMC) */
+	if (oops_in_progress) {
+		currentleds = (count_HZ<=(HZ/2)) ? 0 : 0xff;
+	}
+	
 	/* update the LCD/LEDs */
 	if (currentleds != lastleds) {
 	    led_func_ptr(currentleds);
diff -urN linux-2.5.71-bk1/drivers/parisc/superio.c linux-2.5.71-bk2/drivers/parisc/superio.c
--- linux-2.5.71-bk1/drivers/parisc/superio.c	2003-06-14 12:18:25.000000000 -0700
+++ linux-2.5.71-bk2/drivers/parisc/superio.c	2003-06-16 04:45:35.000000000 -0700
@@ -90,7 +90,7 @@
     sio_dev.iosapic_irq = irq;
 }
 
-static void
+static irqreturn_t
 superio_interrupt(int irq, void *devp, struct pt_regs *regs)
 {
 	struct superio_device *sio = (struct superio_device *)devp;
@@ -107,7 +107,7 @@
 		/* HACK: need to investigate why this happens if SMP enabled */
 		BUG(); /* This shouldn't happen */
 #endif
-		return;
+		return IRQ_HANDLED;
 	}
 
 	/* Check to see which device is interrupting */
@@ -117,7 +117,7 @@
 	if (local_irq == 2 || local_irq > 7) {
 		printk(KERN_ERR "SuperIO: slave interrupted!\n");
 		BUG();
-		return;
+		return IRQ_HANDLED;
 	}
 
 	if (local_irq == 7) {
@@ -128,7 +128,7 @@
 		results = inb(IC_PIC1+0);
 		if ((results & 0x80) == 0) { /* if ISR7 not set: spurious */
 			printk(KERN_WARNING "SuperIO: spurious interrupt!\n");
-			return;
+			return IRQ_HANDLED;
 		}
 	}
 
@@ -141,7 +141,7 @@
 	/* set EOI */
 
 	outb((OCW2_SEOI|local_irq),IC_PIC1 + 0);
-	return;
+	return IRQ_HANDLED;
 }
 
 /* Initialize Super I/O device */
diff -urN linux-2.5.71-bk1/drivers/parport/parport_gsc.c linux-2.5.71-bk2/drivers/parport/parport_gsc.c
--- linux-2.5.71-bk1/drivers/parport/parport_gsc.c	2003-06-14 12:18:33.000000000 -0700
+++ linux-2.5.71-bk2/drivers/parport/parport_gsc.c	2003-06-16 04:45:35.000000000 -0700
@@ -81,9 +81,10 @@
  * of these are in parport_gsc.h.
  */
 
-static void parport_gsc_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t parport_gsc_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 {
 	parport_generic_irq(irq, (struct parport *) dev_id, regs);
+	return IRQ_HANDLED;
 }
 
 void parport_gsc_write_data(struct parport *p, unsigned char d)
diff -urN linux-2.5.71-bk1/drivers/pcmcia/bulkmem.c linux-2.5.71-bk2/drivers/pcmcia/bulkmem.c
--- linux-2.5.71-bk1/drivers/pcmcia/bulkmem.c	2003-06-14 12:18:52.000000000 -0700
+++ linux-2.5.71-bk2/drivers/pcmcia/bulkmem.c	2003-06-16 04:45:35.000000000 -0700
@@ -39,7 +39,6 @@
 #include <linux/mm.h>
 #include <linux/sched.h>
 #include <linux/timer.h>
-#include <linux/proc_fs.h>
 
 #define IN_CARD_SERVICES
 #include <pcmcia/cs_types.h>
diff -urN linux-2.5.71-bk1/drivers/pcmcia/cardbus.c linux-2.5.71-bk2/drivers/pcmcia/cardbus.c
--- linux-2.5.71-bk1/drivers/pcmcia/cardbus.c	2003-06-14 12:18:04.000000000 -0700
+++ linux-2.5.71-bk2/drivers/pcmcia/cardbus.c	2003-06-16 04:45:35.000000000 -0700
@@ -169,7 +169,7 @@
 
 	DEBUG(3, "cs: read_cb_mem(%d, %#x, %u)\n", space, addr, len);
 
-	dev = pci_find_slot(s->cap.cb_dev->subordinate->number, 0);
+	dev = pci_find_slot(s->cb_dev->subordinate->number, 0);
 	if (!dev)
 		goto fail;
 
@@ -239,7 +239,7 @@
 
 int cb_alloc(struct pcmcia_socket * s)
 {
-	struct pci_bus *bus = s->cap.cb_dev->subordinate;
+	struct pci_bus *bus = s->cb_dev->subordinate;
 	struct pci_dev *dev;
 	unsigned int max, pass;
 
@@ -258,17 +258,17 @@
 	 */
 	pci_bus_size_bridges(bus);
 	pci_bus_assign_resources(bus);
-	cardbus_assign_irqs(bus, s->cap.pci_irq);
+	cardbus_assign_irqs(bus, s->pci_irq);
 	pci_enable_bridges(bus);
 	pci_bus_add_devices(bus);
 
-	s->irq.AssignedIRQ = s->cap.pci_irq;
+	s->irq.AssignedIRQ = s->pci_irq;
 	return CS_SUCCESS;
 }
 
 void cb_free(struct pcmcia_socket * s)
 {
-	struct pci_dev *bridge = s->cap.cb_dev;
+	struct pci_dev *bridge = s->cb_dev;
 
 	cb_release_cis_mem(s);
 
diff -urN linux-2.5.71-bk1/drivers/pcmcia/cistpl.c linux-2.5.71-bk2/drivers/pcmcia/cistpl.c
--- linux-2.5.71-bk1/drivers/pcmcia/cistpl.c	2003-06-14 12:18:06.000000000 -0700
+++ linux-2.5.71-bk2/drivers/pcmcia/cistpl.c	2003-06-16 04:45:35.000000000 -0700
@@ -87,8 +87,8 @@
     if (s->cis_mem.sys_start != 0) {
 	s->cis_mem.flags &= ~MAP_ACTIVE;
 	s->ss_entry->set_mem_map(s, &s->cis_mem);
-	if (!(s->cap.features & SS_CAP_STATIC_MAP))
-	    release_mem_region(s->cis_mem.sys_start, s->cap.map_size);
+	if (!(s->features & SS_CAP_STATIC_MAP))
+	    release_mem_region(s->cis_mem.sys_start, s->map_size);
 	iounmap(s->cis_virt);
 	s->cis_mem.sys_start = 0;
 	s->cis_virt = NULL;
@@ -104,26 +104,26 @@
 set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flags)
 {
     pccard_mem_map *mem = &s->cis_mem;
-    if (!(s->cap.features & SS_CAP_STATIC_MAP) &&
+    if (!(s->features & SS_CAP_STATIC_MAP) &&
 	mem->sys_start == 0) {
-	int low = !(s->cap.features & SS_CAP_PAGE_REGS);
+	int low = !(s->features & SS_CAP_PAGE_REGS);
 	validate_mem(s);
 	mem->sys_start = 0;
-	if (find_mem_region(&mem->sys_start, s->cap.map_size,
-			    s->cap.map_size, low, "card services", s)) {
+	if (find_mem_region(&mem->sys_start, s->map_size,
+			    s->map_size, low, "card services", s)) {
 	    printk(KERN_NOTICE "cs: unable to map card memory!\n");
 	    return NULL;
 	}
-	mem->sys_stop = mem->sys_start+s->cap.map_size-1;
-	s->cis_virt = ioremap(mem->sys_start, s->cap.map_size);
+	mem->sys_stop = mem->sys_start+s->map_size-1;
+	s->cis_virt = ioremap(mem->sys_start, s->map_size);
     }
     mem->card_start = card_offset;
     mem->flags = flags;
     s->ss_entry->set_mem_map(s, mem);
-    if (s->cap.features & SS_CAP_STATIC_MAP) {
+    if (s->features & SS_CAP_STATIC_MAP) {
 	if (s->cis_virt)
 	    iounmap(s->cis_virt);
-	s->cis_virt = ioremap(mem->sys_start, s->cap.map_size);
+	s->cis_virt = ioremap(mem->sys_start, s->map_size);
     }
     return s->cis_virt;
 }
@@ -178,21 +178,21 @@
 	    addr *= 2;
 	}
 
-	card_offset = addr & ~(s->cap.map_size-1);
+	card_offset = addr & ~(s->map_size-1);
 	while (len) {
 	    sys = set_cis_map(s, card_offset, flags);
 	    if (!sys) {
 		memset(ptr, 0xff, len);
 		return -1;
 	    }
-	    end = sys + s->cap.map_size;
-	    sys = sys + (addr & (s->cap.map_size-1));
+	    end = sys + s->map_size;
+	    sys = sys + (addr & (s->map_size-1));
 	    for ( ; len > 0; len--, buf++, sys += inc) {
 		if (sys == end)
 		    break;
 		*buf = readb(sys);
 	    }
-	    card_offset += s->cap.map_size;
+	    card_offset += s->map_size;
 	    addr = 0;
 	}
     }
@@ -239,20 +239,20 @@
 	    addr *= 2;
 	}
 
-	card_offset = addr & ~(s->cap.map_size-1);
+	card_offset = addr & ~(s->map_size-1);
 	while (len) {
 	    sys = set_cis_map(s, card_offset, flags);
 	    if (!sys)
 		return; /* FIXME: error */
 
-	    end = sys + s->cap.map_size;
-	    sys = sys + (addr & (s->cap.map_size-1));
+	    end = sys + s->map_size;
+	    sys = sys + (addr & (s->map_size-1));
 	    for ( ; len > 0; len--, buf++, sys += inc) {
 		if (sys == end)
 		    break;
 		writeb(*buf, sys);
 	    }
-	    card_offset += s->cap.map_size;
+	    card_offset += s->map_size;
 	    addr = 0;
 	}
     }
@@ -418,7 +418,7 @@
     tuple->TupleLink = tuple->Flags = 0;
 #ifdef CONFIG_CARDBUS
     if (s->state & SOCKET_CARDBUS) {
-	struct pci_dev *dev = s->cap.cb_dev;
+	struct pci_dev *dev = s->cb_dev;
 	u_int ptr;
 	pci_bus_read_config_dword(dev->subordinate, 0, PCI_CARDBUS_CIS, &ptr);
 	tuple->CISOffset = ptr & ~7;
diff -urN linux-2.5.71-bk1/drivers/pcmcia/cs.c linux-2.5.71-bk2/drivers/pcmcia/cs.c
--- linux-2.5.71-bk1/drivers/pcmcia/cs.c	2003-06-14 12:18:04.000000000 -0700
+++ linux-2.5.71-bk2/drivers/pcmcia/cs.c	2003-06-16 04:45:35.000000000 -0700
@@ -44,7 +44,6 @@
 #include <linux/timer.h>
 #include <linux/ioport.h>
 #include <linux/delay.h>
-#include <linux/proc_fs.h>
 #include <linux/pm.h>
 #include <linux/pci.h>
 #include <linux/device.h>
@@ -129,11 +128,6 @@
 LIST_HEAD(pcmcia_socket_list);
 DECLARE_RWSEM(pcmcia_socket_list_rwsem);
 
-
-#ifdef CONFIG_PROC_FS
-struct proc_dir_entry *proc_pccard = NULL;
-#endif
-
 /*====================================================================*/
 
 /* String tables for error messages */
@@ -281,24 +275,7 @@
 	return s->ss_entry->init(s);
 }
 
-/*====================================================================*/
-
-#if defined(CONFIG_PROC_FS) && defined(PCMCIA_DEBUG)
-static int proc_read_clients(char *buf, char **start, off_t pos,
-			     int count, int *eof, void *data)
-{
-    struct pcmcia_socket *s = data;
-    client_handle_t c;
-    char *p = buf;
-
-    for (c = s->clients; c; c = c->next)
-	p += sprintf(p, "fn %x: '%s' [attr 0x%04x] [state 0x%04x]\n",
-		     c->Function, c->dev_info, c->Attributes, c->state);
-    return (p - buf);
-}
-#endif
-
-/*======================================================================
+/*====================================================================
 
     Low-level PC Card interface drivers need to register with Card
     Services using these calls.
@@ -375,7 +352,6 @@
 	spin_lock_init(&socket->lock);
 
 	init_socket(socket);
-	socket->ss_entry->inquire_socket(socket, &socket->cap);
 
 	init_completion(&socket->thread_done);
 	init_waitqueue_head(&socket->thread_wait);
@@ -388,20 +364,6 @@
 	wait_for_completion(&socket->thread_done);
 	BUG_ON(!socket->thread);
 
-#ifdef CONFIG_PROC_FS
-	if (proc_pccard) {
-		char name[3];
-		sprintf(name, "%02d", socket->sock);
-		socket->proc = proc_mkdir(name, proc_pccard);
-		if (socket->proc)
-			socket->ss_entry->proc_setup(socket, socket->proc);
-#ifdef PCMCIA_DEBUG
-		if (socket->proc)
-			create_proc_read_entry("clients", 0, socket->proc,
-					       proc_read_clients, socket);
-#endif
-	}
-#endif
 	return 0;
 }
 
@@ -410,16 +372,6 @@
 	struct pcmcia_socket *socket = class_get_devdata(class_dev);
 	client_t *client;
 
-#ifdef CONFIG_PROC_FS
-	if (proc_pccard) {
-		char name[3];
-		sprintf(name, "%02d", socket->sock);
-#ifdef PCMCIA_DEBUG
-		remove_proc_entry("clients", socket->proc);
-#endif
-		remove_proc_entry(name, proc_pccard);
-	}
-#endif
 	if (socket->thread) {
 		init_completion(&socket->thread_done);
 		socket->thread = NULL;
@@ -435,6 +387,12 @@
 	socket->ss_entry = NULL;
 }
 
+static void pcmcia_release_socket(struct class_device *class_dev)
+{
+	struct pcmcia_socket *socket = class_get_devdata(class_dev);
+	complete(&socket->socket_released);
+}
+
 
 /**
  * pcmcia_register_socket - add a new pcmcia socket device
@@ -473,7 +431,7 @@
 	/* set proper values in socket->dev */
 	socket->dev.class_data = socket;
 	socket->dev.class = &pcmcia_socket_class;
-	snprintf(socket->dev.class_id, BUS_ID_SIZE, "pcmcia_socket%u\n", socket->sock);
+	snprintf(socket->dev.class_id, BUS_ID_SIZE, "pcmcia_socket%u", socket->sock);
 
 	/* register with the device core */
 	if (class_device_register(&socket->dev)) {
@@ -498,6 +456,8 @@
 
 	DEBUG(0, "cs: pcmcia_unregister_socket(0x%p)\n", socket->ss_entry);
 
+	init_completion(&socket->socket_released);
+
 	/* remove from the device core */
 	class_device_unregister(&socket->dev);
 
@@ -505,6 +465,9 @@
 	down_write(&pcmcia_socket_list_rwsem);
 	list_del(&socket->socket_list);
 	up_write(&pcmcia_socket_list_rwsem);
+
+	/* wait for sysfs to drop all references */
+	wait_for_completion(&socket->socket_released);
 } /* pcmcia_unregister_socket */
 EXPORT_SYMBOL(pcmcia_unregister_socket);
 
@@ -918,8 +881,8 @@
 	      *base, align);
 	align = 0;
     }
-    if ((s->cap.features & SS_CAP_STATIC_MAP) && s->cap.io_offset) {
-	*base = s->cap.io_offset | (*base & 0x0fff);
+    if ((s->features & SS_CAP_STATIC_MAP) && s->io_offset) {
+	*base = s->io_offset | (*base & 0x0fff);
 	return 0;
     }
     /* Check for an already-allocated window that must conflict with
@@ -966,7 +929,7 @@
 			     ioaddr_t num)
 {
     int i;
-    if(!(s->cap.features & SS_CAP_STATIC_MAP))
+    if(!(s->features & SS_CAP_STATIC_MAP))
 	release_region(base, num);
     for (i = 0; i < MAX_IO_WIN; i++) {
 	if ((s->io[i].BasePort <= base) &&
@@ -1183,7 +1146,7 @@
 	config->Function = fn;
 	config->Vcc = s->socket.Vcc;
 	config->Vpp1 = config->Vpp2 = s->socket.Vpp;
-	config->Option = s->cap.cb_dev->subordinate->number;
+	config->Option = s->cb_dev->subordinate->number;
 	if (s->state & SOCKET_CARDBUS_CONFIG) {
 	    config->Attributes = CONF_VALID_CLIENT;
 	    config->IntType = INT_CARDBUS;
@@ -1356,7 +1319,7 @@
 	if (!(s->state & SOCKET_CARDBUS))
 		return NULL;
 
-	return s->cap.cb_dev->subordinate;
+	return s->cb_dev->subordinate;
 }
 
 EXPORT_SYMBOL(pcmcia_lookup_bus);
@@ -1728,7 +1691,7 @@
     }
 
 #ifdef CONFIG_PCMCIA_PROBE
-    if (req->AssignedIRQ != s->cap.pci_irq)
+    if (req->AssignedIRQ != s->pci_irq)
 	undo_irq(req->Attributes, req->AssignedIRQ);
 #endif
     
@@ -1753,7 +1716,7 @@
     s->state &= ~SOCKET_WIN_REQ(win->index);
 
     /* Release system memory */
-    if(!(s->cap.features & SS_CAP_STATIC_MAP))
+    if(!(s->features & SS_CAP_STATIC_MAP))
 	release_mem_region(win->base, win->size);
     win->handle->state &= ~CLIENT_WIN_REQ(win->index);
 
@@ -1978,22 +1941,22 @@
 	return CS_IN_USE;
     
     /* Short cut: if there are no ISA interrupts, then it is PCI */
-    if (!s->cap.irq_mask) {
-	irq = s->cap.pci_irq;
+    if (!s->irq_mask) {
+	irq = s->pci_irq;
 	ret = (irq) ? 0 : CS_IN_USE;
 #ifdef CONFIG_PCMCIA_PROBE
     } else if (s->irq.AssignedIRQ != 0) {
 	/* If the interrupt is already assigned, it must match */
 	irq = s->irq.AssignedIRQ;
 	if (req->IRQInfo1 & IRQ_INFO2_VALID) {
-	    u_int mask = req->IRQInfo2 & s->cap.irq_mask;
+	    u_int mask = req->IRQInfo2 & s->irq_mask;
 	    ret = ((mask >> irq) & 1) ? 0 : CS_BAD_ARGS;
 	} else
 	    ret = ((req->IRQInfo1&IRQ_MASK) == irq) ? 0 : CS_BAD_ARGS;
     } else {
 	ret = CS_IN_USE;
 	if (req->IRQInfo1 & IRQ_INFO2_VALID) {
-	    u_int try, mask = req->IRQInfo2 & s->cap.irq_mask;
+	    u_int try, mask = req->IRQInfo2 & s->irq_mask;
 	    for (try = 0; try < 2; try++) {
 		for (irq = 0; irq < 32; irq++)
 		    if ((mask >> irq) & 1) {
@@ -2014,7 +1977,7 @@
 	if (request_irq(irq, req->Handler,
 			    ((req->Attributes & IRQ_TYPE_DYNAMIC_SHARING) || 
 			     (s->functions > 1) ||
-			     (irq == s->cap.pci_irq)) ? SA_SHIRQ : 0,
+			     (irq == s->pci_irq)) ? SA_SHIRQ : 0,
 			    handle->dev_info, req->Instance))
 	    return CS_IN_USE;
     }
@@ -2052,13 +2015,13 @@
 
     /* Window size defaults to smallest available */
     if (req->Size == 0)
-	req->Size = s->cap.map_size;
-    align = (((s->cap.features & SS_CAP_MEM_ALIGN) ||
+	req->Size = s->map_size;
+    align = (((s->features & SS_CAP_MEM_ALIGN) ||
 	      (req->Attributes & WIN_STRICT_ALIGN)) ?
-	     req->Size : s->cap.map_size);
-    if (req->Size & (s->cap.map_size-1))
+	     req->Size : s->map_size);
+    if (req->Size & (s->map_size-1))
 	return CS_BAD_SIZE;
-    if ((req->Base && (s->cap.features & SS_CAP_STATIC_MAP)) ||
+    if ((req->Base && (s->features & SS_CAP_STATIC_MAP)) ||
 	(req->Base & (align-1)))
 	return CS_BAD_BASE;
     if (req->Base)
@@ -2078,10 +2041,10 @@
     win->base = req->Base;
     win->size = req->Size;
 
-    if (!(s->cap.features & SS_CAP_STATIC_MAP) &&
+    if (!(s->features & SS_CAP_STATIC_MAP) &&
 	find_mem_region(&win->base, win->size, align,
 			(req->Attributes & WIN_MAP_BELOW_1MB) ||
-			!(s->cap.features & SS_CAP_PAGE_REGS),
+			!(s->features & SS_CAP_PAGE_REGS),
 			(*handle)->dev_info, s))
 	return CS_IN_USE;
     (*handle)->state |= CLIENT_WIN_REQ(w);
@@ -2541,12 +2504,10 @@
 EXPORT_SYMBOL(dead_socket);
 EXPORT_SYMBOL(CardServices);
 EXPORT_SYMBOL(MTDHelperEntry);
-#ifdef CONFIG_PROC_FS
-EXPORT_SYMBOL(proc_pccard);
-#endif
 
 struct class pcmcia_socket_class = {
 	.name = "pcmcia_socket",
+	.release = pcmcia_release_socket,
 };
 EXPORT_SYMBOL(pcmcia_socket_class);
 
@@ -2564,9 +2525,6 @@
     DEBUG(0, "%s\n", version);
     class_register(&pcmcia_socket_class);
     class_interface_register(&pcmcia_socket);
-#ifdef CONFIG_PROC_FS
-    proc_pccard = proc_mkdir("pccard", proc_bus);
-#endif
 
     return 0;
 }
@@ -2574,11 +2532,6 @@
 static void __exit exit_pcmcia_cs(void)
 {
     printk(KERN_INFO "unloading Kernel Card Services\n");
-#ifdef CONFIG_PROC_FS
-    if (proc_pccard) {
-	remove_proc_entry("pccard", proc_bus);
-    }
-#endif
     release_resource_db();
     class_interface_unregister(&pcmcia_socket);
     class_unregister(&pcmcia_socket_class);
diff -urN linux-2.5.71-bk1/drivers/pcmcia/cs_internal.h linux-2.5.71-bk2/drivers/pcmcia/cs_internal.h
--- linux-2.5.71-bk1/drivers/pcmcia/cs_internal.h	2003-06-14 12:17:55.000000000 -0700
+++ linux-2.5.71-bk2/drivers/pcmcia/cs_internal.h	2003-06-16 04:45:35.000000000 -0700
@@ -173,18 +173,10 @@
 void undo_irq(u_int Attributes, int irq);
 int adjust_resource_info(client_handle_t handle, adjust_t *adj);
 void release_resource_db(void);
-int proc_read_io(char *buf, char **start, off_t pos,
-		 int count, int *eof, void *data);
-int proc_read_mem(char *buf, char **start, off_t pos,
-		  int count, int *eof, void *data);
 
 extern struct rw_semaphore pcmcia_socket_list_rwsem;
 extern struct list_head pcmcia_socket_list;
 
-#ifdef CONFIG_PROC_FS
-extern struct proc_dir_entry *proc_pccard;
-#endif
-
 #ifdef PCMCIA_DEBUG
 extern int pc_debug;
 #define DEBUG(n, args...) do { if (pc_debug>(n)) printk(KERN_DEBUG args); } while (0)
diff -urN linux-2.5.71-bk1/drivers/pcmcia/ds.c linux-2.5.71-bk2/drivers/pcmcia/ds.c
--- linux-2.5.71-bk1/drivers/pcmcia/ds.c	2003-06-14 12:18:29.000000000 -0700
+++ linux-2.5.71-bk2/drivers/pcmcia/ds.c	2003-06-16 04:45:35.000000000 -0700
@@ -164,6 +164,8 @@
 EXPORT_SYMBOL(pcmcia_unregister_driver);
 
 #ifdef CONFIG_PROC_FS
+static struct proc_dir_entry *proc_pccard = NULL;
+
 static int proc_read_drivers_callback(struct device_driver *driver, void *d)
 {
 	char **p = d;
@@ -929,6 +931,7 @@
 		major_dev = i;
 
 #ifdef CONFIG_PROC_FS
+	proc_pccard = proc_mkdir("pccard", proc_bus);
 	if (proc_pccard)
 		create_proc_read_entry("drivers",0,proc_pccard,proc_read_drivers,NULL);
 #endif
@@ -944,8 +947,10 @@
 	class_interface_unregister(&pcmcia_bus_interface);
 
 #ifdef CONFIG_PROC_FS
-	if (proc_pccard)
+	if (proc_pccard) {
 		remove_proc_entry("drivers", proc_pccard);
+		remove_proc_entry("pccard", proc_bus);
+	}
 #endif
 	if (major_dev != -1)
 		unregister_chrdev(major_dev, "pcmcia");
diff -urN linux-2.5.71-bk1/drivers/pcmcia/i82092.c linux-2.5.71-bk2/drivers/pcmcia/i82092.c
--- linux-2.5.71-bk1/drivers/pcmcia/i82092.c	2003-06-14 12:18:51.000000000 -0700
+++ linux-2.5.71-bk2/drivers/pcmcia/i82092.c	2003-06-16 04:45:35.000000000 -0700
@@ -68,13 +68,11 @@
 	.init 		 	= i82092aa_init,
 	.suspend	   	= i82092aa_suspend,
 	.register_callback 	= i82092aa_register_callback,
-	.inquire_socket		= i82092aa_inquire_socket,   
 	.get_status		= i82092aa_get_status,
 	.get_socket		= i82092aa_get_socket,
 	.set_socket		= i82092aa_set_socket,
 	.set_io_map		= i82092aa_set_io_map,
 	.set_mem_map		= i82092aa_set_mem_map,
-	.proc_setup		= i82092aa_proc_setup,
 };
 
 /* The card can do upto 4 sockets, allocate a structure for each of them */
@@ -86,7 +84,6 @@
 				    2 = card but not initialized,
 				    3 = operational card */
 	int 	io_base; 	/* base io address of the socket */
-	socket_cap_t cap;
 	
 	unsigned int pending_events; /* Pending events on this interface */
 	
@@ -141,10 +138,10 @@
 	for (i = 0;i<socket_count;i++) {
 		sockets[i].card_state = 1; /* 1 = present but empty */
 		sockets[i].io_base = pci_resource_start(dev, 0);
-		sockets[i].cap.features |= SS_CAP_PCCARD;
-		sockets[i].cap.map_size = 0x1000;
-		sockets[i].cap.irq_mask = 0;
-		sockets[i].cap.pci_irq  = dev->irq;
+		sockets[i].socket.features |= SS_CAP_PCCARD;
+		sockets[i].socket.map_size = 0x1000;
+		sockets[i].socket.irq_mask = 0;
+		sockets[i].socket.pci_irq  = dev->irq;
 
 		sockets[i].number = i;
 		
@@ -488,16 +485,6 @@
 	return 0;
 } /* i82092aa_register_callback */
                                         
-static int i82092aa_inquire_socket(struct pcmcia_socket *socket, socket_cap_t *cap)
-{
-	unsigned int sock = container_of(socket, struct socket_info, socket)->number;
-	enter("i82092aa_inquire_socket");
-	*cap = sockets[sock].cap;
-	leave("i82092aa_inquire_socket");
-	return 0;
-} /* i82092aa_inquire_socket */
-
-
 static int i82092aa_get_status(struct pcmcia_socket *socket, u_int *value)
 {
 	unsigned int sock = container_of(socket, struct socket_info, socket)->number;
@@ -832,12 +819,6 @@
 	return 0;
 }
 
-static void i82092aa_proc_setup(struct pcmcia_socket *socket, struct proc_dir_entry *base)
-{
-	
-}
-/* Module stuff */
-
 static int i82092aa_module_init(void)
 {
 	enter("i82092aa_module_init");
diff -urN linux-2.5.71-bk1/drivers/pcmcia/i82092aa.h linux-2.5.71-bk2/drivers/pcmcia/i82092aa.h
--- linux-2.5.71-bk1/drivers/pcmcia/i82092aa.h	2003-06-14 12:17:58.000000000 -0700
+++ linux-2.5.71-bk2/drivers/pcmcia/i82092aa.h	2003-06-16 04:45:35.000000000 -0700
@@ -36,8 +36,6 @@
 static int i82092aa_init(struct pcmcia_socket *socket);
 static int i82092aa_suspend(struct pcmcia_socket *socket);
 static int i82092aa_register_callback(struct pcmcia_socket *socket, void (*handler)(void *, unsigned int), void * info);
-static int i82092aa_inquire_socket(struct pcmcia_socket *socket, socket_cap_t *cap);
-static void i82092aa_proc_setup(struct pcmcia_socket *socket, struct proc_dir_entry *base);
 
 #endif
 
diff -urN linux-2.5.71-bk1/drivers/pcmcia/i82365.c linux-2.5.71-bk2/drivers/pcmcia/i82365.c
--- linux-2.5.71-bk1/drivers/pcmcia/i82365.c	2003-06-14 12:18:33.000000000 -0700
+++ linux-2.5.71-bk2/drivers/pcmcia/i82365.c	2003-06-16 04:45:35.000000000 -0700
@@ -45,7 +45,6 @@
 #include <linux/pci.h>
 #include <linux/ioport.h>
 #include <linux/delay.h>
-#include <linux/proc_fs.h>
 #include <linux/workqueue.h>
 #include <linux/interrupt.h>
 #include <linux/device.h>
@@ -162,15 +161,11 @@
     u_short		type, flags;
     struct pcmcia_socket	socket;
     unsigned int	number;
-    socket_cap_t	cap;
     ioaddr_t		ioaddr;
     u_short		psock;
     u_char		cs_irq, intr;
     void		(*handler)(void *info, u_int events);
     void		*info;
-#ifdef CONFIG_PROC_FS
-    struct proc_dir_entry *proc;
-#endif
     union {
 	cirrus_state_t		cirrus;
 	vg46x_state_t		vg46x;
@@ -762,9 +757,9 @@
     
     /* Update socket interrupt information, capabilities */
     for (i = 0; i < ns; i++) {
-	t[i].cap.features |= SS_CAP_PCCARD;
-	t[i].cap.map_size = 0x1000;
-	t[i].cap.irq_mask = mask;
+	t[i].socket.features |= SS_CAP_PCCARD;
+	t[i].socket.map_size = 0x1000;
+	t[i].socket.irq_mask = mask;
 	t[i].cs_irq = isa_irq;
     }
 
@@ -911,7 +906,7 @@
 	active = 0;
 	for (i = 0; i < sockets; i++) {
 	    if ((socket[i].cs_irq != irq) &&
-		(socket[i].cap.pci_irq != irq))
+		(socket[i].socket.pci_irq != irq))
 		continue;
 	    handled = 1;
 	    ISA_LOCK(i, flags);
@@ -983,15 +978,6 @@
 
 /*====================================================================*/
 
-static int pcic_inquire_socket(struct pcmcia_socket *s, socket_cap_t *cap)
-{
-    unsigned int sock = container_of(s, struct i82365_socket, socket)->number;
-    *cap = socket[sock].cap;
-    return 0;
-} /* pcic_inquire_socket */
-
-/*====================================================================*/
-
 static int i365_get_status(u_short sock, u_int *value)
 {
     u_int status;
@@ -1113,7 +1099,7 @@
     
     /* IO card, RESET flag, IO interrupt */
     reg = t->intr;
-    if (state->io_irq != t->cap.pci_irq) reg |= state->io_irq;
+    if (state->io_irq != t->socket.pci_irq) reg |= state->io_irq;
     reg |= (state->flags & SS_RESET) ? 0 : I365_PC_RESET;
     reg |= (state->flags & SS_IOCARD) ? I365_PC_IOCARD : 0;
     i365_set(sock, I365_INTCTL, reg);
@@ -1288,71 +1274,42 @@
 /*======================================================================
 
     Routines for accessing socket information and register dumps via
-    /proc/bus/pccard/...
+    /sys/class/pcmcia_socket/...
     
 ======================================================================*/
 
-#ifdef CONFIG_PROC_FS
-
-static int proc_read_info(char *buf, char **start, off_t pos,
-			  int count, int *eof, void *data)
+static ssize_t show_info(struct class_device *class_dev, char *buf)
 {
-    struct i82365_socket *s = data;
-    char *p = buf;
-    p += sprintf(p, "type:     %s\npsock:    %d\n",
-		 pcic[s->type].name, s->psock);
-    return (p - buf);
+	struct i82365_socket *s = container_of(class_dev, struct i82365_socket, socket.dev);
+	return sprintf(buf, "type:     %s\npsock:    %d\n",
+		       pcic[s->type].name, s->psock);
 }
 
-static int proc_read_exca(char *buf, char **start, off_t pos,
-			  int count, int *eof, void *data)
+static ssize_t show_exca(struct class_device *class_dev, char *buf)
 {
-    u_short sock = (struct i82365_socket *)data - socket;
-    char *p = buf;
-    int i, top;
-    
-    u_long flags = 0;
-    ISA_LOCK(sock, flags);
-    top = 0x40;
-    for (i = 0; i < top; i += 4) {
-	if (i == 0x50) {
-	    p += sprintf(p, "\n");
-	    i = 0x100;
-	}
-	p += sprintf(p, "%02x %02x %02x %02x%s",
-		     i365_get(sock,i), i365_get(sock,i+1),
-		     i365_get(sock,i+2), i365_get(sock,i+3),
-		     ((i % 16) == 12) ? "\n" : " ");
-    }
-    ISA_UNLOCK(sock, flags);
-    return (p - buf);
-}
-
-static void pcic_proc_setup(struct pcmcia_socket *sock, struct proc_dir_entry *base)
-{
-    struct i82365_socket *s = container_of(sock, struct i82365_socket, socket);
+	struct i82365_socket *s = container_of(class_dev, struct i82365_socket, socket.dev);
+	unsigned short sock;
+	int i;
+	ssize_t ret = 0;
+	unsigned long flags = 0;
 
-    if (s->flags & IS_ALIVE)
-    	return;
+	sock = s->number;
 
-    create_proc_read_entry("info", 0, base, proc_read_info, s);
-    create_proc_read_entry("exca", 0, base, proc_read_exca, s);
-    s->proc = base;
-}
+	ISA_LOCK(sock, flags);
+	for (i = 0; i < 0x40; i += 4) {
+		ret += sprintf(buf, "%02x %02x %02x %02x%s",
+			       i365_get(sock,i), i365_get(sock,i+1),
+			       i365_get(sock,i+2), i365_get(sock,i+3),
+			       ((i % 16) == 12) ? "\n" : " ");
+		buf += ret;
+	}
+	ISA_UNLOCK(sock, flags);
 
-static void pcic_proc_remove(u_short sock)
-{
-    struct proc_dir_entry *base = socket[sock].proc;
-    if (base == NULL) return;
-    remove_proc_entry("info", base);
-    remove_proc_entry("exca", base);
+	return ret;
 }
 
-#else
-
-#define pcic_proc_setup NULL
-
-#endif /* CONFIG_PROC_FS */
+static CLASS_DEVICE_ATTR(exca, S_IRUGO, show_exca, NULL);
+static CLASS_DEVICE_ATTR(info, S_IRUGO, show_info, NULL);
 
 /*====================================================================*/
 
@@ -1447,13 +1404,11 @@
 	.init			= pcic_init,
 	.suspend		= pcic_suspend,
 	.register_callback	= pcic_register_callback,
-	.inquire_socket		= pcic_inquire_socket,
 	.get_status		= pcic_get_status,
 	.get_socket		= pcic_get_socket,
 	.set_socket		= pcic_set_socket,
 	.set_io_map		= pcic_set_io_map,
 	.set_mem_map		= pcic_set_mem_map,
-	.proc_setup		= pcic_proc_setup,
 };
 
 /*====================================================================*/
@@ -1526,6 +1481,9 @@
     	poll_timer.expires = jiffies + poll_interval;
 	add_timer(&poll_timer);
     }
+
+    class_device_create_file(&socket[i].socket.dev, &class_device_attr_info);
+    class_device_create_file(&socket[i].socket.dev, &class_device_attr_exca);
     
     return 0;
     
@@ -1534,11 +1492,9 @@
 static void __exit exit_i82365(void)
 {
     int i;
+
     for (i = 0; i < sockets; i++) {
 	    pcmcia_unregister_socket(&socket[i].socket);
-#ifdef CONFIG_PROC_FS
-	    pcic_proc_remove(i);
-#endif
     }
     platform_device_unregister(&i82365_device);
     if (poll_interval != 0)
diff -urN linux-2.5.71-bk1/drivers/pcmcia/rsrc_mgr.c linux-2.5.71-bk2/drivers/pcmcia/rsrc_mgr.c
--- linux-2.5.71-bk1/drivers/pcmcia/rsrc_mgr.c	2003-06-14 12:18:23.000000000 -0700
+++ linux-2.5.71-bk2/drivers/pcmcia/rsrc_mgr.c	2003-06-16 04:45:35.000000000 -0700
@@ -41,7 +41,6 @@
 #include <linux/slab.h>
 #include <linux/ioport.h>
 #include <linux/timer.h>
-#include <linux/proc_fs.h>
 #include <linux/pci.h>
 #include <asm/irq.h>
 #include <asm/io.h>
@@ -346,17 +345,17 @@
     cisinfo_t info1, info2;
     int ret;
     s->cis_mem.sys_start = base;
-    s->cis_mem.sys_stop = base+s->cap.map_size-1;
-    s->cis_virt = ioremap(base, s->cap.map_size);
+    s->cis_mem.sys_stop = base+s->map_size-1;
+    s->cis_virt = ioremap(base, s->map_size);
     ret = pcmcia_validate_cis(s->clients, &info1);
     /* invalidate mapping and CIS cache */
     iounmap(s->cis_virt);
     destroy_cis_cache(s);
     if ((ret != 0) || (info1.Chains == 0))
 	return 0;
-    s->cis_mem.sys_start = base+s->cap.map_size;
-    s->cis_mem.sys_stop = base+2*s->cap.map_size-1;
-    s->cis_virt = ioremap(base+s->cap.map_size, s->cap.map_size);
+    s->cis_mem.sys_start = base+s->map_size;
+    s->cis_mem.sys_stop = base+2*s->map_size-1;
+    s->cis_virt = ioremap(base+s->map_size, s->map_size);
     ret = pcmcia_validate_cis(s->clients, &info2);
     iounmap(s->cis_virt);
     destroy_cis_cache(s);
@@ -368,14 +367,14 @@
 {
     int i, a, b, d;
     s->cis_mem.sys_start = base;
-    s->cis_mem.sys_stop = base+s->cap.map_size-1;
-    s->cis_virt = ioremap(base, s->cap.map_size);
+    s->cis_mem.sys_stop = base+s->map_size-1;
+    s->cis_virt = ioremap(base, s->map_size);
     s->cis_mem.card_start = 0;
     s->cis_mem.flags = MAP_ACTIVE;
     s->ss_entry->set_mem_map(s, &s->cis_mem);
     /* Don't bother checking every word... */
     a = 0; b = -1;
-    for (i = 0; i < s->cap.map_size; i += 44) {
+    for (i = 0; i < s->map_size; i += 44) {
 	d = readl(s->cis_virt+i);
 	a += d; b &= d;
     }
@@ -385,7 +384,7 @@
 
 static int checksum_match(struct pcmcia_socket *s, u_long base)
 {
-    int a = checksum(s, base), b = checksum(s, base+s->cap.map_size);
+    int a = checksum(s, base), b = checksum(s, base+s->map_size);
     return ((a == b) && (a >= 0));
 }
 
@@ -406,19 +405,19 @@
     bad = fail = 0;
     step = (num < 0x20000) ? 0x2000 : ((num>>4) & ~0x1fff);
     /* cis_readable wants to map 2x map_size */
-    if (step < 2 * s->cap.map_size)
-	step = 2 * s->cap.map_size;
+    if (step < 2 * s->map_size)
+	step = 2 * s->map_size;
     for (i = j = base; i < base+num; i = j + step) {
 	if (!fail) {	
 	    for (j = i; j < base+num; j += step)
-		if ((check_mem_resource(j, step, s->cap.cb_dev) == 0) &&
+		if ((check_mem_resource(j, step, s->cb_dev) == 0) &&
 		    cis_readable(s, j))
 		    break;
 	    fail = ((i == base) && (j == base+num));
 	}
 	if (fail) {
 	    for (j = i; j < base+num; j += 2*step)
-		if ((check_mem_resource(j, 2*step, s->cap.cb_dev) == 0) &&
+		if ((check_mem_resource(j, 2*step, s->cb_dev) == 0) &&
 		    checksum_match(s, j) && checksum_match(s, j + step))
 		    break;
 	}
@@ -457,7 +456,7 @@
     static u_char order[] = { 0xd0, 0xe0, 0xc0, 0xf0 };
     static int hi = 0, lo = 0;
     u_long b, i, ok = 0;
-    int force_low = !(s->cap.features & SS_CAP_PAGE_REGS);
+    int force_low = !(s->features & SS_CAP_PAGE_REGS);
 
     if (!probe_mem)
 	return;
@@ -541,7 +540,7 @@
 	for (try = (try >= m->base) ? try : try+align;
 	     (try >= m->base) && (try+num <= m->base+m->num);
 	     try += align) {
-	    if (request_io_resource(try, num, name, s->cap.cb_dev) == 0) {
+	    if (request_io_resource(try, num, name, s->cb_dev) == 0) {
 		*base = try;
 		ret = 0;
 		goto out;
@@ -573,7 +572,7 @@
 	    for (try = (try >= m->base) ? try : try+align;
 		 (try >= m->base) && (try+num <= m->base+m->num);
 		 try += align) {
-		if (request_mem_resource(try, num, name, s->cap.cb_dev) == 0) {
+		if (request_mem_resource(try, num, name, s->cb_dev) == 0) {
 		    *base = try;
 		    ret = 0;
 		    goto out;
diff -urN linux-2.5.71-bk1/drivers/pcmcia/sa1100_generic.c linux-2.5.71-bk2/drivers/pcmcia/sa1100_generic.c
--- linux-2.5.71-bk1/drivers/pcmcia/sa1100_generic.c	2003-06-14 12:18:24.000000000 -0700
+++ linux-2.5.71-bk2/drivers/pcmcia/sa1100_generic.c	2003-06-16 04:45:35.000000000 -0700
@@ -37,7 +37,6 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/config.h>
-#include <linux/proc_fs.h>
 
 #include <pcmcia/version.h>
 #include <pcmcia/cs_types.h>
diff -urN linux-2.5.71-bk1/drivers/pcmcia/sa1111_generic.c linux-2.5.71-bk2/drivers/pcmcia/sa1111_generic.c
--- linux-2.5.71-bk1/drivers/pcmcia/sa1111_generic.c	2003-06-14 12:18:05.000000000 -0700
+++ linux-2.5.71-bk2/drivers/pcmcia/sa1111_generic.c	2003-06-16 04:45:35.000000000 -0700
@@ -12,7 +12,6 @@
 #include <linux/interrupt.h>
 #include <linux/init.h>
 
-#include <linux/proc_fs.h>
 #include <pcmcia/ss.h>
 
 #include <asm/hardware.h>
diff -urN linux-2.5.71-bk1/drivers/pcmcia/sa11xx_core.c linux-2.5.71-bk2/drivers/pcmcia/sa11xx_core.c
--- linux-2.5.71-bk1/drivers/pcmcia/sa11xx_core.c	2003-06-14 12:17:59.000000000 -0700
+++ linux-2.5.71-bk2/drivers/pcmcia/sa11xx_core.c	2003-06-16 04:45:35.000000000 -0700
@@ -45,7 +45,6 @@
 #include <linux/timer.h>
 #include <linux/mm.h>
 #include <linux/notifier.h>
-#include <linux/proc_fs.h>
 #include <linux/version.h>
 #include <linux/interrupt.h>
 
@@ -370,51 +369,6 @@
 }
 
 
-/* sa1100_pcmcia_inquire_socket()
- * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- * Implements the inquire_socket() operation for the in-kernel PCMCIA
- * service (formerly SS_InquireSocket in Card Services).  We set
- * SS_CAP_STATIC_MAP, which disables the memory resource database
- * check. (Mapped memory is set up within the socket driver itself.)
- *
- * In conjunction with the STATIC_MAP capability is a new field,
- * `io_offset', recommended by David Hinds. Rather than go through
- * the SetIOMap interface (which is not quite suited for communicating
- * window locations up from the socket driver), we just pass up
- * an offset which is applied to client-requested base I/O addresses
- * in alloc_io_space().
- *
- * SS_CAP_STATIC_MAP: don't bother with the (user-configured) memory
- *   resource database; we instead pass up physical address ranges
- *   and allow other parts of Card Services to deal with remapping.
- *
- * SS_CAP_PCCARD: we can deal with 16-bit PCMCIA & CF cards, but
- *   not 32-bit CardBus devices.
- *
- * Return value is irrelevant; the pcmcia subsystem ignores it.
- */
-static int
-sa1100_pcmcia_inquire_socket(struct pcmcia_socket *sock, socket_cap_t *cap)
-{
-	struct sa1100_pcmcia_socket *skt = to_sa1100_socket(sock);
-	int ret = -1;
-
-	if (skt) {
-		DEBUG(2, "%s() for sock %u\n", __FUNCTION__, skt->nr);
-
-		cap->features  = SS_CAP_STATIC_MAP|SS_CAP_PCCARD;
-		cap->irq_mask  = 0;
-		cap->map_size  = PAGE_SIZE;
-		cap->pci_irq   = skt->irq;
-		cap->io_offset = (unsigned long)skt->virt_io;
-
-		ret = 0;
-	}
-
-	return ret;
-}
-
-
 /* sa1100_pcmcia_get_status()
  * ^^^^^^^^^^^^^^^^^^^^^^^^^^
  * Implements the get_status() operation for the in-kernel PCMCIA
@@ -615,9 +569,6 @@
 	return 0;
 }
 
-
-#if defined(CONFIG_PROC_FS)
-
 struct bittbl {
 	unsigned int mask;
 	const char *name;
@@ -659,17 +610,16 @@
 	*p = b;
 }
 
-/* sa1100_pcmcia_proc_status()
+/* show_status()
  * ^^^^^^^^^^^^^^^^^^^^^^^^^^^
- * Implements the /proc/bus/pccard/??/status file.
+ * Implements the /sys/class/pcmcia_socket/??/status file.
  *
  * Returns: the number of characters added to the buffer
  */
-static int
-sa1100_pcmcia_proc_status(char *buf, char **start, off_t pos,
-			  int count, int *eof, void *data)
+static ssize_t show_status(struct class_device *class_dev, char *buf)
 {
-	struct sa1100_pcmcia_socket *skt = data;
+	struct sa1100_pcmcia_socket *skt = container_of(class_dev, 
+				struct sa1100_pcmcia_socket, socket.dev);
 	unsigned int clock = cpufreq_get(0);
 	unsigned long mecr = MECR;
 	char *p = buf;
@@ -701,42 +651,19 @@
 
 	return p-buf;
 }
+static CLASS_DEVICE_ATTR(status, S_IRUGO, show_status, NULL);
 
-/* sa1100_pcmcia_proc_setup()
- * ^^^^^^^^^^^^^^^^^^^^^^^^^^
- * Implements the proc_setup() operation for the in-kernel PCMCIA
- * service (formerly SS_ProcSetup in Card Services).
- *
- * Returns: 0 on success, -1 on error
- */
-static void
-sa1100_pcmcia_proc_setup(struct pcmcia_socket *sock, struct proc_dir_entry *base)
-{
-	struct proc_dir_entry *entry;
-
-	if ((entry = create_proc_entry("status", 0, base)) == NULL){
-		printk(KERN_ERR "unable to install \"status\" procfs entry\n");
-		return;
-	}
-	entry->read_proc = sa1100_pcmcia_proc_status;
-	entry->data = to_sa1100_socket(sock);
-}
-#else
-#define sa1100_pcmcia_proc_setup	NULL
-#endif  /* defined(CONFIG_PROC_FS) */
 
 static struct pccard_operations sa11xx_pcmcia_operations = {
 	.owner			= THIS_MODULE,
 	.init			= sa1100_pcmcia_sock_init,
 	.suspend		= sa1100_pcmcia_suspend,
 	.register_callback	= sa1100_pcmcia_register_callback,
-	.inquire_socket		= sa1100_pcmcia_inquire_socket,
 	.get_status		= sa1100_pcmcia_get_status,
 	.get_socket		= sa1100_pcmcia_get_socket,
 	.set_socket		= sa1100_pcmcia_set_socket,
 	.set_io_map		= sa1100_pcmcia_set_io_map,
 	.set_mem_map		= sa1100_pcmcia_set_mem_map,
-	.proc_setup		= sa1100_pcmcia_proc_setup
 };
 
 int sa11xx_request_irqs(struct sa1100_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr)
@@ -905,6 +832,12 @@
 		if (ret)
 			goto out_err_6;
 
+		skt->socket.features = SS_CAP_STATIC_MAP|SS_CAP_PCCARD;
+		skt->socket.irq_mask = 0;
+		skt->socket.map_size = PAGE_SIZE;
+		skt->socket.pci_irq = skt->irq;
+		skt->socket.io_offset = (unsigned long)skt->virt_io;
+
 		skt->status = sa1100_pcmcia_skt_state(skt);
 
 		ret = pcmcia_register_socket(&skt->socket);
@@ -914,6 +847,8 @@
 		WARN_ON(skt->socket.sock != i);
 
 		add_timer(&skt->poll_timer);
+
+		class_device_create_file(&skt->socket.dev, &class_device_attr_status);
 	}
 
 	dev_set_drvdata(dev, sinfo);
diff -urN linux-2.5.71-bk1/drivers/pcmcia/sa11xx_core.h linux-2.5.71-bk2/drivers/pcmcia/sa11xx_core.h
--- linux-2.5.71-bk1/drivers/pcmcia/sa11xx_core.h	2003-06-14 12:18:25.000000000 -0700
+++ linux-2.5.71-bk2/drivers/pcmcia/sa11xx_core.h	2003-06-16 04:45:35.000000000 -0700
@@ -9,7 +9,6 @@
 #ifndef _ASM_ARCH_PCMCIA
 #define _ASM_ARCH_PCMCIA
 
-#include <linux/proc_fs.h>
 /* include the world */
 #include <pcmcia/version.h>
 #include <pcmcia/cs_types.h>
diff -urN linux-2.5.71-bk1/drivers/pcmcia/tcic.c linux-2.5.71-bk2/drivers/pcmcia/tcic.c
--- linux-2.5.71-bk1/drivers/pcmcia/tcic.c	2003-06-14 12:18:22.000000000 -0700
+++ linux-2.5.71-bk2/drivers/pcmcia/tcic.c	2003-06-16 04:45:35.000000000 -0700
@@ -42,7 +42,6 @@
 #include <linux/timer.h>
 #include <linux/ioport.h>
 #include <linux/delay.h>
-#include <linux/proc_fs.h>
 #include <linux/workqueue.h>
 #include <linux/device.h>
 
@@ -130,14 +129,6 @@
 static int sockets;
 static struct tcic_socket socket_table[2];
 
-static socket_cap_t tcic_cap = {
-	/* only 16-bit cards, memory windows must be size-aligned */
-	.features = SS_CAP_PCCARD | SS_CAP_MEM_ALIGN,
-	.irq_mask = 0x4cf8,		/* irq 14, 11, 10, 7, 6, 5, 4, 3 */
-	.map_size = 0x1000,		/* 4K minimum window size */
-	/* No PCI or CardBus support */
-};
-
 /*====================================================================*/
 
 /* Trick when selecting interrupts: the TCIC sktirq pin is supposed
@@ -445,6 +436,14 @@
 	socket_table[sockets].handler = NULL;
 	socket_table[sockets].info = NULL;
 	socket_table[sockets].id = get_tcic_id();
+
+	/* only 16-bit cards, memory windows must be size-aligned */
+	/* No PCI or CardBus support */
+	socket_table[sockets].socket.features = SS_CAP_PCCARD | SS_CAP_MEM_ALIGN;
+	/* irq 14, 11, 10, 7, 6, 5, 4, 3 */
+	socket_table[sockets].socket.irq_mask = 0x4cf8;
+	/* 4K minimum window size */
+	socket_table[sockets].socket.map_size = 0x1000;		
 	sockets++;
     }
 
@@ -479,11 +478,13 @@
     else
 	for (i = mask = 0; i < 16; i++)
 	    mask |= (1<<irq_list[i]);
-    mask &= tcic_cap.irq_mask;
 
+    /* irq 14, 11, 10, 7, 6, 5, 4, 3 */
+    mask &= 0x4cf8;
     /* Scan interrupts */
     mask = irq_scan(mask);
-    tcic_cap.irq_mask = mask;
+    for (i=0;i<sockets;i++)
+	    socket_table[i].socket.irq_mask = mask;
     
     /* Check for only two interrupts available */
     scan = (mask & (mask-1));
@@ -502,7 +503,7 @@
 	if (cs_irq == 0) poll_interval = HZ;
     }
     
-    if (tcic_cap.irq_mask & (1 << 11))
+    if (socket_table[0].socket.irq_mask & (1 << 11))
 	printk("sktirq is irq 11, ");
     if (cs_irq != 0)
 	printk("status change on irq %d\n", cs_irq);
@@ -680,14 +681,6 @@
   
 /*====================================================================*/
 
-static int tcic_inquire_socket(struct pcmcia_socket *sock, socket_cap_t *cap)
-{
-    *cap = tcic_cap;
-    return 0;
-} /* tcic_inquire_socket */
-
-/*====================================================================*/
-
 static int tcic_get_socket(struct pcmcia_socket *sock, socket_state_t *state)
 {
     u_short psock = container_of(sock, struct tcic_socket, socket)->psock;
@@ -897,10 +890,6 @@
 
 /*====================================================================*/
 
-static void tcic_proc_setup(struct pcmcia_socket *sock, struct proc_dir_entry *base)
-{
-}
-
 static int tcic_init(struct pcmcia_socket *s)
 {
 	int i;
@@ -930,13 +919,11 @@
 	.init		   = tcic_init,
 	.suspend	   = tcic_suspend,
 	.register_callback = tcic_register_callback,
-	.inquire_socket	   = tcic_inquire_socket,
 	.get_status	   = tcic_get_status,
 	.get_socket	   = tcic_get_socket,
 	.set_socket	   = tcic_set_socket,
 	.set_io_map	   = tcic_set_io_map,
 	.set_mem_map	   = tcic_set_mem_map,
-	.proc_setup	   = tcic_proc_setup,
 };
 
 /*====================================================================*/
diff -urN linux-2.5.71-bk1/drivers/pcmcia/yenta.c linux-2.5.71-bk2/drivers/pcmcia/yenta.c
--- linux-2.5.71-bk1/drivers/pcmcia/yenta.c	2003-06-14 12:18:23.000000000 -0700
+++ linux-2.5.71-bk2/drivers/pcmcia/yenta.c	2003-06-16 04:45:35.000000000 -0700
@@ -394,10 +394,6 @@
 	return 0;
 }
 
-static void yenta_proc_setup(struct pcmcia_socket *sock, struct proc_dir_entry *base)
-{
-	/* Not done yet */
-}
 
 static unsigned int yenta_events(struct yenta_socket *socket)
 {
@@ -519,22 +515,13 @@
  */
 static void yenta_get_socket_capabilities(struct yenta_socket *socket, u32 isa_irq_mask)
 {
-	socket->cap.features |= SS_CAP_PAGE_REGS | SS_CAP_PCCARD | SS_CAP_CARDBUS;
-	socket->cap.map_size = 0x1000;
-	socket->cap.pci_irq = socket->cb_irq;
-	socket->cap.irq_mask = yenta_probe_irq(socket, isa_irq_mask);
-	socket->cap.cb_dev = socket->dev;
-
-	printk("Yenta IRQ list %04x, PCI irq%d\n", socket->cap.irq_mask, socket->cb_irq);
-}
-
-static int yenta_inquire_socket(struct pcmcia_socket *sock, socket_cap_t *cap)
-{
-	struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket);
-
-	*cap = socket->cap;
+	socket->socket.features |= SS_CAP_PAGE_REGS | SS_CAP_PCCARD | SS_CAP_CARDBUS;
+	socket->socket.map_size = 0x1000;
+	socket->socket.pci_irq = socket->cb_irq;
+	socket->socket.irq_mask = yenta_probe_irq(socket, isa_irq_mask);
+	socket->socket.cb_dev = socket->dev;
 
-	return 0;
+	printk("Yenta IRQ list %04x, PCI irq%d\n", socket->socket.irq_mask, socket->cb_irq);
 }
 
 
@@ -764,6 +751,9 @@
 {
 	struct yenta_socket *sock = pci_get_drvdata(dev);
 
+	/* we don't want a dying socket registered */
+	pcmcia_unregister_socket(&sock->socket);
+	
 	/* Disable all events so we don't die in an IRQ storm */
 	cb_writel(sock, CB_SOCKET_MASK, 0x0);
 	exca_writeb(sock, I365_CSCINT, 0);
@@ -777,7 +767,6 @@
 		iounmap(sock->base);
 	yenta_free_resources(sock);
 
-	pcmcia_unregister_socket(&sock->socket);
 	pci_set_drvdata(dev, NULL);
 }
 
@@ -797,13 +786,11 @@
 	.init			= yenta_init,
 	.suspend		= yenta_suspend,
 	.register_callback	= yenta_register_callback,
-	.inquire_socket		= yenta_inquire_socket,
 	.get_status		= yenta_get_status,
 	.get_socket		= yenta_get_socket,
 	.set_socket		= yenta_set_socket,
 	.set_io_map		= yenta_set_io_map,
 	.set_mem_map		= yenta_set_mem_map,
-	.proc_setup		= yenta_proc_setup,
 };
 
 
diff -urN linux-2.5.71-bk1/drivers/pcmcia/yenta.h linux-2.5.71-bk2/drivers/pcmcia/yenta.h
--- linux-2.5.71-bk1/drivers/pcmcia/yenta.h	2003-06-14 12:18:06.000000000 -0700
+++ linux-2.5.71-bk2/drivers/pcmcia/yenta.h	2003-06-16 04:45:35.000000000 -0700
@@ -101,7 +101,6 @@
 	void *base;
 	void (*handler)(void *, unsigned int);
 	void *info;
-	socket_cap_t cap;
 	spinlock_t event_lock;
 	unsigned int events;
 	struct work_struct tq_task;
diff -urN linux-2.5.71-bk1/drivers/scsi/scsi_scan.c linux-2.5.71-bk2/drivers/scsi/scsi_scan.c
--- linux-2.5.71-bk1/drivers/scsi/scsi_scan.c	2003-06-14 12:18:30.000000000 -0700
+++ linux-2.5.71-bk2/drivers/scsi/scsi_scan.c	2003-06-16 04:45:36.000000000 -0700
@@ -686,6 +686,9 @@
 	 * function */
 	sdev->max_device_blocked = SCSI_DEFAULT_DEVICE_BLOCKED;
 
+	sdev->use_10_for_rw = 1;
+	sdev->use_10_for_ms = 0;
+
 	if(sdev->host->hostt->slave_configure)
 		sdev->host->hostt->slave_configure(sdev);
 
diff -urN linux-2.5.71-bk1/drivers/scsi/sd.c linux-2.5.71-bk2/drivers/scsi/sd.c
--- linux-2.5.71-bk1/drivers/scsi/sd.c	2003-06-14 12:18:29.000000000 -0700
+++ linux-2.5.71-bk2/drivers/scsi/sd.c	2003-06-16 04:45:36.000000000 -0700
@@ -1265,8 +1265,6 @@
 	if (sdkp->media_present)
 		sd_read_cache_type(sdkp, disk->disk_name, SRpnt, buffer);
 		
-	SRpnt->sr_device->use_10_for_rw = 1;
-	SRpnt->sr_device->use_10_for_ms = 0;
 	SRpnt->sr_device->remap = 1;
 
  leave:
diff -urN linux-2.5.71-bk1/drivers/scsi/sr.c linux-2.5.71-bk2/drivers/scsi/sr.c
--- linux-2.5.71-bk1/drivers/scsi/sr.c	2003-06-14 12:18:04.000000000 -0700
+++ linux-2.5.71-bk2/drivers/scsi/sr.c	2003-06-16 04:45:36.000000000 -0700
@@ -524,8 +524,6 @@
 	sprintf(cd->cdi.name, "sr%d", minor);
 
 	sdev->sector_size = 2048;	/* A guess, just in case */
-	sdev->use_10_for_rw = 1;
-	sdev->use_10_for_ms = 0;
 	sdev->remap = 1;
 
 	/* FIXME: need to handle a get_capabilities failure properly ?? */
diff -urN linux-2.5.71-bk1/drivers/serial/mcfserial.c linux-2.5.71-bk2/drivers/serial/mcfserial.c
--- linux-2.5.71-bk1/drivers/serial/mcfserial.c	2003-06-14 12:18:08.000000000 -0700
+++ linux-2.5.71-bk2/drivers/serial/mcfserial.c	2003-06-16 04:45:36.000000000 -0700
@@ -21,8 +21,6 @@
 #include <linux/interrupt.h>
 #include <linux/tty.h>
 #include <linux/tty_flip.h>
-#include <linux/config.h>
-#include <linux/major.h>
 #include <linux/string.h>
 #include <linux/fcntl.h>
 #include <linux/mm.h>
@@ -395,7 +393,7 @@
 /*
  * This is the serial driver's generic interrupt routine
  */
-void mcfrs_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+irqreturn_t mcfrs_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 {
 	struct mcf_serial	*info;
 	unsigned char		isr;
@@ -407,7 +405,7 @@
 		receive_chars(info, regs, isr);
 	if (isr & MCFUART_UIR_TXREADY)
 		transmit_chars(info);
-	return;
+	return IRQ_HANDLED;
 }
 
 /*
@@ -643,10 +641,17 @@
 	}
 
 	if (cflag & PARENB) {
-		if (cflag & PARODD)
-			mr1 |= MCFUART_MR1_PARITYODD;
-		else
-			mr1 |= MCFUART_MR1_PARITYEVEN;
+		if (cflag & CMSPAR) {
+			if (cflag & PARODD)
+				mr1 |= MCFUART_MR1_PARITYMARK;
+			else
+				mr1 |= MCFUART_MR1_PARITYSPACE;
+		} else {
+			if (cflag & PARODD)
+				mr1 |= MCFUART_MR1_PARITYODD;
+			else
+				mr1 |= MCFUART_MR1_PARITYEVEN;
+		}
 	} else {
 		mr1 |= MCFUART_MR1_PARITYNONE;
 	}
@@ -735,8 +740,8 @@
 	local_save_flags(flags);
 	while (1) {
 		local_irq_disable();		
-		c = min(count, min(SERIAL_XMIT_SIZE - info->xmit_cnt - 1,
-				   SERIAL_XMIT_SIZE - info->xmit_head));
+		c = min(count, (int) min(((int)SERIAL_XMIT_SIZE) - info->xmit_cnt - 1,
+			((int)SERIAL_XMIT_SIZE) - info->xmit_head));
 
 		if (c <= 0) {
 			local_irq_restore(flags);
@@ -748,8 +753,8 @@
 			copy_from_user(mcfrs_tmp_buf, buf, c);
 			local_irq_restore(flags);
 			local_irq_disable();
-			c = min(c, min(SERIAL_XMIT_SIZE - info->xmit_cnt - 1,
-				       SERIAL_XMIT_SIZE - info->xmit_head));
+			c = min(c, (int) min(((int)SERIAL_XMIT_SIZE) - info->xmit_cnt - 1,
+				       ((int)SERIAL_XMIT_SIZE) - info->xmit_head));
 			memcpy(info->xmit_buf + info->xmit_head, mcfrs_tmp_buf, c);
 			up(&mcfrs_tmp_buf_sem);
 		} else
@@ -1558,7 +1563,7 @@
 	.start = mcfrs_start,
 	.hangup = mcfrs_hangup,
 	.read_proc = mcfrs_readproc,
-}
+};
 
 /* mcfrs_init inits the driver */
 static int __init
diff -urN linux-2.5.71-bk1/drivers/video/console/sticore.c linux-2.5.71-bk2/drivers/video/console/sticore.c
--- linux-2.5.71-bk1/drivers/video/console/sticore.c	2003-06-14 12:18:05.000000000 -0700
+++ linux-2.5.71-bk2/drivers/video/console/sticore.c	2003-06-16 04:45:36.000000000 -0700
@@ -1076,3 +1076,9 @@
 
 	return sti_roms[index-1];
 }
+EXPORT_SYMBOL(sti_get_rom);
+
+MODULE_AUTHOR("Philipp Rumpf, Helge Deller, Thomas Bogendoerfer");
+MODULE_DESCRIPTION("Core STI driver for HP's NGLE series graphics cards in HP PARISC machines");
+MODULE_LICENSE("GPL v2");
+
diff -urN linux-2.5.71-bk1/drivers/video/stifb.c linux-2.5.71-bk2/drivers/video/stifb.c
--- linux-2.5.71-bk1/drivers/video/stifb.c	2003-06-14 12:18:52.000000000 -0700
+++ linux-2.5.71-bk2/drivers/video/stifb.c	2003-06-16 04:45:36.000000000 -0700
@@ -66,6 +66,7 @@
 #include <linux/pci.h>
 
 #include <asm/grfioctl.h>	/* for HP-UX compatibility */
+#include <asm/uaccess.h>
 
 #include "sticore.h"
 
@@ -111,6 +112,7 @@
 	int deviceSpecificConfig;
 };
 
+static int __initdata bpp = 8;	/* parameter from modprobe */
 static int __initdata stifb_force_bpp[MAX_STI_ROMS];
 
 /* ------------------- chipset specific functions -------------------------- */
@@ -1336,6 +1338,8 @@
 		sti = sti_get_rom(i);
 		if (!sti)
 			break;
+		if (bpp > 0)
+			stifb_force_bpp[i] = bpp;
 		stifb_init_fb(sti, stifb_force_bpp[i]);
 	}
 	return 0;
@@ -1355,8 +1359,14 @@
 		sti = sti_get_rom(i);
 		if (!sti)
 			break;
-		if (sti->info)
+		if (sti->info) {
+			struct fb_info *info = sti->info;
 			unregister_framebuffer(sti->info);
+			release_mem_region(info->fix.mmio_start, info->fix.mmio_len);
+		        release_mem_region(info->fix.smem_start, info->fix.smem_len);
+		        fb_dealloc_cmap(&info->cmap);
+		        kfree(info); 
+		}
 		sti->info = NULL;
 	}
 }
@@ -1372,9 +1382,10 @@
 	if (strncmp(options, "bpp", 3) == 0) {
 		options += 3;
 		for (i = 0; i < MAX_STI_ROMS; i++) {
-			if (*options++ == ':')
+			if (*options++ == ':') {
 				stifb_force_bpp[i] = simple_strtoul(options, &options, 10);
-			else
+				bpp = -1;
+			} else
 				break;
 		}
 	}
@@ -1390,7 +1401,7 @@
 
 MODULE_AUTHOR("Helge Deller <deller@gmx.de>, Thomas Bogendoerfer <tsbogend@alpha.franken.de>");
 MODULE_DESCRIPTION("Framebuffer driver for HP's NGLE series graphics cards in HP PARISC machines");
-MODULE_LICENSE("GPL");
+MODULE_LICENSE("GPL v2");
 
 MODULE_PARM(bpp, "i");
 MODULE_PARM_DESC(mem, "Bits per pixel (default: 8)");
diff -urN linux-2.5.71-bk1/fs/compat_ioctl.c linux-2.5.71-bk2/fs/compat_ioctl.c
--- linux-2.5.71-bk1/fs/compat_ioctl.c	2003-06-14 12:18:34.000000000 -0700
+++ linux-2.5.71-bk2/fs/compat_ioctl.c	2003-06-16 04:45:36.000000000 -0700
@@ -64,6 +64,7 @@
 #include <linux/dirent.h>
 #include <linux/ctype.h>
 #include <linux/ioctl32.h>
+#include <linux/ncp_fs.h>
 
 #include <net/sock.h>          /* siocdevprivate_ioctl */
 #include <net/bluetooth/bluetooth.h>
diff -urN linux-2.5.71-bk1/include/asm-parisc/compat.h linux-2.5.71-bk2/include/asm-parisc/compat.h
--- linux-2.5.71-bk1/include/asm-parisc/compat.h	2003-06-14 12:18:52.000000000 -0700
+++ linux-2.5.71-bk2/include/asm-parisc/compat.h	2003-06-16 04:45:36.000000000 -0700
@@ -4,6 +4,7 @@
  * Architecture specific compatibility types
  */
 #include <linux/types.h>
+#include <linux/sched.h>
 
 #define COMPAT_USER_HZ 100
 
@@ -124,4 +125,12 @@
 	return (void *)(unsigned long)uptr;
 }
 
+static __inline__ void *compat_alloc_user_space(long len)
+{
+	struct pt_regs *regs = &current->thread.regs;
+	unsigned long usp = regs->gr[30];
+
+	return (void *)(usp + len);
+}
+
 #endif /* _ASM_PARISC_COMPAT_H */
diff -urN linux-2.5.71-bk1/include/asm-parisc/elf.h linux-2.5.71-bk2/include/asm-parisc/elf.h
--- linux-2.5.71-bk1/include/asm-parisc/elf.h	2003-06-14 12:18:29.000000000 -0700
+++ linux-2.5.71-bk2/include/asm-parisc/elf.h	2003-06-16 04:45:36.000000000 -0700
@@ -178,10 +178,11 @@
 #define PF_HP_SBP		0x08000000
 
 /*
- * The following definitions are those for 32-bit ELF binaries on a 32-bit kernel
- * and for 64-bit binaries on a 64-bit kernel.  To run 32-bit binaries on a 64-bit
- * kernel, arch/parisc64/kernel/binfmt_elf32.c defines these macros appropriately
- * and then #includes binfmt_elf.c, which then includes this file.
+ * The following definitions are those for 32-bit ELF binaries on a 32-bit
+ * kernel and for 64-bit binaries on a 64-bit kernel.  To run 32-bit binaries
+ * on a 64-bit kernel, arch/parisc64/kernel/binfmt_elf32.c defines these
+ * macros appropriately and then #includes binfmt_elf.c, which then includes
+ * this file.
  */
 #ifndef ELF_CLASS
 
@@ -267,6 +268,8 @@
 typedef double elf_fpreg_t;
 typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
 
+struct task_struct;
+
 extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
 #define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
 
diff -urN linux-2.5.71-bk1/include/asm-parisc/fixmap.h linux-2.5.71-bk2/include/asm-parisc/fixmap.h
--- linux-2.5.71-bk1/include/asm-parisc/fixmap.h	2003-06-14 12:18:23.000000000 -0700
+++ linux-2.5.71-bk2/include/asm-parisc/fixmap.h	2003-06-16 04:45:36.000000000 -0700
@@ -4,9 +4,16 @@
 /*
  * Allocate a 8 Mb temporary mapping area for copy_user_page/clear_user_page.
  * This area needs to be aligned on a 8 Mb boundary.
+ *
+ * FIXME:
+ *
+ * For PA-RISC, this has no meaning.  It is starting to be used on x86
+ * for vsyscalls.  PA will probably do this using space registers.
  */
 
+/* This TMPALIAS_MAP_START reserves some of the memory where the
+ * FIXMAP region is on x86.  It's only real use is to constrain
+ * VMALLOC_END (see pktable.h) */
 #define TMPALIAS_MAP_START (__PAGE_OFFSET - 0x01000000)
-#define FIXADDR_START   ((unsigned long)TMPALIAS_MAP_START)
 
 #endif
diff -urN linux-2.5.71-bk1/include/asm-parisc/module.h linux-2.5.71-bk2/include/asm-parisc/module.h
--- linux-2.5.71-bk1/include/asm-parisc/module.h	2003-06-14 12:17:58.000000000 -0700
+++ linux-2.5.71-bk2/include/asm-parisc/module.h	2003-06-16 04:45:36.000000000 -0700
@@ -24,10 +24,10 @@
 
 struct mod_arch_specific
 {
-	unsigned long got_offset;
-	unsigned long fdesc_offset, fdesc_count;
-	unsigned long stub_offset;
-	unsigned long stub_count;
+	unsigned long got_offset, got_count, got_max;
+	unsigned long fdesc_offset, fdesc_count, fdesc_max;
+	unsigned long stub_offset, stub_count, stub_max;
+	unsigned long init_stub_offset, init_stub_count, init_stub_max;
 };
 
 #endif /* _ASM_PARISC_MODULE_H */
diff -urN linux-2.5.71-bk1/include/asm-parisc/pdc_chassis.h linux-2.5.71-bk2/include/asm-parisc/pdc_chassis.h
--- linux-2.5.71-bk1/include/asm-parisc/pdc_chassis.h	2003-06-14 12:17:57.000000000 -0700
+++ linux-2.5.71-bk2/include/asm-parisc/pdc_chassis.h	2003-06-16 04:45:36.000000000 -0700
@@ -35,7 +35,7 @@
  */
 
 int pdc_chassis_send_status(int message);
-void __init parisc_pdc_chassis_init(void);
+void parisc_pdc_chassis_init(void);
 
 
 /*
diff -urN linux-2.5.71-bk1/include/asm-parisc/pgtable.h linux-2.5.71-bk2/include/asm-parisc/pgtable.h
--- linux-2.5.71-bk1/include/asm-parisc/pgtable.h	2003-06-14 12:18:33.000000000 -0700
+++ linux-2.5.71-bk2/include/asm-parisc/pgtable.h	2003-06-16 04:45:36.000000000 -0700
@@ -109,7 +109,8 @@
 #define PCXL_DMA_MAP_SIZE   (8*1024*1024)
 #define VMALLOC_START   ((unsigned long)vmalloc_start)
 #define VMALLOC_VMADDR(x) ((unsigned long)(x))
-#define VMALLOC_END	(FIXADDR_START)
+/* this is a fixmap remnant, see fixmap.h */
+#define VMALLOC_END	(TMPALIAS_MAP_START)
 #endif
 
 /* NB: The tlb miss handlers make certain assumptions about the order */
@@ -122,6 +123,7 @@
 #define _PAGE_GATEWAY_BIT  28   /* (0x008) privilege promotion allowed */
 #define _PAGE_DMB_BIT      27   /* (0x010) Data Memory Break enable (B bit) */
 #define _PAGE_DIRTY_BIT    26   /* (0x020) Page Dirty (D bit) */
+#define _PAGE_FILE_BIT	_PAGE_DIRTY_BIT	/* overload this bit */
 #define _PAGE_REFTRAP_BIT  25   /* (0x040) Page Ref. Trap enable (T bit) */
 #define _PAGE_NO_CACHE_BIT 24   /* (0x080) Uncached Page (U bit) */
 #define _PAGE_ACCESSED_BIT 23   /* (0x100) Software: Page Accessed */
@@ -135,6 +137,17 @@
 
 #define xlate_pabit(x) (31 - x)
 
+/* this defines the shift to the usable bits in the PTE it is set so
+ * that the valid bits _PAGE_PRESENT_BIT and _PAGE_USER_BIT are set
+ * to zero */
+#define PTE_SHIFT	   	xlate_pabit(_PAGE_USER_BIT)
+
+/* this is how many bits may be used by the file functions */
+#define PTE_FILE_MAX_BITS	(BITS_PER_LONG - PTE_SHIFT)
+
+#define pte_to_pgoff(pte) (pte_val(pte) >> PTE_SHIFT)
+#define pgoff_to_pte(off) ((pte_t) { ((off) << PTE_SHIFT) | _PAGE_FILE })
+
 #define _PAGE_READ     (1 << xlate_pabit(_PAGE_READ_BIT))
 #define _PAGE_WRITE    (1 << xlate_pabit(_PAGE_WRITE_BIT))
 #define _PAGE_RW       (_PAGE_READ | _PAGE_WRITE)
@@ -148,6 +161,7 @@
 #define _PAGE_PRESENT  (1 << xlate_pabit(_PAGE_PRESENT_BIT))
 #define _PAGE_FLUSH    (1 << xlate_pabit(_PAGE_FLUSH_BIT))
 #define _PAGE_USER     (1 << xlate_pabit(_PAGE_USER_BIT))
+#define _PAGE_FILE     (1 << xlate_pabit(_PAGE_FILE_BIT))
 
 #define _PAGE_TABLE	(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE |  _PAGE_DIRTY | _PAGE_ACCESSED)
 #define _PAGE_CHG_MASK	(PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
@@ -256,6 +270,8 @@
 extern inline int pte_dirty(pte_t pte)		{ return pte_val(pte) & _PAGE_DIRTY; }
 extern inline int pte_young(pte_t pte)		{ return pte_val(pte) & _PAGE_ACCESSED; }
 extern inline int pte_write(pte_t pte)		{ return pte_val(pte) & _PAGE_WRITE; }
+extern inline int pte_file(pte_t pte)		{ return pte_val(pte) & _PAGE_FILE; }
+extern inline int pte_user(pte_t pte) 		{ return pte_val(pte) & _PAGE_USER; }
 
 extern inline pte_t pte_rdprotect(pte_t pte)	{ pte_val(pte) &= ~_PAGE_READ; return pte; }
 extern inline pte_t pte_mkclean(pte_t pte)	{ pte_val(pte) &= ~_PAGE_DIRTY; return pte; }
diff -urN linux-2.5.71-bk1/include/asm-parisc/processor.h linux-2.5.71-bk2/include/asm-parisc/processor.h
--- linux-2.5.71-bk1/include/asm-parisc/processor.h	2003-06-14 12:18:52.000000000 -0700
+++ linux-2.5.71-bk2/include/asm-parisc/processor.h	2003-06-16 04:45:36.000000000 -0700
@@ -92,6 +92,7 @@
 	unsigned long fp_model;
 	unsigned int state;
 	struct parisc_device *dev;
+	unsigned long loops_per_jiffy;
 };
 
 extern struct system_cpuinfo_parisc boot_cpu_data;
diff -urN linux-2.5.71-bk1/include/asm-parisc/timex.h linux-2.5.71-bk2/include/asm-parisc/timex.h
--- linux-2.5.71-bk1/include/asm-parisc/timex.h	2003-06-14 12:18:09.000000000 -0700
+++ linux-2.5.71-bk2/include/asm-parisc/timex.h	2003-06-16 04:45:36.000000000 -0700
@@ -7,7 +7,6 @@
 #define _ASMPARISC_TIMEX_H
 
 #include <asm/system.h>
-#include <linux/time.h>
 
 #define CLOCK_TICK_RATE	1193180 /* Underlying HZ */
 
diff -urN linux-2.5.71-bk1/include/asm-parisc/unistd.h linux-2.5.71-bk2/include/asm-parisc/unistd.h
--- linux-2.5.71-bk1/include/asm-parisc/unistd.h	2003-06-14 12:17:56.000000000 -0700
+++ linux-2.5.71-bk2/include/asm-parisc/unistd.h	2003-06-16 04:45:36.000000000 -0700
@@ -720,6 +720,7 @@
 #define __NR_epoll_ctl		(__NR_Linux + 225)
 #define __NR_epoll_wait		(__NR_Linux + 226)
 #define __NR_remap_file_pages	(__NR_Linux + 227)
+#define __NR_semtimedop		(__NR_Linux + 228)
 
 
 #define __NR_Linux_syscalls     228
diff -urN linux-2.5.71-bk1/include/linux/ioport.h linux-2.5.71-bk2/include/linux/ioport.h
--- linux-2.5.71-bk1/include/linux/ioport.h	2003-06-14 12:17:59.000000000 -0700
+++ linux-2.5.71-bk2/include/linux/ioport.h	2003-06-16 04:45:36.000000000 -0700
@@ -105,12 +105,15 @@
 extern struct resource * __request_region(struct resource *, unsigned long start, unsigned long n, const char *name);
 
 /* Compatibility cruft */
-#define check_region(start,n)	__check_region(&ioport_resource, (start), (n))
 #define release_region(start,n)	__release_region(&ioport_resource, (start), (n))
 #define check_mem_region(start,n)	__check_region(&iomem_resource, (start), (n))
 #define release_mem_region(start,n)	__release_region(&iomem_resource, (start), (n))
 
-extern int __deprecated __check_region(struct resource *, unsigned long, unsigned long);
+extern int __check_region(struct resource *, unsigned long, unsigned long);
 extern void __release_region(struct resource *, unsigned long, unsigned long);
 
+static inline int __deprecated check_region(unsigned long s, unsigned long n)
+{
+	return __check_region(&ioport_resource, s, n);
+}
 #endif	/* _LINUX_IOPORT_H */
diff -urN linux-2.5.71-bk1/include/linux/moduleparam.h linux-2.5.71-bk2/include/linux/moduleparam.h
--- linux-2.5.71-bk1/include/linux/moduleparam.h	2003-06-14 12:18:09.000000000 -0700
+++ linux-2.5.71-bk2/include/linux/moduleparam.h	2003-06-16 04:45:36.000000000 -0700
@@ -40,7 +40,7 @@
 #define __module_param_call(prefix, name, set, get, arg, perm)		\
 	static char __param_str_##name[] __initdata = prefix #name;	\
 	static struct kernel_param const __param_##name			\
-		 __attribute__ ((unused,__section__ ("__param")))	\
+    __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
 	= { __param_str_##name, perm, set, get, arg }
 
 #define module_param_call(name, set, get, arg, perm)			      \
diff -urN linux-2.5.71-bk1/include/linux/netdevice.h linux-2.5.71-bk2/include/linux/netdevice.h
--- linux-2.5.71-bk1/include/linux/netdevice.h	2003-06-14 12:18:34.000000000 -0700
+++ linux-2.5.71-bk2/include/linux/netdevice.h	2003-06-16 04:45:36.000000000 -0700
@@ -355,8 +355,16 @@
 	spinlock_t		queue_lock;
 	/* Number of references to this device */
 	atomic_t		refcnt;
-	/* The flag marking that device is unregistered, but held by an user */
-	int			deadbeaf;
+	/* delayed register/unregister */
+	struct list_head	todo_list;
+
+	/* register/unregister state machine */
+	enum { NETREG_UNINITIALIZED=0,
+	       NETREG_REGISTERING,	/* called register_netdevice */
+	       NETREG_REGISTERED,	/* completed register todo */
+	       NETREG_UNREGISTERING,	/* called unregister_netdevice */
+	       NETREG_UNREGISTERED,	/* completed unregister todo */
+	} reg_state;
 
 	/* Net device features */
 	int			features;
diff -urN linux-2.5.71-bk1/include/net/route.h linux-2.5.71-bk2/include/net/route.h
--- linux-2.5.71-bk1/include/net/route.h	2003-06-14 12:17:55.000000000 -0700
+++ linux-2.5.71-bk2/include/net/route.h	2003-06-16 04:45:36.000000000 -0700
@@ -102,6 +102,8 @@
         unsigned int gc_ignored;
         unsigned int gc_goal_miss;
         unsigned int gc_dst_overflow;
+        unsigned int in_hlist_search;
+        unsigned int out_hlist_search;
 };
 
 extern struct rt_cache_stat *rt_cache_stat;
diff -urN linux-2.5.71-bk1/include/net/tcp.h linux-2.5.71-bk2/include/net/tcp.h
--- linux-2.5.71-bk1/include/net/tcp.h	2003-06-14 12:17:58.000000000 -0700
+++ linux-2.5.71-bk2/include/net/tcp.h	2003-06-16 04:45:36.000000000 -0700
@@ -160,6 +160,12 @@
 extern void tcp_bind_hash(struct sock *sk, struct tcp_bind_bucket *tb,
 			  unsigned short snum);
 
+#if (BITS_PER_LONG == 64)
+#define TCP_ADDRCMP_ALIGN_BYTES 8
+#else
+#define TCP_ADDRCMP_ALIGN_BYTES 4
+#endif
+
 /* This is a TIME_WAIT bucket.  It works around the memory consumption
  * problems of sockets in such a state on heavily loaded servers, but
  * without violating the protocol specification.
@@ -184,7 +190,8 @@
 	__u16			tw_sport;
 	/* Socket demultiplex comparisons on incoming packets. */
 	/* these five are in inet_opt */
-	__u32			tw_daddr;
+	__u32			tw_daddr
+		__attribute__((aligned(TCP_ADDRCMP_ALIGN_BYTES)));
 	__u32			tw_rcv_saddr;
 	__u16			tw_dport;
 	__u16			tw_num;
diff -urN linux-2.5.71-bk1/include/net/xfrm.h linux-2.5.71-bk2/include/net/xfrm.h
--- linux-2.5.71-bk1/include/net/xfrm.h	2003-06-14 12:18:30.000000000 -0700
+++ linux-2.5.71-bk2/include/net/xfrm.h	2003-06-16 04:45:36.000000000 -0700
@@ -782,7 +782,6 @@
 extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler);
 extern int xfrm4_tunnel_check_size(struct sk_buff *skb);
 extern int xfrm6_rcv(struct sk_buff **pskb, unsigned int *nhoffp);
-extern int xfrm6_clear_mutable_options(struct sk_buff *skb, u16 *nh_offset, int dir);
 extern int xfrm_user_policy(struct sock *sk, int optname, u8 *optval, int optlen);
 
 void xfrm_policy_init(void);
diff -urN linux-2.5.71-bk1/include/pcmcia/ss.h linux-2.5.71-bk2/include/pcmcia/ss.h
--- linux-2.5.71-bk1/include/pcmcia/ss.h	2003-06-14 12:18:34.000000000 -0700
+++ linux-2.5.71-bk2/include/pcmcia/ss.h	2003-06-16 04:45:36.000000000 -0700
@@ -52,16 +52,6 @@
 #define SS_XVCARD	0x2000
 #define SS_PENDING	0x4000
 
-/* for InquireSocket */
-typedef struct socket_cap_t {
-    u_int	features;
-    u_int	irq_mask;
-    u_int	map_size;
-    ioaddr_t	io_offset;
-    u_char	pci_irq;
-    struct pci_dev *cb_dev;
-} socket_cap_t;
-
 /* InquireSocket capabilities */
 #define SS_CAP_PAGE_REGS	0x0001
 #define SS_CAP_VIRTUAL_BUS	0x0002
@@ -133,13 +123,11 @@
 	int (*init)(struct pcmcia_socket *sock);
 	int (*suspend)(struct pcmcia_socket *sock);
 	int (*register_callback)(struct pcmcia_socket *sock, void (*handler)(void *, unsigned int), void * info);
-	int (*inquire_socket)(struct pcmcia_socket *sock, socket_cap_t *cap);
 	int (*get_status)(struct pcmcia_socket *sock, u_int *value);
 	int (*get_socket)(struct pcmcia_socket *sock, socket_state_t *state);
 	int (*set_socket)(struct pcmcia_socket *sock, socket_state_t *state);
 	int (*set_io_map)(struct pcmcia_socket *sock, struct pccard_io_map *io);
 	int (*set_mem_map)(struct pcmcia_socket *sock, struct pccard_mem_map *mem);
-	void (*proc_setup)(struct pcmcia_socket *sock, struct proc_dir_entry *base);
 };
 
 /*
@@ -147,15 +135,6 @@
  */
 struct pcmcia_socket;
 
-struct pcmcia_socket_class_data {
-	unsigned int nsock;			/* number of sockets */
-	unsigned int sock_offset;		/* socket # (which is
-	 * returned to driver) = sock_offset + (0, 1, .. , (nsock-1) */
-	struct pccard_operations *ops;		/* see above */
-	struct pcmcia_socket *s_info;
-	struct class_device class_dev;		/* generic class structure */
-};
-
 typedef struct erase_busy_t {
 	eraseq_entry_t		*erase;
 	client_handle_t		client;
@@ -193,7 +172,6 @@
 	spinlock_t			lock;
 	struct pccard_operations *	ss_entry;
 	socket_state_t			socket;
-	socket_cap_t			cap;
 	u_int				state;
 	u_short				functions;
 	u_short				lock_count;
@@ -215,13 +193,19 @@
 	char				*fake_cis;
 
 	struct list_head		socket_list;
+	struct completion		socket_released;
 
  	/* deprecated */
 	unsigned int			sock;		/* socket number */
 
-#ifdef CONFIG_PROC_FS
-	struct proc_dir_entry		*proc;
-#endif
+
+	/* socket capabilities */
+	u_int				features;
+	u_int				irq_mask;
+	u_int				map_size;
+	ioaddr_t			io_offset;
+	u_char				pci_irq;
+	struct pci_dev *		cb_dev;
 
 	/* state thread */
 	struct semaphore		skt_sem;	/* protects socket h/w state */
diff -urN linux-2.5.71-bk1/init/main.c linux-2.5.71-bk2/init/main.c
--- linux-2.5.71-bk1/init/main.c	2003-06-14 12:17:59.000000000 -0700
+++ linux-2.5.71-bk2/init/main.c	2003-06-16 04:45:36.000000000 -0700
@@ -383,7 +383,7 @@
 {
 	char * command_line;
 	extern char saved_command_line[];
-	extern struct kernel_param __start___param, __stop___param;
+	extern struct kernel_param __start___param[], __stop___param[];
 /*
  * Interrupts are still disabled. Do necessary setups, then
  * enable them
@@ -403,8 +403,8 @@
 	build_all_zonelists();
 	page_alloc_init();
 	printk("Kernel command line: %s\n", saved_command_line);
-	parse_args("Booting kernel", command_line, &__start___param,
-		   &__stop___param - &__start___param,
+	parse_args("Booting kernel", command_line, __start___param,
+		   __stop___param - __start___param,
 		   &unknown_bootoption);
 	trap_init();
 	rcu_init();
diff -urN linux-2.5.71-bk1/kernel/time.c linux-2.5.71-bk2/kernel/time.c
--- linux-2.5.71-bk1/kernel/time.c	2003-06-16 04:45:24.000000000 -0700
+++ linux-2.5.71-bk2/kernel/time.c	2003-06-16 04:45:36.000000000 -0700
@@ -168,11 +168,11 @@
 	if (tv) {
 		if (copy_from_user(&new_tv, tv, sizeof(*tv)))
 			return -EFAULT;
+		new_tv.tv_nsec *= NSEC_PER_USEC;
 	}
 	if (tz) {
 		if (copy_from_user(&new_tz, tz, sizeof(*tz)))
 			return -EFAULT;
-		new_tv.tv_nsec *= NSEC_PER_USEC;
 	}
 
 	return do_sys_settimeofday(tv ? &new_tv : NULL, tz ? &new_tz : NULL);
diff -urN linux-2.5.71-bk1/net/bluetooth/rfcomm/tty.c linux-2.5.71-bk2/net/bluetooth/rfcomm/tty.c
--- linux-2.5.71-bk1/net/bluetooth/rfcomm/tty.c	2003-06-14 12:18:22.000000000 -0700
+++ linux-2.5.71-bk2/net/bluetooth/rfcomm/tty.c	2003-06-16 04:45:36.000000000 -0700
@@ -874,8 +874,6 @@
 
 int rfcomm_init_ttys(void)
 {
-	int i;
-
 	rfcomm_tty_driver = alloc_tty_driver(RFCOMM_TTY_PORTS);
 	if (!rfcomm_tty_driver)
 		return -1;
diff -urN linux-2.5.71-bk1/net/core/dev.c linux-2.5.71-bk2/net/core/dev.c
--- linux-2.5.71-bk1/net/core/dev.c	2003-06-14 12:18:21.000000000 -0700
+++ linux-2.5.71-bk2/net/core/dev.c	2003-06-16 04:45:36.000000000 -0700
@@ -168,14 +168,6 @@
 static struct timer_list samp_timer = TIMER_INITIALIZER(sample_queue, 0, 0);
 #endif
 
-#ifdef CONFIG_HOTPLUG
-static void net_run_sbin_hotplug(struct net_device *dev, int is_register);
-static void net_run_hotplug_todo(void);
-#else
-#define net_run_sbin_hotplug(dev, is_register) do { } while (0)
-#define net_run_hotplug_todo() do { } while (0)
-#endif
-
 /*
  *	Our notifier list
  */
@@ -2537,6 +2529,17 @@
 
 static int dev_boot_phase = 1;
 
+/* Delayed registration/unregisteration */
+static spinlock_t net_todo_list_lock = SPIN_LOCK_UNLOCKED;
+static struct list_head net_todo_list = LIST_HEAD_INIT(net_todo_list);
+
+static inline void net_set_todo(struct net_device *dev)
+{
+	spin_lock(&net_todo_list_lock);
+	list_add_tail(&dev->todo_list, &net_todo_list);
+	spin_unlock(&net_todo_list_lock);
+}
+
 /**
  *	register_netdevice	- register a network device
  *	@dev: device to register
@@ -2563,6 +2566,9 @@
 	BUG_ON(dev_boot_phase);
 	ASSERT_RTNL();
 
+	/* When net_device's are persistent, this will be fatal. */
+	WARN_ON(dev->reg_state != NETREG_UNINITIALIZED);
+
 	spin_lock_init(&dev->queue_lock);
 	spin_lock_init(&dev->xmit_lock);
 	dev->xmit_lock_owner = -1;
@@ -2592,9 +2598,6 @@
 			goto out_err;
 	}
 	
-	if ((ret = netdev_register_sysfs(dev)))
-	    goto out_err;
-
 	/* Fix illegal SG+CSUM combinations. */
 	if ((dev->features & NETIF_F_SG) &&
 	    !(dev->features & (NETIF_F_IP_CSUM |
@@ -2625,13 +2628,14 @@
 	write_lock_bh(&dev_base_lock);
 	*dp = dev;
 	dev_hold(dev);
-	dev->deadbeaf = 0;
+	dev->reg_state = NETREG_REGISTERING;
 	write_unlock_bh(&dev_base_lock);
 
 	/* Notify protocols, that a new device appeared. */
 	notifier_call_chain(&netdev_chain, NETDEV_REGISTER, dev);
 
-	net_run_sbin_hotplug(dev, 1);
+	/* Finish registration after unlock */
+	net_set_todo(dev);
 	ret = 0;
 
 out:
@@ -2654,7 +2658,7 @@
 	BUG_TRAP(!dev->ip6_ptr);
 	BUG_TRAP(!dev->dn_ptr);
 
-	if (!dev->deadbeaf) {
+	if (dev->reg_state != NETREG_UNREGISTERED) {
 		printk(KERN_ERR "Freeing alive device %p, %s\n",
 		       dev, dev->name);
 		return 0;
@@ -2731,41 +2735,60 @@
  *	rtnl_unlock();
  *
  * We are invoked by rtnl_unlock() after it drops the semaphore.
- * This allows us to deal with two problems:
- * 1) We can invoke hotplug without deadlocking with linkwatch via
- *    keventd.
+ * This allows us to deal with problems:
+ * 1) We can create/delete sysfs objects which invoke hotplug
+ *    without deadlocking with linkwatch via keventd.
  * 2) Since we run with the RTNL semaphore not held, we can sleep
  *    safely in order to wait for the netdev refcnt to drop to zero.
  */
-static spinlock_t unregister_todo_lock = SPIN_LOCK_UNLOCKED;
-static struct net_device *unregister_todo;
-
+static DECLARE_MUTEX(net_todo_run_mutex);
 void netdev_run_todo(void)
 {
-	struct net_device *dev;
-
-	net_run_hotplug_todo();
-
-	spin_lock(&unregister_todo_lock);
-	dev = unregister_todo;
-	unregister_todo = NULL;
-	spin_unlock(&unregister_todo_lock);
-
-	while (dev) {
-		struct net_device *next = dev->next;
-
-		dev->next = NULL;
+	struct list_head list = LIST_HEAD_INIT(list);
 
-		netdev_unregister_sysfs(dev);
+	/* Safe outside mutex since we only care about entries that
+	 * this cpu put into queue while under RTNL.
+	 */
+	if (list_empty(&net_todo_list))
+		return;
 
-		netdev_wait_allrefs(dev);
+	/* Need to guard against multiple cpu's getting out of order. */
+	down(&net_todo_run_mutex);
 
-		BUG_ON(atomic_read(&dev->refcnt));
+	/* Snapshot list, allow later requests */
+	spin_lock(&net_todo_list_lock);
+	list_splice_init(&net_todo_list, &list);
+	spin_unlock(&net_todo_list_lock);
+		
+	while (!list_empty(&list)) {
+		struct net_device *dev
+			= list_entry(list.next, struct net_device, todo_list);
+		list_del(&dev->todo_list);
+
+		switch(dev->reg_state) {
+		case NETREG_REGISTERING:
+			netdev_register_sysfs(dev);
+			dev->reg_state = NETREG_REGISTERED;
+			break;
 
-		netdev_finish_unregister(dev);
+		case NETREG_UNREGISTERING:
+			netdev_unregister_sysfs(dev);
+			dev->reg_state = NETREG_UNREGISTERED;
+
+			netdev_wait_allrefs(dev);
+			BUG_ON(atomic_read(&dev->refcnt));
+				
+			netdev_finish_unregister(dev);
+			break;
 
-		dev = next;
+		default:
+			printk(KERN_ERR "network todo '%s' but state %d\n",
+			       dev->name, dev->reg_state);
+			break;
+		}
 	}
+
+	up(&net_todo_run_mutex);
 }
 
 /* Synchronize with packet receive processing. */
@@ -2795,13 +2818,19 @@
 	BUG_ON(dev_boot_phase);
 	ASSERT_RTNL();
 
+	/* Some devices call without registering for initialization unwind. */
+	if (dev->reg_state == NETREG_UNINITIALIZED) {
+		printk(KERN_DEBUG "unregister_netdevice: device %s/%p never "
+				  "was registered\n", dev->name, dev);
+		return -ENODEV;
+	}
+
+	BUG_ON(dev->reg_state != NETREG_REGISTERED);
+
 	/* If device is running, close it first. */
 	if (dev->flags & IFF_UP)
 		dev_close(dev);
 
-	BUG_TRAP(!dev->deadbeaf);
-	dev->deadbeaf = 1;
-
 	/* And unlink it from device chain. */
 	for (dp = &dev_base; (d = *dp) != NULL; dp = &d->next) {
 		if (d == dev) {
@@ -2812,11 +2841,13 @@
 		}
 	}
 	if (!d) {
-		printk(KERN_DEBUG "unregister_netdevice: device %s/%p never "
-				  "was registered\n", dev->name, dev);
+		printk(KERN_ERR "unregister net_device: '%s' not found\n",
+		       dev->name);
 		return -ENODEV;
 	}
 
+	dev->reg_state = NETREG_UNREGISTERING;
+
 	synchronize_net();
 
 #ifdef CONFIG_NET_FASTROUTE
@@ -2826,7 +2857,6 @@
 	/* Shutdown queueing discipline. */
 	dev_shutdown(dev);
 
-	net_run_sbin_hotplug(dev, 0);
 	
 	/* Notify protocols, that we are about to destroy
 	   this device. They should clean all the things.
@@ -2846,10 +2876,8 @@
 
 	free_divert_blk(dev);
 
-	spin_lock(&unregister_todo_lock);
-	dev->next = unregister_todo;
-	unregister_todo = dev;
-	spin_unlock(&unregister_todo_lock);
+	/* Finish processing unregister after unlock */
+	net_set_todo(dev);
 
 	dev_put(dev);
 	return 0;
@@ -2955,11 +2983,11 @@
 			 * dev_alloc_name can now advance to next suitable
 			 * name that is checked next.
 			 */
-			dev->deadbeaf = 1;
 			dp = &dev->next;
 		} else {
 			dp = &dev->next;
 			dev->ifindex = dev_new_index();
+			dev->reg_state = NETREG_REGISTERED;
 			if (dev->iflink == -1)
 				dev->iflink = dev->ifindex;
 			if (!dev->rebuild_header)
@@ -2974,7 +3002,7 @@
 	 */
 	dp = &dev_base;
 	while ((dev = *dp) != NULL) {
-		if (dev->deadbeaf) {
+		if (dev->reg_state != NETREG_REGISTERED) {
 			write_lock_bh(&dev_base_lock);
 			*dp = dev->next;
 			write_unlock_bh(&dev_base_lock);
@@ -3001,96 +3029,3 @@
 }
 
 subsys_initcall(net_dev_init);
-
-#ifdef CONFIG_HOTPLUG
-
-struct net_hotplug_todo {
-	struct list_head	list;
-	char			ifname[IFNAMSIZ];
-	int			is_register;
-};
-static spinlock_t net_hotplug_list_lock = SPIN_LOCK_UNLOCKED;
-static DECLARE_MUTEX(net_hotplug_run);
-static struct list_head net_hotplug_list = LIST_HEAD_INIT(net_hotplug_list);
-
-static inline void net_run_hotplug_one(struct net_hotplug_todo *ent)
-{
-	char *argv[3], *envp[5], ifname[12 + IFNAMSIZ], action_str[32];
-	int i;
-
-	sprintf(ifname, "INTERFACE=%s", ent->ifname);
-	sprintf(action_str, "ACTION=%s",
-		(ent->is_register ? "register" : "unregister"));
-
-        i = 0;
-        argv[i++] = hotplug_path;
-        argv[i++] = "net";
-        argv[i] = 0;
-
-	i = 0;
-	/* minimal command environment */
-	envp [i++] = "HOME=/";
-	envp [i++] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
-	envp [i++] = ifname;
-	envp [i++] = action_str;
-	envp [i] = 0;
-
-	call_usermodehelper(argv [0], argv, envp, 0);
-}
-
-/* Run all queued hotplug requests. 
- * Requests are run in FIFO order.
- */
-static void net_run_hotplug_todo(void)
-{
-	struct list_head list = LIST_HEAD_INIT(list);
-
-	/* This is racy but okay since any other requests will get
-	 * processed when the other guy does rtnl_unlock.
-	 */
-	if (list_empty(&net_hotplug_list))
-		return;
-
-	/* Need to guard against multiple cpu's getting out of order. */
-	down(&net_hotplug_run);	
-
-	/* Snapshot list, allow later requests */
-	spin_lock(&net_hotplug_list_lock);
-	list_splice_init(&net_hotplug_list, &list);
-	spin_unlock(&net_hotplug_list_lock);
-
-	while (!list_empty(&list)) {
-		struct net_hotplug_todo *ent;
-
-		ent = list_entry(list.next, struct net_hotplug_todo, list);
-		list_del(&ent->list);
-		net_run_hotplug_one(ent);
-		kfree(ent);
-	}
-
-	up(&net_hotplug_run);
-}
-
-/* Notify userspace when a netdevice event occurs,
- * by running '/sbin/hotplug net' with certain
- * environment variables set.
- */
-
-static void net_run_sbin_hotplug(struct net_device *dev, int is_register)
-{
-	struct net_hotplug_todo *ent = kmalloc(sizeof(*ent), GFP_KERNEL);
-
-	ASSERT_RTNL();
-
-	if (!ent)
-		return;
-
-	INIT_LIST_HEAD(&ent->list);
-	memcpy(ent->ifname, dev->name, IFNAMSIZ);
-	ent->is_register = is_register;
-
-	spin_lock(&net_hotplug_list_lock);
-	list_add(&ent->list, &net_hotplug_list);
-	spin_unlock(&net_hotplug_list_lock);
-}
-#endif
diff -urN linux-2.5.71-bk1/net/core/net-sysfs.c linux-2.5.71-bk2/net/core/net-sysfs.c
--- linux-2.5.71-bk1/net/core/net-sysfs.c	2003-06-14 12:18:33.000000000 -0700
+++ linux-2.5.71-bk2/net/core/net-sysfs.c	2003-06-16 04:45:36.000000000 -0700
@@ -15,6 +15,11 @@
 #define to_class_dev(obj) container_of(obj,struct class_device,kobj)
 #define to_net_dev(class) container_of(class, struct net_device, class_dev)
 
+static inline int dev_isalive(const struct net_device *dev) 
+{
+	return dev->reg_state == NETREG_REGISTERED;
+}
+
 /* use same locking rules as GIF* ioctl's */
 static ssize_t netdev_show(const struct class_device *cd, char *buf,
 			   ssize_t (*format)(const struct net_device *, char *))
@@ -23,7 +28,7 @@
 	ssize_t ret = -EINVAL;
 
 	read_lock(&dev_base_lock);
-	if (!net->deadbeaf)
+	if (dev_isalive(net))
 		ret = (*format)(net, buf);
 	read_unlock(&dev_base_lock);
 
@@ -60,7 +65,7 @@
 		goto err;
 
 	rtnl_lock();
-	if (!net->deadbeaf) {
+	if (dev_isalive(net)) {
 		if ((ret = (*set)(net, new)) == 0)
 			ret = len;
 	}
@@ -97,17 +102,17 @@
 static ssize_t show_address(struct class_device *dev, char *buf)
 {
 	struct net_device *net = to_net_dev(dev);
-	if (net->deadbeaf)
-		return -EINVAL;
-	return format_addr(buf, net->dev_addr, net->addr_len);
+	if (dev_isalive(net))
+	    return format_addr(buf, net->dev_addr, net->addr_len);
+	return -EINVAL;
 }
 
 static ssize_t show_broadcast(struct class_device *dev, char *buf)
 {
 	struct net_device *net = to_net_dev(dev);
-	if (net->deadbeaf)
-		return -EINVAL;
-	return format_addr(buf, net->broadcast, net->addr_len);
+	if (dev_isalive(net))
+		return format_addr(buf, net->broadcast, net->addr_len);
+	return -EINVAL;
 }
 
 static CLASS_DEVICE_ATTR(address, S_IRUGO, show_address, NULL);
@@ -152,16 +157,12 @@
 
 static ssize_t store_tx_queue_len(struct class_device *dev, const char *buf, size_t len)
 {
-	return netdev_store(dev, buf,len, change_tx_queue_len);
+	return netdev_store(dev, buf, len, change_tx_queue_len);
 }
 
 static CLASS_DEVICE_ATTR(tx_queue_len, S_IRUGO | S_IWUSR, show_tx_queue_len, 
 			 store_tx_queue_len);
 
-static struct class net_class = {
-	.name = "net",
-};
-
 
 static struct class_device_attribute *net_class_attributes[] = {
 	&class_device_attr_ifindex,
@@ -263,7 +264,7 @@
 	ssize_t ret = -EINVAL;
 	
 	read_lock(&dev_base_lock);
-	if (!dev->deadbeaf && entry->show && dev->get_stats &&
+	if (dev_isalive(dev) && entry->show && dev->get_stats &&
 	    (stats = (*dev->get_stats)(dev)))
 		ret = entry->show(stats, buf);
 	read_unlock(&dev_base_lock);
@@ -279,6 +280,35 @@
 	.default_attrs  = default_attrs,
 };
 
+#ifdef CONFIG_HOTPLUG
+static int netdev_hotplug(struct class_device *cd, char **envp,
+			  int num_envp, char *buf, int size)
+{
+	struct net_device *dev = to_net_dev(cd);
+	int i = 0;
+	int n;
+
+	/* pass interface in env to hotplug. */
+	envp[i++] = buf;
+	n = snprintf(buf, size, "INTERFACE=%s", dev->name) + 1;
+	buf += n;
+	size -= n;
+
+	if ((size <= 0) || (i >= num_envp))
+		return -ENOMEM;
+
+	envp[i] = 0;
+	return 0;
+}
+#endif
+
+static struct class net_class = {
+	.name = "net",
+#ifdef CONFIG_HOTPLUG
+	.hotplug = netdev_hotplug,
+#endif
+};
+
 /* Create sysfs entries for network device. */
 int netdev_register_sysfs(struct net_device *net)
 {
diff -urN linux-2.5.71-bk1/net/decnet/dn_nsp_in.c linux-2.5.71-bk2/net/decnet/dn_nsp_in.c
--- linux-2.5.71-bk1/net/decnet/dn_nsp_in.c	2003-06-14 12:18:07.000000000 -0700
+++ linux-2.5.71-bk2/net/decnet/dn_nsp_in.c	2003-06-16 04:45:36.000000000 -0700
@@ -812,7 +812,7 @@
 			printk(KERN_DEBUG "NSP: 0x%02x 0x%02x 0x%04x 0x%04x %d\n",
 				(int)cb->rt_flags, (int)cb->nsp_flags, 
 				(int)cb->src_port, (int)cb->dst_port, 
-				(int)sock_owned_by_user(sk));
+				!!sock_owned_by_user(sk));
 		if (!sock_owned_by_user(sk))
 			ret = dn_nsp_backlog_rcv(sk, skb);
 		else
diff -urN linux-2.5.71-bk1/net/ipv4/af_inet.c linux-2.5.71-bk2/net/ipv4/af_inet.c
--- linux-2.5.71-bk1/net/ipv4/af_inet.c	2003-06-14 12:17:58.000000000 -0700
+++ linux-2.5.71-bk2/net/ipv4/af_inet.c	2003-06-16 04:45:36.000000000 -0700
@@ -1134,7 +1134,7 @@
 		printk(KERN_CRIT "inet_init: Cannot add TCP protocol\n");
 #ifdef CONFIG_IP_MULTICAST
 	if (inet_add_protocol(&igmp_protocol, IPPROTO_IGMP) < 0)
-		printk(KERN_CRIT "inet_init: Cannot add TCP protocol\n");
+		printk(KERN_CRIT "inet_init: Cannot add IGMP protocol\n");
 #endif
 
 	/* Register the socket-side information for inet_create. */
diff -urN linux-2.5.71-bk1/net/ipv4/route.c linux-2.5.71-bk2/net/ipv4/route.c
--- linux-2.5.71-bk1/net/ipv4/route.c	2003-06-14 12:18:51.000000000 -0700
+++ linux-2.5.71-bk2/net/ipv4/route.c	2003-06-16 04:45:36.000000000 -0700
@@ -321,7 +321,7 @@
 	for (i = 0; i < NR_CPUS; i++) {
 		if (!cpu_possible(i))
 			continue;
-		len += sprintf(buffer+len, "%08x  %08x %08x %08x %08x %08x %08x %08x  %08x %08x %08x %08x %08x %08x %08x \n",
+		len += sprintf(buffer+len, "%08x  %08x %08x %08x %08x %08x %08x %08x  %08x %08x %08x %08x %08x %08x %08x %08x %08x \n",
 			       dst_entries,		       
 			       per_cpu_ptr(rt_cache_stat, i)->in_hit,
 			       per_cpu_ptr(rt_cache_stat, i)->in_slow_tot,
@@ -338,7 +338,9 @@
 			       per_cpu_ptr(rt_cache_stat, i)->gc_total,
 			       per_cpu_ptr(rt_cache_stat, i)->gc_ignored,
 			       per_cpu_ptr(rt_cache_stat, i)->gc_goal_miss,
-			       per_cpu_ptr(rt_cache_stat, i)->gc_dst_overflow
+			       per_cpu_ptr(rt_cache_stat, i)->gc_dst_overflow,
+			       per_cpu_ptr(rt_cache_stat, i)->in_hlist_search,
+			       per_cpu_ptr(rt_cache_stat, i)->out_hlist_search
 
 			);
 	}
@@ -1786,6 +1788,7 @@
 			skb->dst = (struct dst_entry*)rth;
 			return 0;
 		}
+		RT_CACHE_STAT_INC(in_hlist_search);
 	}
 	rcu_read_unlock();
 
@@ -2153,6 +2156,7 @@
 			*rp = rth;
 			return 0;
 		}
+		RT_CACHE_STAT_INC(out_hlist_search);
 	}
 	rcu_read_unlock();
 
diff -urN linux-2.5.71-bk1/net/ipv4/tcp_ipv4.c linux-2.5.71-bk2/net/ipv4/tcp_ipv4.c
--- linux-2.5.71-bk1/net/ipv4/tcp_ipv4.c	2003-06-14 12:18:06.000000000 -0700
+++ linux-2.5.71-bk2/net/ipv4/tcp_ipv4.c	2003-06-16 04:45:36.000000000 -0700
@@ -1363,7 +1363,7 @@
 {
 	static unsigned long warntime;
 
-	if (jiffies - warntime > HZ * 60) {
+	if (time_after(jiffies, (warntime + HZ * 60))) {
 		warntime = jiffies;
 		printk(KERN_INFO
 		       "possible SYN flooding on port %d. Sending cookies.\n",
diff -urN linux-2.5.71-bk1/net/ipv4/tcp_minisocks.c linux-2.5.71-bk2/net/ipv4/tcp_minisocks.c
--- linux-2.5.71-bk1/net/ipv4/tcp_minisocks.c	2003-06-14 12:18:29.000000000 -0700
+++ linux-2.5.71-bk2/net/ipv4/tcp_minisocks.c	2003-06-16 04:45:36.000000000 -0700
@@ -563,7 +563,7 @@
 			tcp_twcal_timer.expires = tcp_twcal_jiffie + (slot<<TCP_TW_RECYCLE_TICK);
 			add_timer(&tcp_twcal_timer);
 		} else {
-			if ((long)(tcp_twcal_timer.expires - jiffies) > (slot<<TCP_TW_RECYCLE_TICK))
+			if (time_after(tcp_twcal_timer.expires, jiffies + (slot<<TCP_TW_RECYCLE_TICK)))
 				mod_timer(&tcp_twcal_timer, jiffies + (slot<<TCP_TW_RECYCLE_TICK));
 			slot = (tcp_twcal_hand + slot)&(TCP_TW_RECYCLE_SLOTS-1);
 		}
@@ -596,7 +596,7 @@
 	j = tcp_twcal_jiffie;
 
 	for (n=0; n<TCP_TW_RECYCLE_SLOTS; n++) {
-		if ((long)(j - now) <= 0) {
+		if (time_before_eq(j, now)) {
 			struct tcp_tw_bucket *tw;
 
 			while((tw = tcp_twcal_row[slot]) != NULL) {
diff -urN linux-2.5.71-bk1/net/ipv4/tcp_timer.c linux-2.5.71-bk2/net/ipv4/tcp_timer.c
--- linux-2.5.71-bk1/net/ipv4/tcp_timer.c	2003-06-14 12:18:34.000000000 -0700
+++ linux-2.5.71-bk2/net/ipv4/tcp_timer.c	2003-06-16 04:45:36.000000000 -0700
@@ -227,7 +227,7 @@
 	if (sk->sk_state == TCP_CLOSE || !(tp->ack.pending & TCP_ACK_TIMER))
 		goto out;
 
-	if ((long)(tp->ack.timeout - jiffies) > 0) {
+	if (time_after(tp->ack.timeout, jiffies)) {
 		if (!mod_timer(&tp->delack_timer, tp->ack.timeout))
 			sock_hold(sk);
 		goto out;
@@ -436,7 +436,7 @@
 	if (sk->sk_state == TCP_CLOSE || !tp->pending)
 		goto out;
 
-	if ((long)(tp->timeout - jiffies) > 0) {
+	if (time_after(tp->timeout, jiffies)) {
 		if (!mod_timer(&tp->retransmit_timer, tp->timeout))
 			sock_hold(sk);
 		goto out;
@@ -516,7 +516,7 @@
 	do {
 		reqp=&lopt->syn_table[i];
 		while ((req = *reqp) != NULL) {
-			if ((long)(now - req->expires) >= 0) {
+			if (time_after_eq(now, req->expires)) {
 				if ((req->retrans < thresh ||
 				     (req->acked && req->retrans < max_retries))
 				    && !req->class->rtx_syn_ack(sk, req, NULL)) {
diff -urN linux-2.5.71-bk1/net/ipv6/ah6.c linux-2.5.71-bk2/net/ipv6/ah6.c
--- linux-2.5.71-bk1/net/ipv6/ah6.c	2003-06-14 12:18:25.000000000 -0700
+++ linux-2.5.71-bk2/net/ipv6/ah6.c	2003-06-16 04:45:36.000000000 -0700
@@ -36,6 +36,114 @@
 #include <net/xfrm.h>
 #include <asm/scatterlist.h>
 
+static int zero_out_mutable_opts(struct ipv6_opt_hdr *opthdr)
+{
+	u8 *opt = (u8 *)opthdr;
+	int len = ipv6_optlen(opthdr);
+	int off = 0;
+	int optlen = 0;
+
+	off += 2;
+	len -= 2;
+
+	while (len > 0) {
+
+		switch (opt[off]) {
+
+		case IPV6_TLV_PAD0:
+			optlen = 1;
+			break;
+		default:
+			if (len < 2) 
+				goto bad;
+			optlen = opt[off+1]+2;
+			if (len < optlen)
+				goto bad;
+			if (opt[off] & 0x20)
+				memset(&opt[off+2], 0, opt[off+1]);
+			break;
+		}
+
+		off += optlen;
+		len -= optlen;
+	}
+	if (len == 0)
+		return 1;
+
+bad:
+	return 0;
+}
+
+static int ipv6_clear_mutable_options(struct sk_buff *skb, u16 *nh_offset, int dir)
+{
+	u16 offset = sizeof(struct ipv6hdr);
+	struct ipv6_opt_hdr *exthdr = (struct ipv6_opt_hdr*)(skb->nh.raw + offset);
+	unsigned int packet_len = skb->tail - skb->nh.raw;
+	u8 nexthdr = skb->nh.ipv6h->nexthdr;
+	u8 nextnexthdr = 0;
+
+	*nh_offset = ((unsigned char *)&skb->nh.ipv6h->nexthdr) - skb->nh.raw;
+
+	while (offset + 1 <= packet_len) {
+
+		switch (nexthdr) {
+
+		case NEXTHDR_HOP:
+			*nh_offset = offset;
+			offset += ipv6_optlen(exthdr);
+			if (!zero_out_mutable_opts(exthdr)) {
+				if (net_ratelimit())
+					printk(KERN_WARNING "overrun hopopts\n"); 
+				return 0;
+			}
+			nexthdr = exthdr->nexthdr;
+			exthdr = (struct ipv6_opt_hdr*)(skb->nh.raw + offset);
+			break;
+
+		case NEXTHDR_ROUTING:
+			*nh_offset = offset;
+			offset += ipv6_optlen(exthdr);
+			((struct ipv6_rt_hdr*)exthdr)->segments_left = 0; 
+			nexthdr = exthdr->nexthdr;
+			exthdr = (struct ipv6_opt_hdr*)(skb->nh.raw + offset);
+			break;
+
+		case NEXTHDR_DEST:
+			*nh_offset = offset;
+			offset += ipv6_optlen(exthdr);
+			if (!zero_out_mutable_opts(exthdr))  {
+				if (net_ratelimit())
+					printk(KERN_WARNING "overrun destopt\n"); 
+				return 0;
+			}
+			nexthdr = exthdr->nexthdr;
+			exthdr = (struct ipv6_opt_hdr*)(skb->nh.raw + offset);
+			break;
+
+		case NEXTHDR_AUTH:
+			if (dir == XFRM_POLICY_OUT) {
+				memset(((struct ipv6_auth_hdr*)exthdr)->auth_data, 0, 
+				       (((struct ipv6_auth_hdr*)exthdr)->hdrlen - 1) << 2);
+			}
+			if (exthdr->nexthdr == NEXTHDR_DEST) {
+				offset += (((struct ipv6_auth_hdr*)exthdr)->hdrlen + 2) << 2;
+				exthdr = (struct ipv6_opt_hdr*)(skb->nh.raw + offset);
+				nextnexthdr = exthdr->nexthdr;
+				if (!zero_out_mutable_opts(exthdr)) {
+					if (net_ratelimit())
+						printk(KERN_WARNING "overrun destopt\n");
+					return 0;
+				}
+			}
+			return nexthdr;
+		default :
+			return nexthdr;
+		}
+	}
+
+	return nexthdr;
+}
+
 int ah6_output(struct sk_buff *skb)
 {
 	int err;
@@ -80,7 +188,7 @@
 		memcpy(iph, skb->data, hdr_len);
 		skb->nh.ipv6h = (struct ipv6hdr*)skb_push(skb, x->props.header_len);
 		memcpy(skb->nh.ipv6h, iph, hdr_len);
-		nexthdr = xfrm6_clear_mutable_options(skb, &nh_offset, XFRM_POLICY_OUT);
+		nexthdr = ipv6_clear_mutable_options(skb, &nh_offset, XFRM_POLICY_OUT);
 		if (nexthdr == 0)
 			goto error;
 
@@ -138,20 +246,46 @@
 
 int ah6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_buff *skb)
 {
-	int ah_hlen;
-	struct ipv6hdr *iph;
+	/*
+	 * Before process AH
+	 * [IPv6][Ext1][Ext2][AH][Dest][Payload]
+	 * |<-------------->| hdr_len
+	 * |<------------------------>| cleared_hlen
+	 *
+	 * To erase AH:
+	 * Keeping copy of cleared headers. After AH processing,
+	 * Moving the pointer of skb->nh.raw by using skb_pull as long as AH
+	 * header length. Then copy back the copy as long as hdr_len
+	 * If destination header following AH exists, copy it into after [Ext2].
+	 * 
+	 * |<>|[IPv6][Ext1][Ext2][Dest][Payload]
+	 * There is offset of AH before IPv6 header after the process.
+	 */
+
+	struct ipv6hdr *iph = skb->nh.ipv6h;
 	struct ipv6_auth_hdr *ah;
 	struct ah_data *ahp;
 	unsigned char *tmp_hdr = NULL;
-	int hdr_len = skb->h.raw - skb->nh.raw;
+	u16 hdr_len = skb->data - skb->nh.raw;
+	u16 ah_hlen;
+	u16 cleared_hlen = hdr_len;
+	u16 nh_offset = 0;
 	u8 nexthdr = 0;
+	u8 *prevhdr;
 
 	if (!pskb_may_pull(skb, sizeof(struct ip_auth_hdr)))
 		goto out;
 
 	ah = (struct ipv6_auth_hdr*)skb->data;
 	ahp = x->data;
-        ah_hlen = (ah->hdrlen + 2) << 2;
+	nexthdr = ah->nexthdr;
+	ah_hlen = (ah->hdrlen + 2) << 2;
+	cleared_hlen += ah_hlen;
+
+	if (nexthdr == NEXTHDR_DEST) {
+		struct ipv6_opt_hdr *dsthdr = (struct ipv6_opt_hdr*)(skb->data + ah_hlen);
+		cleared_hlen += ipv6_optlen(dsthdr);
+	}
 
         if (ah_hlen != XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + ahp->icv_full_len) &&
             ah_hlen != XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + ahp->icv_trunc_len))
@@ -166,12 +300,16 @@
 	    pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
 		goto out;
 
-	tmp_hdr = kmalloc(hdr_len, GFP_ATOMIC);
+	tmp_hdr = kmalloc(cleared_hlen, GFP_ATOMIC);
 	if (!tmp_hdr)
 		goto out;
-	memcpy(tmp_hdr, skb->nh.raw, hdr_len);
-	ah = (struct ipv6_auth_hdr*)skb->data;
-	iph = skb->nh.ipv6h;
+	memcpy(tmp_hdr, skb->nh.raw, cleared_hlen);
+	ipv6_clear_mutable_options(skb, &nh_offset, XFRM_POLICY_IN);
+	iph->priority    = 0;
+	iph->flow_lbl[0] = 0;
+	iph->flow_lbl[1] = 0;
+	iph->flow_lbl[2] = 0;
+	iph->hop_limit   = 0;
 
         {
 		u8 auth_data[ahp->icv_trunc_len];
@@ -187,9 +325,15 @@
 		}
 	}
 
-	nexthdr = ((struct ipv6hdr*)tmp_hdr)->nexthdr = ah->nexthdr;
-	skb->nh.raw = skb_pull(skb, (ah->hdrlen+2)<<2);
+	skb->nh.raw = skb_pull(skb, ah_hlen);
 	memcpy(skb->nh.raw, tmp_hdr, hdr_len);
+	if (nexthdr == NEXTHDR_DEST) {
+		memcpy(skb->nh.raw + hdr_len,
+		       tmp_hdr + hdr_len + ah_hlen,
+		       cleared_hlen - hdr_len - ah_hlen);
+	}
+	prevhdr = (u8*)(skb->nh.raw + nh_offset);
+	*prevhdr = nexthdr;
 	skb->nh.ipv6h->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
 	skb_pull(skb, hdr_len);
 	skb->h.raw = skb->data;
diff -urN linux-2.5.71-bk1/net/ipv6/ipv6_syms.c linux-2.5.71-bk2/net/ipv6/ipv6_syms.c
--- linux-2.5.71-bk1/net/ipv6/ipv6_syms.c	2003-06-14 12:18:28.000000000 -0700
+++ linux-2.5.71-bk2/net/ipv6/ipv6_syms.c	2003-06-16 04:45:36.000000000 -0700
@@ -37,7 +37,6 @@
 EXPORT_SYMBOL(in6_dev_finish_destroy);
 EXPORT_SYMBOL(ip6_find_1stfragopt);
 EXPORT_SYMBOL(xfrm6_rcv);
-EXPORT_SYMBOL(xfrm6_clear_mutable_options);
 EXPORT_SYMBOL(rt6_lookup);
 EXPORT_SYMBOL(fl6_sock_lookup);
 EXPORT_SYMBOL(ipv6_ext_hdr);
diff -urN linux-2.5.71-bk1/net/ipv6/xfrm6_input.c linux-2.5.71-bk2/net/ipv6/xfrm6_input.c
--- linux-2.5.71-bk1/net/ipv6/xfrm6_input.c	2003-06-14 12:18:51.000000000 -0700
+++ linux-2.5.71-bk2/net/ipv6/xfrm6_input.c	2003-06-16 04:45:36.000000000 -0700
@@ -15,114 +15,6 @@
 
 static kmem_cache_t *secpath_cachep;
 
-static int zero_out_mutable_opts(struct ipv6_opt_hdr *opthdr)
-{
-	u8 *opt = (u8 *)opthdr;
-	int len = ipv6_optlen(opthdr);
-	int off = 0;
-	int optlen = 0;
-
-	off += 2;
-	len -= 2;
-
-	while (len > 0) {
-
-		switch (opt[off]) {
-
-		case IPV6_TLV_PAD0:
-			optlen = 1;
-			break;
-		default:
-			if (len < 2) 
-				goto bad;
-			optlen = opt[off+1]+2;
-			if (len < optlen)
-				goto bad;
-			if (opt[off] & 0x20)
-				memset(&opt[off+2], 0, opt[off+1]);
-			break;
-		}
-
-		off += optlen;
-		len -= optlen;
-	}
-	if (len == 0)
-		return 1;
-
-bad:
-	return 0;
-}
-
-int xfrm6_clear_mutable_options(struct sk_buff *skb, u16 *nh_offset, int dir)
-{
-	u16 offset = sizeof(struct ipv6hdr);
-	struct ipv6_opt_hdr *exthdr = (struct ipv6_opt_hdr*)(skb->nh.raw + offset);
-	unsigned int packet_len = skb->tail - skb->nh.raw;
-	u8 nexthdr = skb->nh.ipv6h->nexthdr;
-	u8 nextnexthdr = 0;
-
-	*nh_offset = ((unsigned char *)&skb->nh.ipv6h->nexthdr) - skb->nh.raw;
-
-	while (offset + 1 <= packet_len) {
-
-		switch (nexthdr) {
-
-		case NEXTHDR_HOP:
-			*nh_offset = offset;
-			offset += ipv6_optlen(exthdr);
-			if (!zero_out_mutable_opts(exthdr)) {
-				if (net_ratelimit())
-					printk(KERN_WARNING "overrun hopopts\n"); 
-				return 0;
-			}
-			nexthdr = exthdr->nexthdr;
-			exthdr = (struct ipv6_opt_hdr*)(skb->nh.raw + offset);
-			break;
-
-		case NEXTHDR_ROUTING:
-			*nh_offset = offset;
-			offset += ipv6_optlen(exthdr);
-			((struct ipv6_rt_hdr*)exthdr)->segments_left = 0; 
-			nexthdr = exthdr->nexthdr;
-			exthdr = (struct ipv6_opt_hdr*)(skb->nh.raw + offset);
-			break;
-
-		case NEXTHDR_DEST:
-			*nh_offset = offset;
-			offset += ipv6_optlen(exthdr);
-			if (!zero_out_mutable_opts(exthdr))  {
-				if (net_ratelimit())
-					printk(KERN_WARNING "overrun destopt\n"); 
-				return 0;
-			}
-			nexthdr = exthdr->nexthdr;
-			exthdr = (struct ipv6_opt_hdr*)(skb->nh.raw + offset);
-			break;
-
-		case NEXTHDR_AUTH:
-			if (dir == XFRM_POLICY_OUT) {
-				memset(((struct ipv6_auth_hdr*)exthdr)->auth_data, 0, 
-				       (((struct ipv6_auth_hdr*)exthdr)->hdrlen - 1) << 2);
-			}
-			if (exthdr->nexthdr == NEXTHDR_DEST) {
-				offset += (((struct ipv6_auth_hdr*)exthdr)->hdrlen + 2) << 2;
-				exthdr = (struct ipv6_opt_hdr*)(skb->nh.raw + offset);
-				nextnexthdr = exthdr->nexthdr;
-				if (!zero_out_mutable_opts(exthdr)) {
-					if (net_ratelimit())
-						printk(KERN_WARNING "overrun destopt\n");
-					return 0;
-				}
-			}
-			return nexthdr;
-		default :
-			return nexthdr;
-		}
-	}
-
-	return nexthdr;
-}
-
 int xfrm6_rcv(struct sk_buff **pskb, unsigned int *nhoffp)
 {
 	struct sk_buff *skb = *pskb;
@@ -132,26 +24,12 @@
 	struct xfrm_state *x;
 	int xfrm_nr = 0;
 	int decaps = 0;
-	struct ipv6hdr *hdr = skb->nh.ipv6h;
-	unsigned char *tmp_hdr = NULL;
-	int hdr_len = 0;
-	u16 nh_offset = 0;
 	int nexthdr = 0;
+	u8 *prevhdr = NULL;
 
-	nh_offset = ((unsigned char*)&skb->nh.ipv6h->nexthdr) - skb->nh.raw;
-	hdr_len = sizeof(struct ipv6hdr);
-
-	tmp_hdr = kmalloc(hdr_len, GFP_ATOMIC);
-	if (!tmp_hdr)
-		goto drop;
-	memcpy(tmp_hdr, skb->nh.raw, hdr_len);
-
-	nexthdr = xfrm6_clear_mutable_options(skb, &nh_offset, XFRM_POLICY_IN);
-	hdr->priority    = 0;
-	hdr->flow_lbl[0] = 0;
-	hdr->flow_lbl[1] = 0;
-	hdr->flow_lbl[2] = 0;
-	hdr->hop_limit   = 0;
+	ip6_find_1stfragopt(skb, &prevhdr);
+	nexthdr = *prevhdr;
+	*nhoffp = prevhdr - skb->nh.raw;
 
 	if ((err = xfrm_parse_spi(skb, nexthdr, &spi, &seq)) != 0)
 		goto drop;
@@ -204,12 +82,6 @@
 			goto drop;
 	} while (!err);
 
-	if (!decaps) {
-		memcpy(skb->nh.raw, tmp_hdr, hdr_len);
-		skb->nh.raw[nh_offset] = nexthdr;
-		skb->nh.ipv6h->payload_len = htons(hdr_len + skb->len - sizeof(struct ipv6hdr));
-	}
-
 	/* Allocate new secpath or COW existing one. */
 	if (!skb->sp || atomic_read(&skb->sp->refcnt) != 1) {
 		kmem_cache_t *pool = skb->sp ? skb->sp->pool : secpath_cachep;
@@ -243,7 +115,6 @@
 		netif_rx(skb);
 		return -1;
 	} else {
-		*nhoffp = nh_offset;
 		return 1;
 	}
 
@@ -251,7 +122,6 @@
 	spin_unlock(&x->lock);
 	xfrm_state_put(x);
 drop:
-	if (tmp_hdr) kfree(tmp_hdr);
 	while (--xfrm_nr >= 0)
 		xfrm_state_put(xfrm_vec[xfrm_nr].xvec);
 	kfree_skb(skb);
diff -urN linux-2.5.71-bk1/net/sunrpc/rpc_pipe.c linux-2.5.71-bk2/net/sunrpc/rpc_pipe.c
--- linux-2.5.71-bk1/net/sunrpc/rpc_pipe.c	2003-06-14 12:18:06.000000000 -0700
+++ linux-2.5.71-bk2/net/sunrpc/rpc_pipe.c	2003-06-16 04:45:36.000000000 -0700
@@ -472,30 +472,37 @@
 rpc_depopulate(struct dentry *parent)
 {
 	struct inode *dir = parent->d_inode;
-	HLIST_HEAD(head);
 	struct list_head *pos, *next;
-	struct dentry *dentry;
+	struct dentry *dentry, *dvec[10];
+	int n = 0;
 
 	down(&dir->i_sem);
+repeat:
 	spin_lock(&dcache_lock);
 	list_for_each_safe(pos, next, &parent->d_subdirs) {
 		dentry = list_entry(pos, struct dentry, d_child);
+		spin_lock(&dentry->d_lock);
 		if (!d_unhashed(dentry)) {
 			dget_locked(dentry);
 			__d_drop(dentry);
-			hlist_add_head(&dentry->d_hash, &head);
-		}
+			spin_unlock(&dentry->d_lock);
+			dvec[n++] = dentry;
+			if (n == ARRAY_SIZE(dvec))
+				break;
+		} else
+			spin_unlock(&dentry->d_lock);
 	}
 	spin_unlock(&dcache_lock);
-	while (!hlist_empty(&head)) {
-		dentry = list_entry(head.first, struct dentry, d_hash);
-		/* Private list, so no dcache_lock needed and use __d_drop */
-		__d_drop(dentry);
-		if (dentry->d_inode) {
-			rpc_inode_setowner(dentry->d_inode, NULL);
-			simple_unlink(dir, dentry);
-		}
-		dput(dentry);
+	if (n) {
+		do {
+			dentry = dvec[--n];
+			if (dentry->d_inode) {
+				rpc_inode_setowner(dentry->d_inode, NULL);
+				simple_unlink(dir, dentry);
+			}
+			dput(dentry);
+		} while (n);
+		goto repeat;
 	}
 	up(&dir->i_sem);
 }
diff -urN linux-2.5.71-bk1/net/xfrm/xfrm_state.c linux-2.5.71-bk2/net/xfrm/xfrm_state.c
--- linux-2.5.71-bk1/net/xfrm/xfrm_state.c	2003-06-14 12:18:29.000000000 -0700
+++ linux-2.5.71-bk2/net/xfrm/xfrm_state.c	2003-06-16 04:45:36.000000000 -0700
@@ -513,7 +513,7 @@
 		maxspi = ntohl(maxspi);
 		for (h=0; h<maxspi-minspi+1; h++) {
 			spi = minspi + net_random()%(maxspi-minspi+1);
-			x0 = xfrm_state_lookup(&x->id.daddr, minspi, x->id.proto, x->props.family);
+			x0 = xfrm_state_lookup(&x->id.daddr, htonl(spi), x->id.proto, x->props.family);
 			if (x0 == NULL)
 				break;
 			xfrm_state_put(x0);
