## Automatically generated incremental diff
## From:   linux-2.2.19-pre12
## To:     linux-2.2.19-pre13
## Robot:  $Id: make-incremental-diff,v 1.6 2001/12/04 04:41:15 hpa Exp $

diff -urN linux-2.2.19-pre12/CREDITS linux/CREDITS
--- linux-2.2.19-pre12/CREDITS	Mon Dec  3 21:05:46 2001
+++ linux/CREDITS	Mon Dec  3 21:06:06 2001
@@ -880,13 +880,13 @@
 S: USA
 
 N: Benjamin Herrenschmidt
-E: bh40@calva.net
+E: benh@kernel.crashing.org
 E: benh@mipsys.com
-D: PowerMac booter (BootX)
+D: PowerMac booters (BootX, yaboot)
 D: Additional PowerBook support
 D: Apple "Core99" machines support (ibook,g4,...)
-S: 22, rue des Marguettes
-S: 75012 Paris
+S: 122, blvd. Baille
+S: 13005 Marseille
 S: France
 
 N: Sebastian Hetze
diff -urN linux-2.2.19-pre12/Documentation/Configure.help linux/Documentation/Configure.help
--- linux-2.2.19-pre12/Documentation/Configure.help	Mon Dec  3 21:05:46 2001
+++ linux/Documentation/Configure.help	Mon Dec  3 21:06:06 2001
@@ -2237,14 +2237,6 @@
 
   If unsure, say Y.
 
-IEEE1284 transfer modes
-CONFIG_PARPORT_1284
-  If you have a printer that supports status readback or device ID, or
-  want to use a device that uses enhanced parallel port transfer modes
-  such as EPP, you can say Y here to enable advanced IEEE 1284
-  transfer modes. Also say Y if you want device ID information to
-  appear in /proc/parport/*/autoprobe*. It is safe to say N.
- 
 PC-style hardware 
 CONFIG_PARPORT_PC
   You should say Y here if you have a PC-style parallel port. All IBM
diff -urN linux-2.2.19-pre12/Makefile linux/Makefile
--- linux-2.2.19-pre12/Makefile	Mon Dec  3 21:05:47 2001
+++ linux/Makefile	Mon Dec  3 21:06:06 2001
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 2
 SUBLEVEL = 19
-EXTRAVERSION = pre11
+EXTRAVERSION = pre13
 
 ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
 
diff -urN linux-2.2.19-pre12/arch/alpha/config.in linux/arch/alpha/config.in
--- linux-2.2.19-pre12/arch/alpha/config.in	Sun Dec 10 16:49:41 2000
+++ linux/arch/alpha/config.in	Mon Dec  3 21:06:06 2001
@@ -252,9 +252,11 @@
 mainmenu_option next_comment
 comment 'ISDN subsystem'
 
-tristate 'ISDN support' CONFIG_ISDN
-if [ "$CONFIG_ISDN" != "n" ]; then
-  source drivers/isdn/Config.in
+if [ "$CONFIG_NET" != "n" ]; then
+   tristate 'ISDN support' CONFIG_ISDN
+   if [ "$CONFIG_ISDN" != "n" ]; then
+      source drivers/isdn/Config.in
+   fi
 fi
 endmenu
 
diff -urN linux-2.2.19-pre12/arch/alpha/kernel/process.c linux/arch/alpha/kernel/process.c
--- linux-2.2.19-pre12/arch/alpha/kernel/process.c	Mon Dec  3 21:05:47 2001
+++ linux/arch/alpha/kernel/process.c	Mon Dec  3 21:06:06 2001
@@ -475,3 +475,29 @@
 	unlock_kernel();
 	return error;
 }
+
+#ifdef __SMP__
+/*
+ * execve() system call for in kernel use.
+ *
+ * Two(user and kernel) execve() have quite different call path and
+ * following function puts lock_kernel() and unlock_kernel() in kernel
+ * execve().  You could put them in unistd.h but you will have to
+ * modify many files to clear compile error -
+ *
+ * soohoon.lee@api-networks.com.  */
+
+asmlinkage int ___kernel_execve(char *filename, char **argp, char **envp,
+	struct pt_regs *regs)
+{
+	int error;
+
+	lock_kernel();
+
+	error = do_execve(filename, argp, envp, regs);
+
+	unlock_kernel();
+
+	return error;
+}
+#endif /* __SMP__ */
diff -urN linux-2.2.19-pre12/arch/i386/defconfig linux/arch/i386/defconfig
--- linux-2.2.19-pre12/arch/i386/defconfig	Sun Dec 10 16:49:41 2000
+++ linux/arch/i386/defconfig	Mon Dec  3 21:06:06 2001
@@ -21,6 +21,9 @@
 CONFIG_X86_POPAD_OK=y
 CONFIG_X86_TSC=y
 CONFIG_X86_GOOD_APIC=y
+# CONFIG_MICROCODE is not set
+# CONFIG_X86_MSR is not set
+# CONFIG_X86_CPUID is not set
 CONFIG_1GB=y
 # CONFIG_2GB is not set
 # CONFIG_MATH_EMULATION is not set
@@ -58,6 +61,7 @@
 CONFIG_BINFMT_MISC=y
 # CONFIG_PARPORT is not set
 # CONFIG_APM is not set
+# CONFIG_TOSHIBA is not set
 
 #
 # Plug and Play support
@@ -100,6 +104,7 @@
 CONFIG_PARIDE_PARPORT=y
 # CONFIG_PARIDE is not set
 # CONFIG_BLK_CPQ_DA is not set
+# CONFIG_BLK_CPQ_CISS_DA is not set
 # CONFIG_BLK_DEV_HD is not set
 
 #
@@ -133,6 +138,11 @@
 # CONFIG_ATALK is not set
 
 #
+# QoS and/or fair queueing
+#
+# CONFIG_NET_SCHED is not set
+
+#
 # Telephony Support
 #
 # CONFIG_PHONE is not set
@@ -148,6 +158,7 @@
 #
 CONFIG_BLK_DEV_SD=y
 # CONFIG_CHR_DEV_ST is not set
+# CONFIG_CHR_DEV_OSST is not set
 # CONFIG_BLK_DEV_SR is not set
 # CONFIG_CHR_DEV_SG is not set
 
@@ -166,7 +177,6 @@
 # CONFIG_SCSI_AHA152X is not set
 # CONFIG_SCSI_AHA1542 is not set
 # CONFIG_SCSI_AHA1740 is not set
-# CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
 # CONFIG_SCSI_IPS is not set
 # CONFIG_SCSI_ADVANSYS is not set
@@ -174,6 +184,7 @@
 # CONFIG_SCSI_AM53C974 is not set
 # CONFIG_SCSI_MEGARAID is not set
 # CONFIG_SCSI_BUSLOGIC is not set
+# CONFIG_SCSI_CPQFCTS is not set
 # CONFIG_SCSI_DTC3280 is not set
 # CONFIG_SCSI_EATA is not set
 # CONFIG_SCSI_EATA_DMA is not set
@@ -192,7 +203,6 @@
 CONFIG_SCSI_NCR53C8XX_DEFAULT_TAGS=4
 CONFIG_SCSI_NCR53C8XX_MAX_TAGS=32
 CONFIG_SCSI_NCR53C8XX_SYNC=20
-# CONFIG_SCSI_NCR53C8XX_PROFILE is not set
 # CONFIG_SCSI_NCR53C8XX_IOMAPPED is not set
 # CONFIG_SCSI_NCR53C8XX_PQS_PDS is not set
 # CONFIG_SCSI_PAS16 is not set
@@ -209,6 +219,14 @@
 # CONFIG_SCSI_ULTRASTOR is not set
 
 #
+# I2O device support
+#
+# CONFIG_I2O is not set
+# CONFIG_I2O_PCI is not set
+# CONFIG_I2O_BLOCK is not set
+# CONFIG_I2O_SCSI is not set
+
+#
 # Network device support
 #
 CONFIG_NETDEVICES=y
@@ -218,6 +236,7 @@
 #
 # CONFIG_ARCNET is not set
 CONFIG_DUMMY=m
+# CONFIG_BONDING is not set
 # CONFIG_EQUALIZER is not set
 # CONFIG_NET_SB1000 is not set
 
@@ -233,8 +252,8 @@
 CONFIG_NET_EISA=y
 # CONFIG_PCNET32 is not set
 # CONFIG_APRICOT is not set
+# CONFIG_LP486E is not set
 # CONFIG_CS89x0 is not set
-# CONFIG_DM9102 is not set
 # CONFIG_DE4X5 is not set
 # CONFIG_DEC_ELCP is not set
 # CONFIG_DEC_ELCP_OLD is not set
@@ -267,9 +286,12 @@
 # CONFIG_HOSTESS_SV11 is not set
 # CONFIG_COSA is not set
 # CONFIG_SEALEVEL_4021 is not set
+# CONFIG_SYNCLINK_SYNCPPP is not set
+# CONFIG_LANMEDIA is not set
 # CONFIG_COMX is not set
 # CONFIG_DLCI is not set
 # CONFIG_WAN_DRIVERS is not set
+# CONFIG_XPEED is not set
 # CONFIG_SBNI is not set
 
 #
@@ -323,6 +345,7 @@
 # CONFIG_WATCHDOG is not set
 # CONFIG_NVRAM is not set
 # CONFIG_RTC is not set
+# CONFIG_INTEL_RNG is not set
 
 #
 # Video For Linux
@@ -336,6 +359,11 @@
 # CONFIG_FTAPE is not set
 
 #
+# USB support
+#
+# CONFIG_USB is not set
+
+#
 # Filesystems
 #
 # CONFIG_QUOTA is not set
@@ -363,6 +391,8 @@
 #
 # CONFIG_CODA_FS is not set
 CONFIG_NFS_FS=y
+# CONFIG_NFS_V3 is not set
+# CONFIG_NFSD is not set
 CONFIG_SUNRPC=y
 CONFIG_LOCKD=y
 # CONFIG_SMB_FS is not set
@@ -373,6 +403,7 @@
 #
 # CONFIG_BSD_DISKLABEL is not set
 # CONFIG_MAC_PARTITION is not set
+# CONFIG_MINIX_SUBPARTITION is not set
 # CONFIG_SMD_DISKLABEL is not set
 # CONFIG_SOLARIS_X86_PARTITION is not set
 # CONFIG_NLS is not set
diff -urN linux-2.2.19-pre12/arch/ppc/config.in linux/arch/ppc/config.in
--- linux-2.2.19-pre12/arch/ppc/config.in	Mon Dec  3 21:05:47 2001
+++ linux/arch/ppc/config.in	Mon Dec  3 21:06:06 2001
@@ -151,9 +151,11 @@
 mainmenu_option next_comment
 comment 'ISDN subsystem'
 
-tristate 'ISDN support' CONFIG_ISDN
-if [ "$CONFIG_ISDN" != "n" ]; then
-  source drivers/isdn/Config.in
+if [ "$CONFIG_NET" != "n" ]; then
+   tristate 'ISDN support' CONFIG_ISDN
+   if [ "$CONFIG_ISDN" != "n" ]; then
+      source drivers/isdn/Config.in
+   fi
 fi
 endmenu
 
@@ -177,7 +179,9 @@
 mainmenu_option next_comment
 comment 'Mac device drivers'
 
-bool 'Use input layer for ADB keyboard and mouse' CONFIG_INPUT_ADBHID
+if [ "$CONFIG_INPUT_KEYBDEV" = "y" -o "$CONFIG_INPUT_MOUSEDEV" = "y" ]; then
+  bool 'Use input layer for ADB keyboard and mouse' CONFIG_INPUT_ADBHID
+fi
 if [ "$CONFIG_INPUT_ADBHID" = "y" ]; then
   define_bool CONFIG_INPUT_KEYBDEV $CONFIG_VT
   define_bool CONFIG_INPUT_MOUSEDEV y
diff -urN linux-2.2.19-pre12/arch/ppc/kernel/feature.c linux/arch/ppc/kernel/feature.c
--- linux-2.2.19-pre12/arch/ppc/kernel/feature.c	Sun Dec 10 16:49:41 2000
+++ linux/arch/ppc/kernel/feature.c	Mon Dec  3 21:06:06 2001
@@ -2,7 +2,7 @@
  *  arch/ppc/kernel/feature.c
  *
  *  Copyright (C) 1996 Paul Mackerras (paulus@cs.anu.edu.au)
- *                     Ben. Herrenschmidt (bh40@calva.net)
+ *                     Ben. Herrenschmidt (benh@kernel.crashing.org)
  *
  *  This program is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU General Public License
diff -urN linux-2.2.19-pre12/arch/ppc/kernel/openpic.c linux/arch/ppc/kernel/openpic.c
--- linux-2.2.19-pre12/arch/ppc/kernel/openpic.c	Sun Dec 10 16:49:41 2000
+++ linux/arch/ppc/kernel/openpic.c	Mon Dec  3 21:06:06 2001
@@ -8,8 +8,7 @@
  *
  *  Added initialisation code for Apple Core99 machines, tweaked a few things
  *  to avoid bogus interrupts and to make sure the disable function exits with
- *  the interrupt actually masked.
- *    Benjamin Herrenschmidt <bh40@calva.net>
+ *  the interrupt actually masked. --BenH
  *  Todo: map interrupts to all available CPUs after the ack round
  * 
  *  This file is subject to the terms and conditions of the GNU General Public
diff -urN linux-2.2.19-pre12/arch/ppc/kernel/pmac_setup.c linux/arch/ppc/kernel/pmac_setup.c
--- linux-2.2.19-pre12/arch/ppc/kernel/pmac_setup.c	Mon Dec  3 21:05:47 2001
+++ linux/arch/ppc/kernel/pmac_setup.c	Mon Dec  3 21:06:06 2001
@@ -449,6 +449,16 @@
 
 #ifdef CONFIG_BLK_DEV_IDE_PMAC
 
+void
+ide_pmac_init(void)
+{
+	if (_machine == _MACH_Pmac)
+		pmu_suspend();
+	ide_init();	
+	if (_machine == _MACH_Pmac)
+		pmu_resume();
+}
+
 extern kdev_t pmac_find_ide_boot(char *bootdevice, int n);
 
 __initfunc(kdev_t find_ide_boot(void))
diff -urN linux-2.2.19-pre12/arch/ppc/kernel/prom.c linux/arch/ppc/kernel/prom.c
--- linux-2.2.19-pre12/arch/ppc/kernel/prom.c	Sun Dec 10 16:49:41 2000
+++ linux/arch/ppc/kernel/prom.c	Mon Dec  3 21:06:06 2001
@@ -668,8 +668,8 @@
 	}
 	
 #endif	
-	/* If OpenFirmware version >= 3, then use quiesce call */
-	if (RELOC(prom_version) >= 3) {
+	/* If PowerMac, then use quiesce call */
+	if (!chrp) {
 	    prom_print(RELOC("Calling quiesce ...\n"));
 	    call_prom(RELOC("quiesce"), 0, 0);
 	    offset = reloc_offset();
diff -urN linux-2.2.19-pre12/arch/ppc/kernel/sleep.S linux/arch/ppc/kernel/sleep.S
--- linux-2.2.19-pre12/arch/ppc/kernel/sleep.S	Sun Dec 10 16:49:41 2000
+++ linux/arch/ppc/kernel/sleep.S	Mon Dec  3 21:06:06 2001
@@ -1,6 +1,6 @@
 /*
  * This file contains sleep low-level functions for PowerBook G3.
- *    Copyright (C) 1999 Benjamin Herrenschmidt (bh40@calva.net)
+ *    Copyright (C) 1999 Benjamin Herrenschmidt (benh@kernel.crashing.org)
  *    and Paul Mackerras (paulus@cs.anu.edu.au).
  *
  * This program is free software; you can redistribute it and/or
diff -urN linux-2.2.19-pre12/arch/sparc/config.in linux/arch/sparc/config.in
--- linux-2.2.19-pre12/arch/sparc/config.in	Sun Dec 10 16:49:41 2000
+++ linux/arch/sparc/config.in	Mon Dec  3 21:06:06 2001
@@ -133,9 +133,11 @@
 mainmenu_option next_comment
 comment 'ISDN subsystem'
 
-tristate 'ISDN support' CONFIG_ISDN
-if [ "$CONFIG_ISDN" != "n" ]; then
-  source drivers/isdn/Config.in
+if [ "$CONFIG_NET" != "n" ]; then
+   tristate 'ISDN support' CONFIG_ISDN
+   if [ "$CONFIG_ISDN" != "n" ]; then
+      source drivers/isdn/Config.in
+   fi
 fi
 endmenu
 
diff -urN linux-2.2.19-pre12/drivers/block/ll_rw_blk.c linux/drivers/block/ll_rw_blk.c
--- linux-2.2.19-pre12/drivers/block/ll_rw_blk.c	Sun Dec 10 16:49:41 2000
+++ linux/drivers/block/ll_rw_blk.c	Mon Dec  3 21:06:06 2001
@@ -24,6 +24,10 @@
 #include <asm/uaccess.h>
 #include <linux/blk.h>
 
+#ifdef CONFIG_POWERMAC
+#include <asm/ide.h>
+#endif
+
 #include <linux/module.h>
 
 /*
@@ -971,7 +975,11 @@
 	isp16_init();
 #endif CONFIG_ISP16_CDI
 #ifdef CONFIG_BLK_DEV_IDE
+#ifdef CONFIG_POWERMAC
+	ide_pmac_init();
+#else
 	ide_init();		/* this MUST precede hd_init */
+#endif
 #endif
 #ifdef CONFIG_BLK_DEV_HD
 	hd_init();
diff -urN linux-2.2.19-pre12/drivers/char/Config.in linux/drivers/char/Config.in
--- linux-2.2.19-pre12/drivers/char/Config.in	Mon Dec  3 21:05:47 2001
+++ linux/drivers/char/Config.in	Mon Dec  3 21:06:06 2001
@@ -60,7 +60,7 @@
 if [ "$CONFIG_UNIX98_PTYS" = "y" ]; then
 	int 'Maximum number of Unix98 PTYs in use (0-2048)' CONFIG_UNIX98_PTY_COUNT 256
 fi
-if [ "$CONFIG_PARPORT" != "n" ]; then
+if [ "$CONFIG_PARPORT" = "y" -o "$CONFIG_PARPORT" = "m" ]; then
   dep_tristate 'Parallel printer support' CONFIG_PRINTER $CONFIG_PARPORT
   if [ "$CONFIG_PRINTER" != "n" ]; then
     bool '  Support IEEE1284 status readback' CONFIG_PRINTER_READBACK
@@ -128,7 +128,7 @@
 fi
 
 if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
-   tristate '/dev/agpgart (AGP Support) (EXPERIMENTAL)' CONFIG_AGP n
+   tristate '/dev/agpgart (AGP Support) (EXPERIMENTAL)' CONFIG_AGP
    if [ "$CONFIG_AGP" != "n" ]; then
       bool '   Intel 440LX/BX/GX and I815/820 support' CONFIG_AGP_INTEL
       bool '   Intel I810/I815 (on-board video) support' CONFIG_AGP_I810
@@ -168,24 +168,22 @@
   if [ "$CONFIG_RADIO_TRUST" = "y" ]; then
     hex '  Trust FM Radio I/O port (0x350 or 0x358)' CONFIG_RADIO_TRUST_PORT 350
   fi
-  if [ "$CONFIG_PCI" != "n" ]; then
+  if [ "$CONFIG_PCI" = "y" ]; then
     dep_tristate 'BT848 Video For Linux' CONFIG_VIDEO_BT848 $CONFIG_VIDEO_DEV
     if [ "$CONFIG_VIDEO_BT848" != "n" ]; then
       comment '  MSP3400 sound decoder support is in the section "additional'
       comment '  low level sound drivers". You may need to enable it there.'
     fi
   fi
-  if [ "$CONFIG_PARPORT" != "n" ]; then
+  if [ "$CONFIG_PARPORT" = "y" -o "$CONFIG_PARPORT" = "m" ]; then
     dep_tristate 'Quickcam BW Video For Linux' CONFIG_VIDEO_BWQCAM $CONFIG_VIDEO_DEV $CONFIG_PARPORT
     dep_tristate 'Colour QuickCam Video For Linux (EXPERIMENTAL)' CONFIG_VIDEO_CQCAM $CONFIG_VIDEO_DEV $CONFIG_PARPORT
   fi
   if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
     dep_tristate 'CPiA Video For Linux' CONFIG_VIDEO_CPIA $CONFIG_VIDEO_DEV
     if [ "$CONFIG_VIDEO_CPIA" != "n" ]; then
-      if [ "CONFIG_PARPORT_1284" != "n" ]; then
-        dep_tristate '  CPiA Parallel Port Lowlevel Support' CONFIG_VIDEO_CPIA_PP $CONFIG_VIDEO_CPIA $CONFIG_PARPORT
-      fi
-      if [ "$CONFIG_USB" != "n" ]; then
+      dep_tristate '  CPiA Parallel Port Lowlevel Support' CONFIG_VIDEO_CPIA_PP $CONFIG_VIDEO_CPIA $CONFIG_PARPORT
+      if [ "$CONFIG_USB" = "y" -o "$CONFIG_USB" = "m" ]; then
         dep_tristate '  CPiA USB Lowlevel Support' CONFIG_VIDEO_CPIA_USB $CONFIG_VIDEO_CPIA $CONFIG_USB
       fi
     fi
diff -urN linux-2.2.19-pre12/drivers/char/serial.c linux/drivers/char/serial.c
--- linux-2.2.19-pre12/drivers/char/serial.c	Mon Dec  3 21:05:47 2001
+++ linux/drivers/char/serial.c	Mon Dec  3 21:06:06 2001
@@ -150,6 +150,12 @@
 #include <asm/bitops.h>
 #include <asm/serial.h>
 
+#ifdef CONFIG_MAC_SERIAL
+#define SERIAL_DEV_OFFSET	4
+#else
+#define SERIAL_DEV_OFFSET	0
+#endif
+
 #ifdef SERIAL_INLINE
 #define _INLINE_ inline
 #endif
@@ -2622,7 +2628,7 @@
 	tty->driver_data = info;
 	info->tty = tty;
 	if (serial_paranoia_check(info, tty->device, "rs_open")) {
-		MOD_DEC_USE_COUNT;
+		/* MOD_DEC_USE_COUNT; "info->tty" will cause this */
 		return -ENODEV;
 	}
 
@@ -2635,7 +2641,7 @@
 	if (!tmp_buf) {
 		page = get_free_page(GFP_KERNEL);
 		if (!page) {
-			MOD_DEC_USE_COUNT;
+			/* MOD_DEC_USE_COUNT; "info->tty" will cause this? */
 			return -ENOMEM;
 		}
 		if (tmp_buf)
@@ -2651,7 +2657,7 @@
 	    (info->flags & ASYNC_CLOSING)) {
 		if (info->flags & ASYNC_CLOSING)
 			interruptible_sleep_on(&info->close_wait);
-		MOD_DEC_USE_COUNT;
+		/* MOD_DEC_USE_COUNT; "info->tty" will cause this? */
 #ifdef SERIAL_DO_RESTART
 		return ((info->flags & ASYNC_HUP_NOTIFY) ?
 			-EAGAIN : -ERESTARTSYS);
@@ -2665,13 +2671,13 @@
 	 */
 	retval = startup(info);
 	if (retval) {
-		MOD_DEC_USE_COUNT;
+		/* MOD_DEC_USE_COUNT; "info->tty" will cause this? */
 		return retval;
 	}
 
 	retval = block_til_ready(tty, filp, info);
 	if (retval) {
-		MOD_DEC_USE_COUNT;
+		/* MOD_DEC_USE_COUNT; "info->tty" will cause this? */
 #ifdef SERIAL_DEBUG_OPEN
 		printk("rs_open returning after block_til_ready with %d\n",
 		       retval);
@@ -3130,7 +3136,7 @@
 	serial_driver.driver_name = "serial";
 	serial_driver.name = "ttyS";
 	serial_driver.major = TTY_MAJOR;
-	serial_driver.minor_start = 64;
+	serial_driver.minor_start = 64 + SERIAL_DEV_OFFSET;
 	serial_driver.num = NR_PORTS;
 	serial_driver.type = TTY_DRIVER_TYPE_SERIAL;
 	serial_driver.subtype = SERIAL_TYPE_NORMAL;
@@ -3194,11 +3200,22 @@
 		state->icount.frame = state->icount.parity = 0;
 		state->icount.overrun = state->icount.brk = 0;
 		state->irq = irq_cannonicalize(state->irq);
-		if (check_region(state->port,8))
-			continue;
-		if (state->flags & ASYNC_BOOT_AUTOCONF)
-			autoconfig(state);
+#ifdef CONFIG_PPC
+		/* PowerMacs don't have legacy serial ports on IOs and would machine check */
+		if (_machine != _MACH_Pmac) {
+#endif		
+			if (check_region(state->port,8))
+				continue;
+			if (state->flags & ASYNC_BOOT_AUTOCONF)
+				autoconfig(state);
+#ifdef CONFIG_PPC
+		}
+#endif		
 	}
+#ifdef CONFIG_PPC
+	if (_machine == _MACH_Pmac)
+		return 0;
+#endif
 	/*
 	 * Detect the IRQ only once every port is initialised,
 	 * because some 16450 do not reset to 0 the MCR register.
@@ -3268,22 +3285,22 @@
 		state->irq = detect_uart_irq(state);
 
 	printk(KERN_INFO "tty%02d at 0x%04x (irq = %d) is a %s\n",
-	       state->line, state->port, state->irq,
+	       state->line + SERIAL_DEV_OFFSET, state->port, state->irq,
 	       uart_config[state->type].name);
-	return state->line;
+	return state->line + SERIAL_DEV_OFFSET;
 }
 
 void unregister_serial(int line)
 {
 	unsigned long flags;
-	struct serial_state *state = &rs_table[line];
+	struct serial_state *state = &rs_table[line + SERIAL_DEV_OFFSET];
 
 	save_flags(flags);
 	cli();
 	if (state->info && state->info->tty)
 		tty_hangup(state->info->tty);
 	state->type = PORT_UNKNOWN;
-	printk(KERN_INFO "tty%02d unloaded\n", state->line);
+	printk(KERN_INFO "tty%02d unloaded\n", state->line + SERIAL_DEV_OFFSET);
 	restore_flags(flags);
 }
 
diff -urN linux-2.2.19-pre12/drivers/char/tty_io.c linux/drivers/char/tty_io.c
--- linux-2.2.19-pre12/drivers/char/tty_io.c	Mon Dec  3 21:05:47 2001
+++ linux/drivers/char/tty_io.c	Sun Dec 10 16:49:42 2000
@@ -54,9 +54,6 @@
  *
  * Added support for a Unix98-style ptmx device.
  *      -- C. Scott Ananian <cananian@alumni.princeton.edu>, 14-Jan-1998
- *
- * Don't call close after a failed open.
- *	-- Maciej W. Rozycki <macro@ds2.pg.gda.pl>, 21-Jan-2001
  */
 
 #include <linux/config.h>
@@ -1012,7 +1009,7 @@
  * WSH 09/09/97: rewritten to avoid some nasty race conditions that could
  * lead to double frees or releasing memory still in use.
  */
-static void release_dev(struct file * filp, int do_close)
+static void release_dev(struct file * filp)
 {
 	struct tty_struct *tty, *o_tty;
 	int	pty_master, tty_closing, o_tty_closing, do_sleep;
@@ -1090,7 +1087,7 @@
 	}
 #endif
 
-	if (do_close && tty->driver.close)
+	if (tty->driver.close)
 		tty->driver.close(tty, filp);
 
 	/*
@@ -1261,7 +1258,7 @@
 static int tty_open(struct inode * inode, struct file * filp)
 {
 	struct tty_struct *tty;
-	int noctty, retval, open_ok;
+	int noctty, retval;
 	kdev_t device;
 	unsigned short saved_flags;
 	char	buf[64];
@@ -1343,12 +1340,9 @@
 #ifdef TTY_DEBUG_HANGUP
 	printk("opening %s...", tty_name(tty, buf));
 #endif
-	open_ok = 0;
-	if (tty->driver.open) {
+	if (tty->driver.open)
 		retval = tty->driver.open(tty, filp);
-		if (!retval)
-			open_ok = 1;
-	} else
+	else
 		retval = -ENODEV;
 	filp->f_flags = saved_flags;
 
@@ -1361,7 +1355,7 @@
 		       tty_name(tty, buf));
 #endif
 
-		release_dev(filp, open_ok);
+		release_dev(filp);
 		if (retval != -ERESTARTSYS)
 			return retval;
 		if (signal_pending(current))
@@ -1400,7 +1394,7 @@
 
 static int tty_release(struct inode * inode, struct file * filp)
 {
-	release_dev(filp, 1);
+	release_dev(filp);
 	return 0;
 }
 
diff -urN linux-2.2.19-pre12/drivers/isdn/Config.in linux/drivers/isdn/Config.in
--- linux-2.2.19-pre12/drivers/isdn/Config.in	Mon Dec  3 21:05:47 2001
+++ linux/drivers/isdn/Config.in	Mon Dec  3 21:06:06 2001
@@ -16,7 +16,9 @@
 if [ "$CONFIG_ISDN_AUDIO" != "n" ]; then
    bool '    Support AT-Fax Class 1 and 2 commands' CONFIG_ISDN_TTY_FAX
 fi
-if [ "$CONFIG_X25" != "n" ]; then
+
+#  CONFIG_X25 is defined only when CONFIG_EXPERIMENTAL=y
+if [ "$CONFIG_EXPERIMENTAL" = "y" -a "$CONFIG_X25" != "n" ]; then
    bool '  X.25 PLP on top of ISDN' CONFIG_ISDN_X25
 fi
 
diff -urN linux-2.2.19-pre12/drivers/net/Config.in linux/drivers/net/Config.in
--- linux-2.2.19-pre12/drivers/net/Config.in	Mon Dec  3 21:05:47 2001
+++ linux/drivers/net/Config.in	Mon Dec  3 21:06:17 2001
@@ -188,7 +188,9 @@
       tristate 'Packet Engines GNIC-II (Hamachi) support' CONFIG_HAMACHI
       tristate 'Packet Engines Yellowfin Gigabit-NIC support' CONFIG_YELLOWFIN
     fi
-    dep_tristate 'SysKonnect SK-98xx support' CONFIG_SK98LIN $CONFIG_PCI
+    if [ "$CONFIG_PCI" = "y" ]; then
+      tristate 'SysKonnect SK-98xx support' CONFIG_SK98LIN
+    fi
 endmenu
 
 bool 'FDDI driver support' CONFIG_FDDI
@@ -311,7 +313,7 @@
 #
 
 tristate 'MultiGate (COMX) synchronous serial boards support' CONFIG_COMX
-   if [ "$CONFIG_COMX" != "n" ]; then
+if [ "$CONFIG_COMX" != "n" ]; then
    dep_tristate '  Support for COMX/CMX/HiCOMX boards' CONFIG_COMX_HW_COMX $CONFIG_COMX
    dep_tristate '  Support for LoCOMX board' CONFIG_COMX_HW_LOCOMX $CONFIG_COMX
    dep_tristate '  Support for MixCOM board' CONFIG_COMX_HW_MIXCOM $CONFIG_COMX
@@ -332,7 +334,7 @@
     dep_tristate '  SDL RISCom/N2 support' CONFIG_N2 $CONFIG_HDLC
     dep_tristate '  Moxa C101 support' CONFIG_C101 $CONFIG_HDLC
 
-    if [ "$CONFIG_PCI" != "n" ]; then
+    if [ "$CONFIG_PCI" = "y" ]; then
       dep_tristate '  SBE wanXL support' CONFIG_WANXL $CONFIG_HDLC
       dep_tristate '  Cyclades-PC300 support' CONFIG_PC300 $CONFIG_HDLC
       if [ "$CONFIG_PC300" != "n" ]; then
@@ -353,12 +355,13 @@
 #	Wan router core.
 #
 
-if [ "$CONFIG_WAN_ROUTER" != "n" ]; then
+#  CONFIG_WAN_ROUTER is defined only when CONFIG_EXPERIMENTAL=y
+if [ "$CONFIG_EXPERIMENTAL" = y -a "$CONFIG_WAN_ROUTER" != "n" ]; then
   bool 'WAN drivers' CONFIG_WAN_DRIVERS 
   if [ "$CONFIG_WAN_DRIVERS" = "y" ]; then
     dep_tristate 'Sangoma WANPIPE(tm) multi-port cards: (select M not Y !)' CONFIG_VENDOR_SANGOMA $CONFIG_WAN_DRIVERS 
     if [ "$CONFIG_INET" != "n" ]; then
-    if [ "$CONFIG_VENDOR_SANGOMA" != "n" ]; then
+      if [ "$CONFIG_VENDOR_SANGOMA" != "n" ]; then
         int  '  Maximum number of cards' CONFIG_WANPIPE_CARDS 1
         #bool '  WANPIPE X.25 support' CONFIG_WANPIPE_X25
         bool '  WANPIPE Frame Relay support' CONFIG_WANPIPE_FR
@@ -372,17 +375,21 @@
 #
 # Xpeed drivers
 #
-dep_tristate 'Xpeed X200/X300 DSL NIC support' CONFIG_XPEED $CONFIG_PCI
+if [ "$CONFIG_PCI" = "y" ]; then
+   tristate 'Xpeed X200/X300 DSL NIC support' CONFIG_XPEED
+fi
 
 endmenu
 
 #
 # X.25 network drivers
 #
-if [ "$CONFIG_X25" != "n" ]; then
-if [ "$CONFIG_LAPB" = "y" -o "$CONFIG_LAPB" = "m" ]; then
+
+#  CONFIG_X25 is defined only when CONFIG_EXPERIMENTAL=y
+if [ "$CONFIG_EXPERIMENTAL" = "y" -a "$CONFIG_X25" != "n" ]; then
+  if [ "$CONFIG_LAPB" = "y" -o "$CONFIG_LAPB" = "m" ]; then
     dep_tristate 'LAPB over Ethernet driver' CONFIG_LAPBETHER $CONFIG_LAPB
     dep_tristate 'X.25 async driver' CONFIG_X25_ASY $CONFIG_LAPB
-fi
+  fi
 fi
 tristate 'SBNI12-xx support' CONFIG_SBNI
diff -urN linux-2.2.19-pre12/drivers/net/gmac.c linux/drivers/net/gmac.c
--- linux-2.2.19-pre12/drivers/net/gmac.c	Sun Dec 10 16:49:42 2000
+++ linux/drivers/net/gmac.c	Mon Dec  3 21:06:18 2001
@@ -9,7 +9,7 @@
  * Changes:
  * Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 08/06/2000
  * - check init_etherdev return in gmac_probe1
- * BenH <bh40@calva.net> - 03/09/2000
+ * BenH <benh@kernel.crashing.org> - 03/09/2000
  * - Add support for new PHYs
  * - Add some PowerBook sleep code
  * 
diff -urN linux-2.2.19-pre12/drivers/net/tulip.c linux/drivers/net/tulip.c
--- linux-2.2.19-pre12/drivers/net/tulip.c	Mon Dec  3 21:05:47 2001
+++ linux/drivers/net/tulip.c	Mon Dec  3 21:06:18 2001
@@ -30,9 +30,6 @@
 
 /* A few user-configurable values. */
 
-/* Maximum events (Rx packets, etc.) to handle at each interrupt. */
-static int max_interrupt_work = 25;
-
 #define MAX_UNITS 8
 /* Used to pass the full-duplex flag, etc. */
 static int full_duplex[MAX_UNITS] = {0, };
@@ -143,7 +140,6 @@
 MODULE_AUTHOR("Donald Becker <becker@cesdis.gsfc.nasa.gov>");
 MODULE_DESCRIPTION("Digital 21*4* Tulip ethernet driver");
 MODULE_PARM(debug, "i");
-MODULE_PARM(max_interrupt_work, "i");
 MODULE_PARM(reverse_probe, "i");
 MODULE_PARM(rx_copybreak, "i");
 MODULE_PARM(csr0, "i");
@@ -153,10 +149,6 @@
 
 #define RUN_AT(x) (jiffies + (x))
 
-#if (LINUX_VERSION_CODE >= 0x20100)
-static char kernel_version[] = UTS_RELEASE;
-#endif
-
 #if LINUX_VERSION_CODE < 0x20123
 #define hard_smp_processor_id() smp_processor_id()
 #define test_and_set_bit(val, addr) set_bit(val, addr)
@@ -429,7 +421,7 @@
 {0,0,0,16,  3,19,16,24,  27,4,7,5, 0,20,23,20 };
 static u8 t21040_csr13[] = {2,0x0C,8,4,  4,0,0,0, 0,0,0,0, 4,0,0,0};
 /* 21041 transceiver register settings: 10-T, 10-2, AUI, 10-T, 10T-FD*/
-static u16 t21041_csr13[] = { 0xEF01, 0xEF09, 0xEF09, 0xEF01, 0xEF09, };
+static u16 t21041_csr13[] = { 0xEF05, 0xEF0D, 0xEF0D, 0xEF05, 0xEF05, };
 static u16 t21041_csr14[] = { 0xFFFF, 0xF7FD, 0xF7FD, 0x7F3F, 0x7F3D, };
 static u16 t21041_csr15[] = { 0x0008, 0x0006, 0x000E, 0x0008, 0x0008, };
 
@@ -590,7 +582,7 @@
 		return -ENODEV;
 
 	for (;pci_index < 0xff; pci_index++) {
-		u16 vendor, device, pci_command, new_command;
+		u16 vendor, device, pci_command, new_command, subvendor;
 		int chip_idx;
 		int irq;
 		long ioaddr;
@@ -608,6 +600,13 @@
 								 PCI_VENDOR_ID, &vendor);
 		pcibios_read_config_word(pci_bus, pci_device_fn,
 								 PCI_DEVICE_ID, &device);
+		pcibios_read_config_word(pci_bus, pci_device_fn,
+								 PCI_SUBSYSTEM_VENDOR_ID, &subvendor);
+		
+	        if( subvendor == 0x1376 ){
+			printk("tulip: skipping LMC card.\n");
+			continue;
+		}	
 
 		for (chip_idx = 0; pci_tbl[chip_idx].vendor_id; chip_idx++)
 			if (vendor == pci_tbl[chip_idx].vendor_id
@@ -749,13 +748,7 @@
 			put_unaligned(le16_to_cpu(value), ((u16*)dev->dev_addr) + i);
 			sum += value & 0xffff;
 		}
-	} else if (chip_idx == COMET){
-		/* No need to read the EEPROM. */
-		put_unaligned(inl(ioaddr + 0xA4), (u32 *)dev->dev_addr);
-		put_unaligned(inl(ioaddr + 0xA8), (u16 *)(dev->dev_addr + 4));
-		for (i = 0; i < 6; i ++)
-			sum += dev->dev_addr[i];
-	} else if (chip_idx == COMET5){
+	} else if ((chip_idx == COMET) || (chip_idx == COMET5)) {
 		/* No need to read the EEPROM. */
 		put_unaligned(inl(ioaddr + 0xA4), (u32 *)dev->dev_addr);
 		put_unaligned(inl(ioaddr + 0xA8), (u16 *)(dev->dev_addr + 4));
@@ -998,8 +991,6 @@
 		outl(0x00001000, ioaddr + CSR12);
 		break;
 	case COMET:
-		/* No initialization necessary. */
-		break;
 	case COMET5:
 		/* No initialization necessary. */
 		break;
@@ -1318,18 +1309,7 @@
 		return 0xffff;
 	}
 
-	if (tp->chip_id == COMET) {
-		if (phy_id == 1) {
-			if (location < 7)
-				return inl(ioaddr + 0xB4 + (location<<2));
-			else if (location == 17)
-				return inl(ioaddr + 0xD0);
-			else if (location >= 29 && location <= 31)
-				return inl(ioaddr + 0xD4 + ((location-29)<<2));
-		}
-		return 0xffff;
-	}
-	if (tp->chip_id == COMET5) {
+	if ((tp->chip_id == COMET) || (tp->chip_id == COMET5)) {
 		if (phy_id == 1) {
 			if (location < 7)
 				return inl(ioaddr + 0xB4 + (location<<2));
@@ -1386,19 +1366,7 @@
 		return;
 	}
 
-	if (tp->chip_id == COMET) {
-		if (phy_id != 1)
-			return;
-		if (location < 7)
-			outl(value, ioaddr + 0xB4 + (location<<2));
-		else if (location == 17)
-			outl(value, ioaddr + 0xD0);
-		else if (location >= 29 && location <= 31)
-			outl(value, ioaddr + 0xD4 + ((location-29)<<2));
-		return;
-	}
-
-	if (tp->chip_id == COMET5) {
+	if ((tp->chip_id == COMET) || (tp->chip_id == COMET5)) {
 		if (phy_id != 1)
 			return;
 		if (location < 7)
@@ -1488,12 +1456,7 @@
 			outl(addr_low,  ioaddr + CSR14);
 			outl(1, ioaddr + CSR13);
 			outl(addr_high, ioaddr + CSR14);
-		} else if (tp->chip_id == COMET) {
-			outl(addr_low,  ioaddr + 0xA4);
-			outl(addr_high, ioaddr + 0xA8);
-			outl(0, ioaddr + 0xAC);
-			outl(0, ioaddr + 0xB0);
-		} else if (tp->chip_id == COMET5) {
+		} else if ((tp->chip_id == COMET) || (tp->chip_id == COMET5)) {
 			outl(addr_low,  ioaddr + 0xA4);
 			outl(addr_high, ioaddr + 0xA8);
 			outl(0, ioaddr + 0xAC);
@@ -1608,10 +1571,7 @@
 		outl(0x0000, ioaddr + CSR13);
 		outl(0x0000, ioaddr + CSR14);
 		outl(0x0008, ioaddr + CSR15);
-	} else if (tp->chip_id == COMET) {
-		dev->if_port = 0;
-		tp->csr6 = 0x00040000;
-	} else if (tp->chip_id == COMET5) {
+	} else if ((tp->chip_id == COMET) || (tp->chip_id == COMET5)) {
 		dev->if_port = 0;
 		tp->csr6 = 0x00040000;
 	} else if (tp->chip_id == AX88140) {
@@ -3051,9 +3011,7 @@
 			data[0] = phy;
 		else if (tp->flags & HAS_NWAY143)
 			data[0] = 32;
-		else if (tp->chip_id == COMET)
-			data[0] = 1;
-		else if (tp->chip_id == COMET5)
+		else if ((tp->chip_id == COMET) || (tp->chip_id == COMET5))
 			data[0] = 1;
 		else
 			return -ENODEV;
@@ -3180,10 +3138,9 @@
 				outl(mc_filter[0], ioaddr + CSR14);
 				outl(3, ioaddr + CSR13);
 				outl(mc_filter[1], ioaddr + CSR14);
-			} else if (tp->chip_id == COMET) { /* Has a simple hash filter. */
-				outl(mc_filter[0], ioaddr + 0xAC);
-				outl(mc_filter[1], ioaddr + 0xB0);
-			} else if (tp->chip_id == COMET5) { /* Has a simple hash filter. */
+
+			/* Has a simple hash filter. */
+			} else if ((tp->chip_id == COMET) || (tp->chip_id == COMET5)) {
 				outl(mc_filter[0], ioaddr + 0xAC);
 				outl(mc_filter[1], ioaddr + 0xB0);
 			}
diff -urN linux-2.2.19-pre12/drivers/scsi/Config.in linux/drivers/scsi/Config.in
--- linux-2.2.19-pre12/drivers/scsi/Config.in	Mon Dec  3 21:05:47 2001
+++ linux/drivers/scsi/Config.in	Mon Dec  3 21:06:18 2001
@@ -29,9 +29,9 @@
 dep_tristate 'Adaptec AHA1740 support' CONFIG_SCSI_AHA1740 $CONFIG_SCSI
 dep_tristate 'Adaptec AIC7xxx support' CONFIG_SCSI_AIC7XXX $CONFIG_SCSI
 if [ "$CONFIG_SCSI_AIC7XXX" != "n" ]; then
-    bool '   Enable Tagged Command Queueing (TCQ) by default' CONFIG_AIC7XXX_TCQ_ON_BY_DEFAULT y
+    bool '   Enable Tagged Command Queueing (TCQ) by default' CONFIG_AIC7XXX_TCQ_ON_BY_DEFAULT
     int  '   Maximum number of TCQ commands per device' CONFIG_AIC7XXX_CMDS_PER_DEVICE 24
-    bool '   Collect statistics to report in /proc' CONFIG_AIC7XXX_PROC_STATS y
+    bool '   Collect statistics to report in /proc' CONFIG_AIC7XXX_PROC_STATS
 fi
 dep_tristate 'IBM ServeRAID support' CONFIG_SCSI_IPS $CONFIG_SCSI
 dep_tristate 'AdvanSys SCSI support' CONFIG_SCSI_ADVANSYS $CONFIG_SCSI
@@ -71,7 +71,7 @@
   dep_tristate 'Initio 9100U(W) support' CONFIG_SCSI_INITIO $CONFIG_SCSI
   dep_tristate 'Initio INI-A100U2W support' CONFIG_SCSI_INIA100 $CONFIG_SCSI
 fi
-if [ "$CONFIG_PARPORT" != "n" ]; then
+if [ "$CONFIG_PARPORT" = "y" -o "$CONFIG_PARPORT" = "m" ]; then
   dep_tristate 'IOMEGA parallel port (ppa - older drives)' CONFIG_SCSI_PPA $CONFIG_SCSI $CONFIG_PARPORT
   dep_tristate 'IOMEGA parallel port (imm - newer drives)' CONFIG_SCSI_IMM $CONFIG_SCSI $CONFIG_PARPORT
   if [ "$CONFIG_SCSI_PPA" != "n" -o "$CONFIG_SCSI_IMM" != "n" ]; then
diff -urN linux-2.2.19-pre12/drivers/usb/printer.c linux/drivers/usb/printer.c
--- linux-2.2.19-pre12/drivers/usb/printer.c	Sun Dec 10 16:49:43 2000
+++ linux/drivers/usb/printer.c	Mon Dec  3 21:06:18 2001
@@ -17,6 +17,7 @@
  *	v0.4 - fixes in unidirectional mode
  *	v0.5 - add DEVICE_ID string support
  *	v0.6 - never time out
+ *	v0.? - fixed bulk-IN read and poll (David Paschal, paschal@rcsis.com)
  */
 
 /*
@@ -52,6 +53,7 @@
 
 #define IOCNR_GET_DEVICE_ID	1
 #define LPIOC_GET_DEVICE_ID(len) _IOC(_IOC_READ, 'P', IOCNR_GET_DEVICE_ID, len)	/* get device_id string */
+#define LPGETSTATUS		0x060b		/* same as in drivers/char/lp.c */
 
 /*
  * A DEVICE_ID string may include the printer's serial number.
@@ -81,6 +83,7 @@
 	int			readcount;		/* Counter for reads */
 	int			ifnum;			/* Interface number */
 	int			minor;			/* minor number of device */
+	unsigned int		quirks;			/* quirks flags */
 	unsigned char		used;			/* True if open */
 	unsigned char		bidir;			/* interface is bidirectional */
 	unsigned char		*device_id_string;	/* IEEE 1284 DEVICE ID string (ptr) */
@@ -89,6 +92,26 @@
 
 static struct usblp *usblp_table[USBLP_MINORS];
 
+/* Quirks: various printer quirks are handled by this table & its flags. */
+
+struct quirk_printer_struct {
+	__u16 vendorId;
+	__u16 productId;
+	unsigned int quirks;
+};
+
+#define USBLP_QUIRK_BIDIR	0x1	/* reports bidir but requires unidirectional mode (no INs/reads) */
+#define USBLP_QUIRK_USB_INIT	0x2	/* needs vendor USB init string */
+
+static struct quirk_printer_struct quirk_printers[] = {
+	{ 0x03f0, 0x0004, USBLP_QUIRK_BIDIR }, /* HP DeskJet 895C */
+	{ 0x03f0, 0x0104, USBLP_QUIRK_BIDIR }, /* HP DeskJet 880C */
+	{ 0x03f0, 0x0204, USBLP_QUIRK_BIDIR }, /* HP DeskJet 815C */
+	{ 0x03f0, 0x0304, USBLP_QUIRK_BIDIR }, /* HP DeskJet 810C/812C */
+	{ 0x03f0, 0x0404, USBLP_QUIRK_BIDIR }, /* HP DeskJet 830C */
+	{ 0, 0 }
+};
+
 /*
  * Functions for usblp control messages.
  */
@@ -179,10 +202,19 @@
 	if (usblp->used)
 		goto out;
 
+	/*
+	 * TODO: need to implement LP_ABORTOPEN + O_NONBLOCK as in drivers/char/lp.c ???
+	 * This is #if 0-ed because we *don't* want to fail an open
+	 * just because the printer is off-line.
+	 */
+#if 0
 	if ((retval = usblp_check_status(usblp, 0))) {
 		retval = retval > 1 ? -EIO : -ENOSPC;
 		goto out;
 	}
+#else
+	retval = 0;	
+#endif
 
 	usblp->used = 1;
 	file->private_data = usblp;
@@ -192,6 +224,7 @@
 
 	if (usblp->bidir) {
 		usblp->readcount = 0;
+		usblp->readurb.dev = usblp->dev;
 		usb_submit_urb(&usblp->readurb);
 	}
 out:
@@ -224,37 +257,66 @@
 {
 	struct usblp *usblp = file->private_data;
 	poll_wait(file, &usblp->wait, wait);
-	return ((usblp->bidir || usblp->readurb.status  == -EINPROGRESS) ? 0 : POLLIN  | POLLRDNORM)
-	     		      | (usblp->writeurb.status == -EINPROGRESS  ? 0 : POLLOUT | POLLWRNORM);
+ 	return ((!usblp->bidir || usblp->readurb.status  == -EINPROGRESS) ? 0 : POLLIN  | POLLRDNORM)
+ 			       | (usblp->writeurb.status == -EINPROGRESS  ? 0 : POLLOUT | POLLWRNORM);
 }
 
 static int usblp_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
 {
 	struct usblp *usblp = file->private_data;
-	int length;
-
-	if ((_IOC_TYPE(cmd) != 'P') || (_IOC_DIR(cmd) != _IOC_READ))
-		return -EINVAL;
-
-	switch (_IOC_NR(cmd)) {
+	int length, err;
+	unsigned char status;
 
-		case IOCNR_GET_DEVICE_ID: /* get the DEVICE_ID string */
+	if (_IOC_TYPE(cmd) == 'P')	/* new-style ioctl number */
+	
+		switch (_IOC_NR(cmd)) {
+
+			case IOCNR_GET_DEVICE_ID: /* get the DEVICE_ID string */
+				if (_IOC_DIR(cmd) != _IOC_READ)
+					return -EINVAL;
+
+				err = usblp_get_id(usblp, 0, usblp->device_id_string, DEVICE_ID_SIZE - 1);
+				if (err < 0) {
+					dbg ("usblp%d: error = %d reading IEEE-1284 Device ID string",
+						usblp->minor, err);
+					usblp->device_id_string[0] = usblp->device_id_string[1] = '\0';
+					return -EIO;
+				}
+
+				length = (usblp->device_id_string[0] << 8) + usblp->device_id_string[1]; /* big-endian */
+				if (length < DEVICE_ID_SIZE)
+					usblp->device_id_string[length] = '\0';
+				else
+					usblp->device_id_string[DEVICE_ID_SIZE - 1] = '\0';
+
+				dbg ("usblp%d Device ID string [%d/max %d]='%s'",
+					usblp->minor, length, _IOC_SIZE(cmd), &usblp->device_id_string[2]);
+
+				if (length > _IOC_SIZE(cmd)) length = _IOC_SIZE(cmd); /* truncate */
 
-			length = (usblp->device_id_string[0] << 8) + usblp->device_id_string[1]; /* big-endian */
+				if (copy_to_user((unsigned char *) arg, usblp->device_id_string, (unsigned long) length))
+					return -EFAULT;
 
-			dbg ("usblp_ioctl GET_DEVICE_ID actlen: %d, size: %d, string: '%s'",
-				length, _IOC_SIZE(cmd), &usblp->device_id_string[2]);
+				break;
 
-			if (length > _IOC_SIZE(cmd)) length = _IOC_SIZE(cmd); /* truncate */
+			default:
+				return -EINVAL;
+		}
+	else	/* old-style ioctl value */
+		switch (cmd) {
 
-			if (copy_to_user((unsigned char *) arg, usblp->device_id_string, (unsigned long) length))
-				return -EFAULT;
+			case LPGETSTATUS:
+				if (usblp_read_status(usblp, &status)) {
+					err("usblp%d: failed reading printer status", usblp->minor);
+					return -EIO;
+				}
+				if (copy_to_user ((unsigned char *)arg, &status, 1))
+					return -EFAULT;
+				break;
 
-			break;
-
-		default:
-			return -EINVAL;
-	}
+			default:
+				return -EINVAL;
+		}
 
 	return 0;
 }
@@ -285,8 +347,17 @@
 			return -ENODEV;
 
 		if (usblp->writeurb.status) {
-			err = usblp_check_status(usblp, err);
-			continue;
+			if (usblp->quirks & USBLP_QUIRK_BIDIR) {
+				if (usblp->writeurb.status != -EINPROGRESS)
+					err("usblp%d: error %d writing to printer",
+						usblp->minor, usblp->writeurb.status);
+				err = usblp->writeurb.status;
+				continue;
+			}
+			else {
+				err = usblp_check_status(usblp, err);
+				continue;
+			}
 		}
 
 		writecount += usblp->writeurb.transfer_buffer_length;
@@ -301,6 +372,7 @@
 		if (copy_from_user(usblp->writeurb.transfer_buffer, buffer + writecount,
 				usblp->writeurb.transfer_buffer_length)) return -EFAULT;
 
+		usblp->writeurb.dev = usblp->dev;
 		usb_submit_urb(&usblp->writeurb);
 	}
 
@@ -332,6 +404,8 @@
 	if (usblp->readurb.status) {
 		err("usblp%d: error %d reading from printer",
 			usblp->minor, usblp->readurb.status);
+		usblp->readurb.dev = usblp->dev;
+ 		usblp->readcount = 0;
 		usb_submit_urb(&usblp->readurb);
 		return -EIO;
 	}
@@ -342,21 +416,55 @@
 	if (copy_to_user(buffer, usblp->readurb.transfer_buffer + usblp->readcount, count))
 		return -EFAULT;
 
-	if ((usblp->readcount += count) == usblp->readurb.actual_length)
+	if ((usblp->readcount += count) == usblp->readurb.actual_length) {
+		usblp->readcount = 0;
+		usblp->readurb.dev = usblp->dev;
 		usb_submit_urb(&usblp->readurb);
+	}
 
 	return count;
 }
 
+/*
+ * Checks for printers that have quirks, such as requiring unidirectional
+ * communication but reporting bidirectional; currently some HP printers
+ * have this flaw (HP 810, 880, 895, etc.), or needing an init string
+ * sent at each open (like some Epsons).
+ * Returns 1 if found, 0 if not found.
+ *
+ * HP recommended that we use the bidirectional interface but
+ * don't attempt any bulk IN transfers from the IN endpoint.
+ * Here's some more detail on the problem:
+ * The problem is not that it isn't bidirectional though. The problem
+ * is that if you request a device ID, or status information, while
+ * the buffers are full, the return data will end up in the print data
+ * buffer. For example if you make sure you never request the device ID
+ * while you are sending print data, and you don't try to query the
+ * printer status every couple of milliseconds, you will probably be OK.
+ */
+static unsigned int usblp_quirks (__u16 vendor, __u16 product)
+{
+	int i;
+
+	for (i = 0; quirk_printers[i].vendorId; i++) {
+		if (vendor == quirk_printers[i].vendorId &&
+		    product == quirk_printers[i].productId)
+			return quirk_printers[i].quirks;
+ 	}
+	return 0;
+}
+
 static void *usblp_probe(struct usb_device *dev, unsigned int ifnum)
 {
 	struct usb_interface_descriptor *interface;
 	struct usb_endpoint_descriptor *epread, *epwrite;
 	struct usblp *usblp;
-	int minor, i, alts = -1, bidir = 0;
+	int minor, i, bidir = 0, quirks;
+	int alts = dev->actconfig->interface[ifnum].act_altsetting;
 	int length, err;
 	char *buf;
 
+	/* If a bidirectional interface exists, use it. */
 	for (i = 0; i < dev->actconfig->interface[ifnum].num_altsetting; i++) {
 
 		interface = &dev->actconfig->interface[ifnum].altsetting[i];
@@ -366,18 +474,13 @@
 		   (interface->bInterfaceProtocol > 1 && interface->bNumEndpoints < 2))
 			continue;
 
-		if (alts == -1)
-			alts = i;
-
-		if (!bidir && interface->bInterfaceProtocol > 1) {
+		if (interface->bInterfaceProtocol > 1) {
 			bidir = 1;
 			alts = i;
+			break;
 		}
 	}
 
-	if (alts == -1)
-		return NULL;
-
 	interface = &dev->actconfig->interface[ifnum].altsetting[alts];
 	if (usb_set_interface(dev, ifnum, alts))
 		err("can't set desired altsetting %d on interface %d", alts, ifnum);
@@ -410,10 +513,21 @@
 	}
 	memset(usblp, 0, sizeof(struct usblp));
 
+	/* lookup quirks for this printer */
+	quirks = usblp_quirks(dev->descriptor.idVendor, dev->descriptor.idProduct);
+
+	if (bidir && (quirks & USBLP_QUIRK_BIDIR)) {
+		bidir = 0;
+		epread = NULL;
+		info ("Disabling reads from problem bidirectional printer on usblp%d",
+			minor);
+	}
+
 	usblp->dev = dev;
 	usblp->ifnum = ifnum;
 	usblp->minor = minor;
 	usblp->bidir = bidir;
+	usblp->quirks = quirks;
 
 	init_waitqueue_head(&usblp->wait);
 
@@ -455,7 +569,7 @@
 	}
 
 #ifdef DEBUG
-	usblp_check_status(usblp);
+	usblp_check_status(usblp, 0);
 #endif
 
 	info("usblp%d: USB %sdirectional printer dev %d if %d alt %d",
@@ -503,7 +617,7 @@
 	probe:		usblp_probe,
 	disconnect:	usblp_disconnect,
 	fops:		&usblp_fops,
-	minor:		USBLP_MINOR_BASE
+	minor:		USBLP_MINOR_BASE,
 };
 
 static int __init usblp_init(void)
diff -urN linux-2.2.19-pre12/drivers/video/Config.in linux/drivers/video/Config.in
--- linux-2.2.19-pre12/drivers/video/Config.in	Mon Dec  3 21:05:47 2001
+++ linux/drivers/video/Config.in	Mon Dec  3 21:06:18 2001
@@ -50,7 +50,7 @@
   if [ "$CONFIG_ATARI" = "y" ]; then
     bool 'Atari native chipset support' CONFIG_FB_ATARI
   fi
-  if [ "$CONFIG_ATARI" = "y" -o "$CONFIG_PCI" != "n" ]; then
+  if [ "$CONFIG_ATARI" = "y" -o "$CONFIG_PCI" = "y" ]; then
     tristate 'ATI Mach64 display support' CONFIG_FB_ATY
   fi
   if [ "$CONFIG_PPC" = "y" ]; then
@@ -86,7 +86,7 @@
     define_bool CONFIG_BUS_I2C y
   fi
   if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
-    if [ "$CONFIG_PCI" != "n" -a "$ARCH" != "sparc" -a "$ARCH" != "sparc64" ]; then
+    if [ "$CONFIG_PCI" = "y" -a "$ARCH" != "sparc" -a "$ARCH" != "sparc64" ]; then
       tristate 'Matrox acceleration' CONFIG_FB_MATROX
       if  [ "$CONFIG_FB_MATROX" != "n" ]; then
         bool '  Millennium I/II support' CONFIG_FB_MATROX_MILLENIUM
@@ -114,7 +114,7 @@
     fi
   fi
   if [ "$ARCH" = "sparc" ]; then
-    if [ "$CONFIG_PCI" != "n" ]; then
+    if [ "$CONFIG_PCI" = "y" ]; then
       bool 'PCI framebuffers' CONFIG_FB_PCI
       if [ "$CONFIG_FB_PCI" != "n" ]; then
         bool '  IGA 168x display support' CONFIG_FB_IGA
diff -urN linux-2.2.19-pre12/drivers/video/aty128fb.c linux/drivers/video/aty128fb.c
--- linux-2.2.19-pre12/drivers/video/aty128fb.c	Sun Dec 10 16:49:44 2000
+++ linux/drivers/video/aty128fb.c	Mon Dec  3 21:06:18 2001
@@ -262,7 +262,6 @@
     int chip_gen;
     struct aty128fb_par default_par, current_par;
     struct display disp;
-    struct display_switch dispsw;       /* for cursor and font */
     struct { u8 red, green, blue, pad; } palette[256];
 #ifdef CONFIG_PMAC_PBOOK
     unsigned char *save_framebuffer;
@@ -1436,29 +1435,25 @@
     switch (bpp) {
 #ifdef FBCON_HAS_CFB8
     case 8:
-	info->dispsw = accel ? fbcon_aty128_8 : fbcon_cfb8;
-        disp->dispsw = &info->dispsw;
+	disp->dispsw = accel ? &fbcon_aty128_8 : &fbcon_cfb8;
 	break;
 #endif
 #ifdef FBCON_HAS_CFB16
     case 15:
     case 16:
-	info->dispsw = accel ? fbcon_aty128_16 : fbcon_cfb16;
-        disp->dispsw = &info->dispsw;
+	disp->dispsw = accel ? &fbcon_aty128_16 : &fbcon_cfb16;
 	disp->dispsw_data = info->fbcon_cmap.cfb16;
 	break;
 #endif
 #ifdef FBCON_HAS_CFB24
     case 24:
-	info->dispsw = accel ? fbcon_aty128_24 : fbcon_cfb24;
-        disp->dispsw = &info->dispsw;
+	disp->dispsw = accel ? &fbcon_aty128_24 : &fbcon_cfb24;
 	disp->dispsw_data = info->fbcon_cmap.cfb24;
 	break;
 #endif
 #ifdef FBCON_HAS_CFB32
     case 32:
-	info->dispsw = accel ? fbcon_aty128_32 : fbcon_cfb32;
-        disp->dispsw = &info->dispsw;
+	disp->dispsw = accel ? &fbcon_aty128_32 : &fbcon_cfb32;
 	disp->dispsw_data = info->fbcon_cmap.cfb32;
 	break;
 #endif
@@ -1752,18 +1747,17 @@
     memset(&var, 0, sizeof(var));
 
 #ifdef CONFIG_FB_OF
-    if (default_vmode == VMODE_CHOOSE) {
-#endif /* CONFIG_FB_OF */
+    /* New iBook */
+    if (default_vmode == VMODE_CHOOSE &&
+    	machine_is_compatible("PowerBook2,2"))
+        default_vmode = VMODE_800_600_60;
+        
+    if (default_vmode == VMODE_CHOOSE)
+        var = default_var;
+    else if (mac_vmode_to_var(default_vmode, default_cmode, &var))
+	var = default_var;
+#else /* CONFIG_FB_OF */
         var = default_var;
-
-#ifdef CONFIG_FB_OF
-	/* New iBook */
-	if (machine_is_compatible("PowerBook2,2"))
-		default_vmode = VMODE_800_600_60;
-    } else {
-	if (mac_vmode_to_var(default_vmode, default_cmode, &var))
-	    var = default_var;
-    }
 #endif /* CONFIG_FB_OF */
 
 #endif /* MODULE */
diff -urN linux-2.2.19-pre12/fs/nfsd/nfscache.c linux/fs/nfsd/nfscache.c
--- linux-2.2.19-pre12/fs/nfsd/nfscache.c	Mon Dec  3 21:05:48 2001
+++ linux/fs/nfsd/nfscache.c	Mon Dec  3 21:06:18 2001
@@ -161,7 +161,7 @@
 		    xid == rp->c_xid && proc == rp->c_proc &&
 		    proto == rp->c_prot && vers == rp->c_vers &&
 		    time_before(jiffies, rp->c_timestamp + 120*HZ) &&
-		    memcmp((char*)&rqstp->rq_addr, (char*)&rp->c_addr, rqstp->rq_addrlen)==0) {
+		    memcmp((char*)&rqstp->rq_addr, (char*)&rp->c_addr, sizeof(rp->c_addr))==0) {
 			nfsdstats.rchits++;
 			goto found_entry;
 		}
diff -urN linux-2.2.19-pre12/include/asm-ppc/ide.h linux/include/asm-ppc/ide.h
--- linux-2.2.19-pre12/include/asm-ppc/ide.h	Mon Sep  4 10:39:28 2000
+++ linux/include/asm-ppc/ide.h	Mon Dec  3 21:06:18 2001
@@ -36,6 +36,7 @@
 extern ide_ioreg_t chrp_idedma_regbase; /* one for both channels */
 extern unsigned int chrp_ide_irq;
 extern void chrp_ide_probe(void);
+extern void ide_pmac_init(void);
 
 struct ide_machdep_calls {
         void        (*insw)(ide_ioreg_t port, void *buf, int ns);
diff -urN linux-2.2.19-pre12/include/asm-ppc/mman.h linux/include/asm-ppc/mman.h
--- linux-2.2.19-pre12/include/asm-ppc/mman.h	Wed Dec 18 00:54:09 1996
+++ linux/include/asm-ppc/mman.h	Mon Dec  3 21:06:18 2001
@@ -13,6 +13,7 @@
 #define MAP_ANONYMOUS	0x20		/* don't use a file */
 #define MAP_RENAME      MAP_ANONYMOUS   /* In SunOS terminology */
 #define MAP_NORESERVE   0x40            /* don't reserve swap pages */
+#define MAP_LOCKED	0x80
 
 #define MAP_GROWSDOWN	0x0100		/* stack-like segment */
 #define MAP_DENYWRITE	0x0800		/* ETXTBSY */
diff -urN linux-2.2.19-pre12/include/asm-ppc/page.h linux/include/asm-ppc/page.h
--- linux-2.2.19-pre12/include/asm-ppc/page.h	Sun Dec 10 16:49:44 2000
+++ linux/include/asm-ppc/page.h	Mon Dec  3 21:06:18 2001
@@ -14,6 +14,19 @@
 #ifndef __ASSEMBLY__
 #ifdef __KERNEL__
 
+#ifdef CONFIG_XMON
+#define BUG() do { \
+	printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
+	xmon(0); \
+} while (0)
+#else
+#define BUG() do { \
+	printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
+	__asm__ __volatile__(".long 0x0"); \
+} while (0)
+#endif
+#define PAGE_BUG(page) do { BUG(); } while (0)
+
 #define STRICT_MM_TYPECHECKS
 
 #ifdef STRICT_MM_TYPECHECKS
diff -urN linux-2.2.19-pre12/mm/memory.c linux/mm/memory.c
--- linux-2.2.19-pre12/mm/memory.c	Sun Dec 10 16:49:44 2000
+++ linux/mm/memory.c	Mon Dec  3 21:06:18 2001
@@ -935,6 +935,7 @@
 	pte_t * pte;
 	int ret;
 
+	current->state = TASK_RUNNING;
 	pgd = pgd_offset(vma->vm_mm, address);
 	pmd = pmd_alloc(pgd, address);
 	if (!pmd)
diff -urN linux-2.2.19-pre12/net/ax25/af_ax25.c linux/net/ax25/af_ax25.c
--- linux-2.2.19-pre12/net/ax25/af_ax25.c	Sun Dec 10 16:49:44 2000
+++ linux/net/ax25/af_ax25.c	Mon Dec  3 21:06:18 2001
@@ -720,6 +720,9 @@
 	if (get_user(len, optlen))
 		return -EFAULT;
 
+	if (len < 0)
+		return -EINVAL;
+		
 	switch (optname) {
 		case AX25_WINDOW:
 			val = sk->protinfo.ax25->window;
diff -urN linux-2.2.19-pre12/net/core/sock.c linux/net/core/sock.c
--- linux-2.2.19-pre12/net/core/sock.c	Mon Dec  3 21:05:48 2001
+++ linux/net/core/sock.c	Mon Dec  3 21:06:18 2001
@@ -377,11 +377,14 @@
 		struct timeval tm;
 	} v;
 	
-	unsigned int lv=sizeof(int),len;
+	int lv=sizeof(int),len;
   	
   	if(get_user(len,optlen))
   		return -EFAULT;
 
+	if(len < 0)
+		return -EINVAL;
+		
   	switch(optname) 
   	{
 		case SO_DEBUG:		
diff -urN linux-2.2.19-pre12/net/ipv4/ip_sockglue.c linux/net/ipv4/ip_sockglue.c
--- linux-2.2.19-pre12/net/ipv4/ip_sockglue.c	Thu Apr 22 19:45:19 1999
+++ linux/net/ipv4/ip_sockglue.c	Mon Dec  3 21:06:18 2001
@@ -636,6 +636,9 @@
 	if(get_user(len,optlen))
 		return -EFAULT;
 
+	if(len < 0)
+		return -EINVAL;
+		
 	switch(optname)
 	{
 		case IP_OPTIONS:
diff -urN linux-2.2.19-pre12/net/ipv4/ipmr.c linux/net/ipv4/ipmr.c
--- linux-2.2.19-pre12/net/ipv4/ipmr.c	Mon Aug  9 12:04:41 1999
+++ linux/net/ipv4/ipmr.c	Mon Dec  3 21:06:18 2001
@@ -877,6 +877,10 @@
 		return -EFAULT;
 
 	olr=min(olr,sizeof(int));
+	
+	if(olr < 0)
+		return -EINVAL;
+		
 	if(put_user(olr,optlen))
 		return -EFAULT;
 	if(optname==MRT_VERSION)
diff -urN linux-2.2.19-pre12/net/ipv4/raw.c linux/net/ipv4/raw.c
--- linux-2.2.19-pre12/net/ipv4/raw.c	Mon Aug  9 12:04:41 1999
+++ linux/net/ipv4/raw.c	Mon Dec  3 21:06:18 2001
@@ -497,6 +497,8 @@
 
 	if (get_user(len,optlen))
 		return -EFAULT;
+	if (len < 0)
+		return -EINVAL;
 	if (len > sizeof(struct icmp_filter))
 		len = sizeof(struct icmp_filter);
 	if (put_user(len, optlen))
diff -urN linux-2.2.19-pre12/net/ipv4/tcp.c linux/net/ipv4/tcp.c
--- linux-2.2.19-pre12/net/ipv4/tcp.c	Mon Dec  3 21:05:48 2001
+++ linux/net/ipv4/tcp.c	Mon Dec  3 21:06:18 2001
@@ -1779,6 +1779,9 @@
 		return -EFAULT;
 
 	len = min(len, sizeof(int));
+	
+	if(len < 0)
+		return -EINVAL;
 
 	switch(optname) {
 	case TCP_MAXSEG:
diff -urN linux-2.2.19-pre12/net/ipv6/ipv6_sockglue.c linux/net/ipv6/ipv6_sockglue.c
--- linux-2.2.19-pre12/net/ipv6/ipv6_sockglue.c	Thu Apr 22 19:45:20 1999
+++ linux/net/ipv6/ipv6_sockglue.c	Mon Dec  3 21:06:18 2001
@@ -359,6 +359,8 @@
 		return -ENOPROTOOPT;
 	if (get_user(len, optlen))
 		return -EFAULT;
+	if(len < 0)
+		return -EINVAL;
 	switch (optname) {
 	case IPV6_PKTOPTIONS:
 	{
diff -urN linux-2.2.19-pre12/net/ipv6/raw.c linux/net/ipv6/raw.c
--- linux-2.2.19-pre12/net/ipv6/raw.c	Mon Aug  9 12:04:41 1999
+++ linux/net/ipv6/raw.c	Mon Dec  3 21:06:18 2001
@@ -492,6 +492,8 @@
 	case ICMPV6_FILTER:
 		if (get_user(len, optlen))
 			return -EFAULT;
+		if (len < 0)
+			return -EINVAL;
 		if (len > sizeof(struct icmp6_filter))
 			len = sizeof(struct icmp6_filter);
 		if (put_user(len, optlen))
diff -urN linux-2.2.19-pre12/net/ipx/af_ipx.c linux/net/ipx/af_ipx.c
--- linux-2.2.19-pre12/net/ipx/af_ipx.c	Sun Dec 10 16:49:44 2000
+++ linux/net/ipx/af_ipx.c	Mon Dec  3 21:06:18 2001
@@ -1769,6 +1769,10 @@
 		return (-EFAULT);
 
 	len = min(len, sizeof(int));
+	
+	if(len < 0)
+		return -EINVAL;
+		
 	if(put_user(len, optlen))
 		return (-EFAULT);
 
diff -urN linux-2.2.19-pre12/net/irda/af_irda.c linux/net/irda/af_irda.c
--- linux-2.2.19-pre12/net/irda/af_irda.c	Mon Sep  4 10:39:29 2000
+++ linux/net/irda/af_irda.c	Mon Dec  3 21:06:18 2001
@@ -1842,6 +1842,9 @@
 	if (get_user(len, optlen))
 		return -EFAULT;
 
+	if (len < 0)
+		return -EINVAL;
+		
 	switch (optname) {
 	case IRLMP_ENUMDEVICES:
 		/* Tell IrLMP we want to be notified */
diff -urN linux-2.2.19-pre12/net/netrom/af_netrom.c linux/net/netrom/af_netrom.c
--- linux-2.2.19-pre12/net/netrom/af_netrom.c	Mon Aug  9 12:04:41 1999
+++ linux/net/netrom/af_netrom.c	Mon Dec  3 21:06:18 2001
@@ -407,6 +407,9 @@
 	if (get_user(len, optlen))
 		return -EFAULT;
 
+	if (len < 0)
+		return -EINVAL;
+		
 	switch (optname) {
 		case NETROM_T1:
 			val = sk->protinfo.nr->t1 / HZ;
diff -urN linux-2.2.19-pre12/net/rose/af_rose.c linux/net/rose/af_rose.c
--- linux-2.2.19-pre12/net/rose/af_rose.c	Tue Oct 26 17:53:42 1999
+++ linux/net/rose/af_rose.c	Mon Dec  3 21:06:18 2001
@@ -471,6 +471,9 @@
 		
 	if (get_user(len, optlen))
 		return -EFAULT;
+		
+	if (len < 0)
+		return -EINVAL;
 	
 	switch (optname) {
 		case ROSE_DEFER:
diff -urN linux-2.2.19-pre12/net/socket.c linux/net/socket.c
--- linux-2.2.19-pre12/net/socket.c	Sun Dec 10 16:49:44 2000
+++ linux/net/socket.c	Mon Dec  3 21:06:18 2001
@@ -1048,7 +1048,10 @@
 {
 	int err;
 	struct socket *sock;
-	
+
+	if(optlen < 0)	
+		return -EINVAL;
+		
 	lock_kernel();
 	if ((sock = sockfd_lookup(fd, &err))!=NULL)
 	{
diff -urN linux-2.2.19-pre12/net/x25/af_x25.c linux/net/x25/af_x25.c
--- linux-2.2.19-pre12/net/x25/af_x25.c	Sun Dec 10 16:49:45 2000
+++ linux/net/x25/af_x25.c	Mon Dec  3 21:06:18 2001
@@ -389,6 +389,9 @@
 	if (get_user(len, optlen))
 		return -EFAULT;
 
+	if (len < 0)
+		return -EINVAL;
+		
 	switch (optname) {
 		case X25_QBITINCL:
 			val = sk->protinfo.x25->qbitincl;
