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

diff -urN linux-2.2.21-rc1/MAINTAINERS linux-2.2.21-rc2/MAINTAINERS
--- linux-2.2.21-rc1/MAINTAINERS	Fri Aug 30 16:24:19 2002
+++ linux-2.2.21-rc2/MAINTAINERS	Fri Aug 30 16:24:28 2002
@@ -1075,12 +1075,12 @@
 S:	Maintained
 
 USB SERIAL KEYSPAN DRIVER
-P:	Hugh Blemings
-M:	hugh@linuxcare.com
+P:	Greg Kroah-Hartman
+M:	greg@kroah.com
 L:	linux-usb-users@lists.sourceforge.net
 L:	linux-usb-devel@lists.sourceforge.net
 S:	Maintained
-W:	http://www.linuxcare.com.au/hugh/keyspan.html
+W:	http://www.kroah.com/linux/
 
 USB SERIAL DRIVER
 P:	Greg Kroah-Hartman
diff -urN linux-2.2.21-rc1/Makefile linux-2.2.21-rc2/Makefile
--- linux-2.2.21-rc1/Makefile	Fri Aug 30 16:24:19 2002
+++ linux-2.2.21-rc2/Makefile	Fri Aug 30 16:24:28 2002
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 2
 SUBLEVEL = 21
-EXTRAVERSION = rc1
+EXTRAVERSION = rc2
 
 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.21-rc1/arch/i386/kernel/head.S linux-2.2.21-rc2/arch/i386/kernel/head.S
--- linux-2.2.21-rc1/arch/i386/kernel/head.S	Fri Nov  2 08:39:05 2001
+++ linux-2.2.21-rc2/arch/i386/kernel/head.S	Fri Aug 30 16:24:28 2002
@@ -160,7 +160,7 @@
  * we don't need to preserve eflags.
  */
 
-	movl $3,X86		# at least 386
+	movb $3,X86		# at least 386
 	pushfl			# push EFLAGS
 	popl %eax		# get EFLAGS
 	movl %eax,%ecx		# save original EFLAGS
@@ -173,7 +173,7 @@
 	andl $0x40000,%eax	# check if AC bit changed
 	je is386
 
-	movl $4,X86		# at least 486
+	movb $4,X86		# at least 486
 	movl %ecx,%eax
 	xorl $0x200000,%eax	# check ID flag
 	pushl %eax
diff -urN linux-2.2.21-rc1/arch/i386/kernel/setup.c linux-2.2.21-rc2/arch/i386/kernel/setup.c
--- linux-2.2.21-rc1/arch/i386/kernel/setup.c	Fri Aug 30 16:24:19 2002
+++ linux-2.2.21-rc2/arch/i386/kernel/setup.c	Fri Aug 30 16:24:28 2002
@@ -1081,7 +1081,7 @@
 
 static void __init init_intel(struct cpuinfo_x86 *c)
 {
-	char *p;
+	char *p = NULL;
 	unsigned int l1i = 0, l1d = 0, l2 = 0, l3 = 0; /* Cache sizes */
 
 	if (c->cpuid_level > 1) {
diff -urN linux-2.2.21-rc1/drivers/usb/serial/visor.c linux-2.2.21-rc2/drivers/usb/serial/visor.c
--- linux-2.2.21-rc1/drivers/usb/serial/visor.c	Fri Aug 30 16:24:19 2002
+++ linux-2.2.21-rc2/drivers/usb/serial/visor.c	Fri Aug 30 16:24:29 2002
@@ -12,6 +12,10 @@
  *
  * See Documentation/usb/usb-serial.txt for more information on using this driver
  * 
+ * (11/11/2001) gkh
+ *	Added support for the m125 devices, and added check to prevent oopses
+ *	for Clié devices that lie about the number of ports they have.
+ *
  * (08/30/2001) gkh
  *	Added support for the Clie devices, both the 3.5 and 4.0 os versions.
  *	Many thanks to Daniel Burke, and Bryan Payne for helping with this.
@@ -123,9 +127,9 @@
 /*
  * Version Information
  */
-#define DRIVER_VERSION "v1.4"
+#define DRIVER_VERSION "v1.5"
 #define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>"
-#define DRIVER_DESC "USB HandSpring Visor, Palm m50x, Sony Clie driver"
+#define DRIVER_DESC "USB HandSpring Visor, Palm m50x, Sony Clié driver"
 
 #define MIN(a,b)                (((a)<(b))?(a):(b))
 
@@ -148,7 +152,7 @@
 /* All of the device info needed for the Handspring Visor */
 static __u16	handspring_vendor_id	= HANDSPRING_VENDOR_ID;
 static __u16	handspring_product_id	= HANDSPRING_VISOR_ID;
-struct usb_serial_device_type handspring_device = {
+static struct usb_serial_device_type handspring_device = {
 	name:			"Handspring Visor",
 	idVendor:		&handspring_vendor_id,
 	idProduct:		&handspring_product_id,
@@ -178,7 +182,8 @@
 static __u16	palm_vendor_id	= PALM_VENDOR_ID;
 static __u16	palm_m500_id	= PALM_M500_ID;
 static __u16	palm_m505_id	= PALM_M505_ID;
-struct usb_serial_device_type palm_m500_device = {
+static __u16	palm_m125_id	= PALM_M125_ID;
+static struct usb_serial_device_type palm_m500_device = {
 	name:			"Palm M500",
 	idVendor:		&palm_vendor_id,
 	idProduct:		&palm_m500_id,
@@ -205,7 +210,7 @@
 };
 
 /* device info for the Palm M505 */
-struct usb_serial_device_type palm_m505_device = {
+static struct usb_serial_device_type palm_m505_device = {
 	name:			"Palm M505",
 	idVendor:		&palm_vendor_id,
 	idProduct:		&palm_m505_id,
@@ -231,6 +236,33 @@
 	read_bulk_callback:	visor_read_bulk_callback,
 };
 
+/* device info for the Palm M125 */
+static struct usb_serial_device_type palm_m125_device = {
+	name:			"Palm M125",
+	idVendor:		&palm_vendor_id,
+	idProduct:		&palm_m125_id,
+	needs_interrupt_in:	MUST_HAVE_NOT,		/* this device must not have an interrupt in endpoint */
+	needs_bulk_in:		MUST_HAVE,		/* this device must have a bulk in endpoint */
+	needs_bulk_out:		MUST_HAVE,		/* this device must have a bulk out endpoint */
+	num_interrupt_in:	0,
+	num_bulk_in:		2,
+	num_bulk_out:		2,
+	num_ports:		2,
+	open:			visor_open,
+	close:			visor_close,
+	throttle:		visor_throttle,
+	unthrottle:		visor_unthrottle,
+	startup:		visor_startup,
+	shutdown:		visor_shutdown,
+	ioctl:			visor_ioctl,
+	set_termios:		visor_set_termios,
+	write:			visor_write,
+	write_room:		visor_write_room,
+	chars_in_buffer:	visor_chars_in_buffer,
+	write_bulk_callback:	visor_write_bulk_callback,
+	read_bulk_callback:	visor_read_bulk_callback,
+};
+
 /* device info for the Sony Clie OS version 3.5 */
 static __u16	sony_vendor_id	= SONY_VENDOR_ID;
 static __u16	sony_3_5_id	= SONY_CLIE_3_5_ID;
@@ -307,6 +339,11 @@
 	
 	dbg(__FUNCTION__ " - port %d", port->number);
 
+	if (!port->read_urb) {
+		err ("Device lied about number of ports, please use a lower one.");
+		return -ENODEV;
+	}
+
 	down (&port->sem);
 	
 	++port->open_count;
@@ -709,9 +746,8 @@
 
 	/* stop reads and writes on all ports */
 	for (i=0; i < serial->num_ports; ++i) {
-		while (serial->port[i].open_count > 0) {
-			visor_close (&serial->port[i], NULL);
-		}
+		serial->port[i].active = 0;
+		serial->port[i].open_count = 0;
 	}
 }
 
@@ -798,6 +834,7 @@
 	usb_serial_register (&handspring_device);
 	usb_serial_register (&palm_m500_device);
 	usb_serial_register (&palm_m505_device);
+	usb_serial_register (&palm_m125_device);
 	usb_serial_register (&clie_3_5_device);
 	usb_serial_register (&clie_4_0_device);
 	
@@ -833,6 +870,7 @@
 	usb_serial_deregister (&handspring_device);
 	usb_serial_deregister (&palm_m500_device);
 	usb_serial_deregister (&palm_m505_device);
+	usb_serial_deregister (&palm_m125_device);
 	usb_serial_deregister (&clie_3_5_device);
 	usb_serial_deregister (&clie_4_0_device);
 
diff -urN linux-2.2.21-rc1/drivers/usb/serial/visor.h linux-2.2.21-rc2/drivers/usb/serial/visor.h
--- linux-2.2.21-rc1/drivers/usb/serial/visor.h	Fri Aug 30 16:24:19 2002
+++ linux-2.2.21-rc2/drivers/usb/serial/visor.h	Fri Aug 30 16:24:29 2002
@@ -23,6 +23,7 @@
 #define PALM_VENDOR_ID			0x0830
 #define PALM_M500_ID			0x0001
 #define PALM_M505_ID			0x0002
+#define PALM_M125_ID			0x0040
 
 #define SONY_VENDOR_ID			0x054C
 #define SONY_CLIE_3_5_ID		0x0038
diff -urN linux-2.2.21-rc1/drivers/usb/serial/whiteheat.c linux-2.2.21-rc2/drivers/usb/serial/whiteheat.c
--- linux-2.2.21-rc1/drivers/usb/serial/whiteheat.c	Fri Nov  2 08:39:08 2001
+++ linux-2.2.21-rc2/drivers/usb/serial/whiteheat.c	Fri Aug 30 16:24:29 2002
@@ -11,6 +11,9 @@
  *
  * See Documentation/usb/usb-serial.txt for more information on using this driver
  *
+ * (05/30/2001) gkh
+ *	switched from using spinlock to a semaphore, which fixes lots of problems.
+ *
  * (04/08/2001) gb
  *	Identify version on module load.
  * 
@@ -82,7 +85,7 @@
 /*
  * Version Information
  */
-#define DRIVER_VERSION "v1.0.0"
+#define DRIVER_VERSION "v1.1"
 #define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>"
 #define DRIVER_DESC "USB ConnectTech WhiteHEAT driver"
 
@@ -104,7 +107,7 @@
 static __u16	connecttech_vendor_id			= CONNECT_TECH_VENDOR_ID;
 static __u16	connecttech_whiteheat_fake_product_id	= CONNECT_TECH_FAKE_WHITE_HEAT_ID;
 static __u16	connecttech_whiteheat_product_id	= CONNECT_TECH_WHITE_HEAT_ID;
-struct usb_serial_device_type whiteheat_fake_device = {
+static struct usb_serial_device_type whiteheat_fake_device = {
 	name:			"Connect Tech - WhiteHEAT - (prerenumeration)",
 	idVendor:		&connecttech_vendor_id,			/* the Connect Tech vendor id */
 	idProduct:		&connecttech_whiteheat_fake_product_id,	/* the White Heat initial product id */
@@ -117,7 +120,7 @@
 	num_ports:		1,
 	startup:		whiteheat_startup	
 };
-struct usb_serial_device_type whiteheat_device = {
+static struct usb_serial_device_type whiteheat_device = {
 	name:			"Connect Tech - WhiteHEAT",
 	idVendor:		&connecttech_vendor_id,			/* the Connect Tech vendor id */
 	idProduct:		&connecttech_whiteheat_product_id,	/* the White Heat real product id */
@@ -228,6 +231,7 @@
 	struct usb_serial_port *port;
 	int timeout;
 	__u8 *transfer_buffer;
+	int retval = 0;
 
 	dbg(__FUNCTION__" - command %d", command);
 
@@ -240,9 +244,10 @@
 	memcpy (&transfer_buffer[1], data, datasize);
 	port->write_urb->transfer_buffer_length = datasize + 1;
 	port->write_urb->dev = serial->dev;
-	if (usb_submit_urb (port->write_urb)) {
+	retval = usb_submit_urb (port->write_urb);
+	if (retval) {
 		dbg (__FUNCTION__" - submit urb failed");
-		return -1;
+		goto exit;
 	}
 
 	/* wait for the command to complete */
@@ -253,20 +258,21 @@
 
 	if (info->command_finished == FALSE) {
 		dbg (__FUNCTION__ " - command timed out.");
-		return -1;
+		retval = -ETIMEDOUT;
+		goto exit;
 	}
 
 	if (info->command_finished == WHITEHEAT_CMD_FAILURE) {
 		dbg (__FUNCTION__ " - command failed.");
-		return -1;
+		retval = -EIO;
+		goto exit;
 	}
 
-	if (info->command_finished == WHITEHEAT_CMD_COMPLETE) {
+	if (info->command_finished == WHITEHEAT_CMD_COMPLETE)
 		dbg (__FUNCTION__ " - command completed.");
-		return 0;
-	}
 
-	return 0;
+exit:
+	return retval;
 }
 
 
@@ -275,10 +281,12 @@
 	struct whiteheat_min_set	open_command;
 	struct usb_serial_port 		*command_port;
 	struct whiteheat_private	*info;
-	int				result;
+	int				retval = 0;
 
 	dbg(__FUNCTION__" - port %d", port->number);
 
+	down (&port->sem);
+
 	++port->open_count;
 	MOD_INC_USE_COUNT;
 	
@@ -291,7 +299,8 @@
 			info = (struct whiteheat_private *)kmalloc (sizeof(struct whiteheat_private), GFP_KERNEL);
 			if (info == NULL) {
 				err(__FUNCTION__ " - out of memory");
-				return -ENOMEM;
+				retval = -ENOMEM;
+				goto error_exit;
 			}
 			
 			init_waitqueue_head(&info->wait_command);
@@ -300,27 +309,45 @@
 			command_port->read_urb->complete = command_port_read_callback;
 			command_port->read_urb->dev = port->serial->dev;
 			command_port->tty = port->tty;		/* need this to "fake" our our sanity check macros */
-			usb_submit_urb (command_port->read_urb);
+			retval = usb_submit_urb (command_port->read_urb);
+			if (retval) {
+				err(__FUNCTION__ " - failed submitting read urb, error %d", retval);
+				goto error_exit;
+			}
 		}
 		
 		/* Start reading from the device */
 		port->read_urb->dev = port->serial->dev;
-		result = usb_submit_urb(port->read_urb);
-		if (result)
-			err(__FUNCTION__ " - failed submitting read urb, error %d", result);
+		retval = usb_submit_urb(port->read_urb);
+		if (retval) {
+			err(__FUNCTION__ " - failed submitting read urb, error %d", retval);
+			goto error_exit;
+		}
 	
 		/* send an open port command */
 		/* firmware uses 1 based port numbering */
 		open_command.port = port->number - port->serial->minor + 1;
-		whiteheat_send_cmd (port->serial, WHITEHEAT_OPEN, (__u8 *)&open_command, sizeof(open_command));
+		retval = whiteheat_send_cmd (port->serial, WHITEHEAT_OPEN, (__u8 *)&open_command, sizeof(open_command));
+		if (retval)
+			goto error_exit;
 	
 		/* Need to do device specific setup here (control lines, baud rate, etc.) */
 		/* FIXME!!! */
 	}
 
 	dbg(__FUNCTION__ " - exit");
+	up (&port->sem);
+	
+	return retval;
+
+error_exit:
+	--port->open_count;
+	MOD_DEC_USE_COUNT;
+
+	dbg(__FUNCTION__ " - error_exit");
+	up (&port->sem);
 	
-	return 0;
+	return retval;
 }
 
 
@@ -330,6 +357,7 @@
 	
 	dbg(__FUNCTION__ " - port %d", port->number);
 	
+	down (&port->sem);
 	--port->open_count;
 
 	if (port->open_count <= 0) {
@@ -347,6 +375,7 @@
 		port->active = 0;
 	}
 	MOD_DEC_USE_COUNT;
+	up (&port->sem);
 }
 
 
@@ -360,25 +389,28 @@
 
 static void whiteheat_set_termios (struct usb_serial_port *port, struct termios *old_termios)
 {
-	unsigned int cflag = port->tty->termios->c_cflag;
+	unsigned int cflag;
 	struct whiteheat_port_settings port_settings;
 
 	dbg(__FUNCTION__ " -port %d", port->number);
 
+	down (&port->sem);
+
+	if ((!port->tty) || (!port->tty->termios)) {
+		dbg(__FUNCTION__" - no tty structures");
+		goto exit;
+	}
+	
+	cflag = port->tty->termios->c_cflag;
 	/* check that they really want us to change something */
 	if (old_termios) {
 		if ((cflag == old_termios->c_cflag) &&
 		    (RELEVANT_IFLAG(port->tty->termios->c_iflag) == RELEVANT_IFLAG(old_termios->c_iflag))) {
 			dbg(__FUNCTION__ " - nothing to change...");
-			return;
+			goto exit;
 		}
 	}
 
-	if ((!port->tty) || (!port->tty->termios)) {
-		dbg(__FUNCTION__" - no tty structures");
-		return;
-	}
-	
 	/* set the port number */
 	/* firmware uses 1 based port numbering */
 	port_settings.port = port->number + 1;
@@ -443,6 +475,8 @@
 	/* now send the message to the device */
 	whiteheat_send_cmd (port->serial, WHITEHEAT_SETUP_PORT, (__u8 *)&port_settings, sizeof(port_settings));
 	
+exit:
+	up (&port->sem);
 	return;
 }
 
