<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;"># This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.620   -&gt; 1.621  
#	drivers/usb/serial/ftdi_sio.c	1.20    -&gt; 1.21   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/08/29	greg@kroah.com	1.621
# USB: ftdi_sio update due to usbserial core changes.
# --------------------------------------------
#
diff -Nru a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
--- a/drivers/usb/serial/ftdi_sio.c	Thu Aug 29 13:54:48 2002
+++ b/drivers/usb/serial/ftdi_sio.c	Thu Aug 29 13:54:48 2002
@@ -108,18 +108,15 @@
 
 #include &lt;linux/config.h&gt;
 #include &lt;linux/kernel.h&gt;
-#include &lt;linux/sched.h&gt;
-#include &lt;linux/signal.h&gt;
 #include &lt;linux/errno.h&gt;
-#include &lt;linux/poll.h&gt;
 #include &lt;linux/init.h&gt;
 #include &lt;linux/slab.h&gt;
-#include &lt;linux/fcntl.h&gt;
 #include &lt;linux/tty.h&gt;
 #include &lt;linux/tty_driver.h&gt;
 #include &lt;linux/tty_flip.h&gt;
 #include &lt;linux/module.h&gt;
 #include &lt;linux/spinlock.h&gt;
+#include &lt;asm/uaccess.h&gt;
 #include &lt;linux/usb.h&gt;
 #include &lt;linux/serial.h&gt;
 #ifdef CONFIG_USB_SERIAL_DEBUG
@@ -208,49 +205,45 @@
 static void ftdi_break_ctl		(struct usb_serial_port *port, int break_state );
 
 static struct usb_serial_device_type ftdi_SIO_device = {
-	name:			"FTDI SIO",
-	id_table:		id_table_sio,
-	needs_interrupt_in:	MUST_HAVE_NOT,
-	needs_bulk_in:		MUST_HAVE,
-	needs_bulk_out:		MUST_HAVE,
-	num_interrupt_in:	0,
-	num_bulk_in:		1,
-	num_bulk_out:		1,
-	num_ports:		1,
-	open:			ftdi_open,
-	close:			ftdi_close,
-	write:			ftdi_write,
-	write_room:		ftdi_write_room,
-	read_bulk_callback:	ftdi_read_bulk_callback,
-	write_bulk_callback:	ftdi_write_bulk_callback,
-	ioctl:			ftdi_ioctl,
-	set_termios:		ftdi_set_termios,
-	break_ctl:		ftdi_break_ctl,
-	startup:		ftdi_SIO_startup,
-	 shutdown:		ftdi_shutdown,
+	.owner =		THIS_MODULE,
+	.name =			"FTDI SIO",
+	.id_table =		id_table_sio,
+	.num_interrupt_in =	0,
+	.num_bulk_in =		1,
+	.num_bulk_out =		1,
+	.num_ports =		1,
+	.open =			ftdi_open,
+	.close =		ftdi_close,
+	.write =		ftdi_write,
+	.write_room =		ftdi_write_room,
+	.read_bulk_callback =	ftdi_read_bulk_callback,
+	.write_bulk_callback =	ftdi_write_bulk_callback,
+	.ioctl =		ftdi_ioctl,
+	.set_termios =		ftdi_set_termios,
+	.break_ctl =		ftdi_break_ctl,
+	.startup =		ftdi_SIO_startup,
+	.shutdown =		ftdi_shutdown,
 };
 
 static struct usb_serial_device_type ftdi_8U232AM_device = {
-	name:			"FTDI 8U232AM",
-	id_table:		id_table_8U232AM,
-	needs_interrupt_in:	DONT_CARE,
-	needs_bulk_in:		MUST_HAVE,
-	needs_bulk_out:		MUST_HAVE,
-	num_interrupt_in:	0,
-	num_bulk_in:		1,
-	num_bulk_out:		1,
-	num_ports:		1,
-	open:			ftdi_open,
-	close:			ftdi_close,
-	write:			ftdi_write,
-	write_room:		ftdi_write_room,
-	read_bulk_callback:	ftdi_read_bulk_callback,
-	write_bulk_callback:	ftdi_write_bulk_callback,
-	ioctl:			ftdi_ioctl,
-	set_termios:		ftdi_set_termios,
-	break_ctl:		ftdi_break_ctl,
-	startup:		ftdi_8U232AM_startup,
-	shutdown:		ftdi_shutdown,
+	.owner =		THIS_MODULE,
+	.name =			"FTDI 8U232AM",
+	.id_table =		id_table_8U232AM,
+	.num_interrupt_in =	0,
+	.num_bulk_in =		1,
+	.num_bulk_out =		1,
+	.num_ports =		1,
+	.open =			ftdi_open,
+	.close =		ftdi_close,
+	.write =		ftdi_write,
+	.write_room =		ftdi_write_room,
+	.read_bulk_callback =	ftdi_read_bulk_callback,
+	.write_bulk_callback =	ftdi_write_bulk_callback,
+	.ioctl =		ftdi_ioctl,
+	.set_termios =		ftdi_set_termios,
+	.break_ctl =		ftdi_break_ctl,
+	.startup =		ftdi_8U232AM_startup,
+	.shutdown =		ftdi_shutdown,
 };
 
 #define WDR_TIMEOUT (HZ * 5 ) /* default urb timeout */
@@ -347,7 +340,7 @@
 	/* 1. Get the baud rate from the tty settings, this observes alt_speed hack */
 
 	baud = tty_get_baud_rate(port-&gt;tty);
-	dbg(__FUNCTION__ " tty_get_baud_rate reports speed %d", baud);
+	dbg("%s - tty_get_baud_rate reports speed %d", __FUNCTION__, baud);
 
 	/* 2. Observe async-compatible custom_divisor hack, update baudrate if needed */
 
@@ -355,7 +348,7 @@
 	    ((priv-&gt;flags &amp; ASYNC_SPD_MASK) == ASYNC_SPD_CUST) &amp;&amp;
 	     (priv-&gt;custom_divisor)) {
 		baud = priv-&gt;baud_base / priv-&gt;custom_divisor;
-		dbg(__FUNCTION__ " custom divisor %d sets baud rate to %d", priv-&gt;custom_divisor, baud);
+		dbg("%s - custom divisor %d sets baud rate to %d", __FUNCTION__, priv-&gt;custom_divisor, baud);
 	}
 
 	/* 3. Convert baudrate to device-specific divisor */
@@ -376,13 +369,13 @@
 		case 115200: urb_value = ftdi_sio_b115200; break;
 		} /* baud */
 		if (urb_value == 0)
-			dbg(__FUNCTION__ " Baudrate (%d) requested is not supported", baud);
+			dbg("%s - Baudrate (%d) requested is not supported", __FUNCTION__,  baud);
 		break;
 	case FT8U232AM: /* 8U232AM chip */
 		if (baud &lt;= 3000000) {
 			urb_value = FTDI_SIO_BAUD_TO_DIVISOR(baud);
 		} else {
-	                dbg(__FUNCTION__ " Baud rate too high!");
+	                dbg("%s - Baud rate too high!", __FUNCTION__);
 		}
 		break;
 	} /* priv-&gt;chip_type */
@@ -390,7 +383,7 @@
 	if (urb_value == 0) {
 		urb_value = ftdi_sio_b9600;
 	} else {
-		dbg(__FUNCTION__ " Baud rate set to %d (divisor %d) on chip %s", baud, urb_value, (priv-&gt;chip_type == SIO) ? "SIO" : "FT8U232AM" );
+		dbg("%s - Baud rate set to %d (divisor %d) on chip %s", __FUNCTION__, baud, urb_value, (priv-&gt;chip_type == SIO) ? "SIO" : "FT8U232AM" );
 	}
 
 	return(urb_value);
@@ -546,51 +539,42 @@
 
 	dbg("%s", __FUNCTION__);
 
-	down (&amp;port-&gt;sem);
-	
-	MOD_INC_USE_COUNT;
-	++port-&gt;open_count;
-
-	if (!port-&gt;active){
-		port-&gt;active = 1;
 
-		port-&gt;tty-&gt;low_latency = (priv-&gt;flags &amp; ASYNC_LOW_LATENCY) ? 1 : 0;
+	port-&gt;tty-&gt;low_latency = (priv-&gt;flags &amp; ASYNC_LOW_LATENCY) ? 1 : 0;
 
-		/* No error checking for this (will get errors later anyway) */
-		/* See ftdi_sio.h for description of what is reset */
-		usb_control_msg(serial-&gt;dev, usb_sndctrlpipe(serial-&gt;dev, 0),
-				FTDI_SIO_RESET_REQUEST, FTDI_SIO_RESET_REQUEST_TYPE, 
-				FTDI_SIO_RESET_SIO, 
-				0, buf, 0, WDR_TIMEOUT);
-
-		/* Termios defaults are set by usb_serial_init. We don't change
-		   port-&gt;tty-&gt;termios - this would loose speed settings, etc.
-		   This is same behaviour as serial.c/rs_open() - Kuba */
-
-		/* ftdi_set_termios  will send usb control messages */
-		ftdi_set_termios(port, &amp;tmp_termios);
-
-		/* FIXME: Flow control might be enabled, so it should be checked -
-		   we have no control of defaults! */
-		/* Turn on RTS and DTR since we are not flow controlling by default */
-		if (set_dtr(serial-&gt;dev, usb_sndctrlpipe(serial-&gt;dev, 0),HIGH) &lt; 0) {
-			err("%s Error from DTR HIGH urb", __FUNCTION__);
-		}
-		if (set_rts(serial-&gt;dev, usb_sndctrlpipe(serial-&gt;dev, 0),HIGH) &lt; 0){
-			err("%s Error from RTS HIGH urb", __FUNCTION__);
-		}
-	
-		/* Start reading from the device */
-		FILL_BULK_URB(port-&gt;read_urb, serial-&gt;dev, 
-			      usb_rcvbulkpipe(serial-&gt;dev, port-&gt;bulk_in_endpointAddress),
-			      port-&gt;read_urb-&gt;transfer_buffer, port-&gt;read_urb-&gt;transfer_buffer_length,
-			      ftdi_read_bulk_callback, port);
-		result = usb_submit_urb(port-&gt;read_urb);
-		if (result)
-			err("%s - failed submitting read urb, error %d", __FUNCTION__, result);
-	}
+	/* No error checking for this (will get errors later anyway) */
+	/* See ftdi_sio.h for description of what is reset */
+	usb_control_msg(serial-&gt;dev, usb_sndctrlpipe(serial-&gt;dev, 0),
+			FTDI_SIO_RESET_REQUEST, FTDI_SIO_RESET_REQUEST_TYPE, 
+			FTDI_SIO_RESET_SIO, 
+			0, buf, 0, WDR_TIMEOUT);
+
+	/* Termios defaults are set by usb_serial_init. We don't change
+	   port-&gt;tty-&gt;termios - this would loose speed settings, etc.
+	   This is same behaviour as serial.c/rs_open() - Kuba */
+
+	/* ftdi_set_termios  will send usb control messages */
+	ftdi_set_termios(port, &amp;tmp_termios);
+
+	/* FIXME: Flow control might be enabled, so it should be checked -
+	   we have no control of defaults! */
+	/* Turn on RTS and DTR since we are not flow controlling by default */
+	if (set_dtr(serial-&gt;dev, usb_sndctrlpipe(serial-&gt;dev, 0),HIGH) &lt; 0) {
+		err("%s Error from DTR HIGH urb", __FUNCTION__);
+	}
+	if (set_rts(serial-&gt;dev, usb_sndctrlpipe(serial-&gt;dev, 0),HIGH) &lt; 0){
+		err("%s Error from RTS HIGH urb", __FUNCTION__);
+	}
+
+	/* Start reading from the device */
+	FILL_BULK_URB(port-&gt;read_urb, serial-&gt;dev, 
+		      usb_rcvbulkpipe(serial-&gt;dev, port-&gt;bulk_in_endpointAddress),
+		      port-&gt;read_urb-&gt;transfer_buffer, port-&gt;read_urb-&gt;transfer_buffer_length,
+		      ftdi_read_bulk_callback, port);
+	result = usb_submit_urb(port-&gt;read_urb);
+	if (result)
+		err("%s - failed submitting read urb, error %d", __FUNCTION__, result);
 
-	up (&amp;port-&gt;sem);
 	return result;
 } /* ftdi_open */
 
@@ -603,48 +587,32 @@
 
 	dbg("%s", __FUNCTION__);
 
-	down (&amp;port-&gt;sem);
-	--port-&gt;open_count;
-
-	if (port-&gt;open_count &lt;= 0) {
-		if (serial-&gt;dev) {
-			if (c_cflag &amp; HUPCL){
-				/* Disable flow control */
-				if (usb_control_msg(serial-&gt;dev, 
-						    usb_sndctrlpipe(serial-&gt;dev, 0),
-						    FTDI_SIO_SET_FLOW_CTRL_REQUEST,
-						    FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
-						    0, 0, buf, 0, WDR_TIMEOUT) &lt; 0) {
-					err("error from flowcontrol urb");
-				}	    
-
-				/* drop DTR */
-				if (set_dtr(serial-&gt;dev, usb_sndctrlpipe(serial-&gt;dev, 0), LOW) &lt; 0){
-					err("Error from DTR LOW urb");
-				}
-				/* drop RTS */
-				if (set_rts(serial-&gt;dev, usb_sndctrlpipe(serial-&gt;dev, 0),LOW) &lt; 0) {
-					err("Error from RTS LOW urb");
-				}	
-			} /* Note change no line is hupcl is off */
-
-			/* shutdown our bulk reads and writes */
-			/* ***CHECK*** behaviour when there is nothing queued */
-			usb_unlink_urb (port-&gt;write_urb);
-			usb_unlink_urb (port-&gt;read_urb);
-		}
-		port-&gt;active = 0;
-		port-&gt;open_count = 0;
-	} else {  
-		/* Send a HUP if necessary */
-		if (!(port-&gt;tty-&gt;termios-&gt;c_cflag &amp; CLOCAL)){
-			tty_hangup(port-&gt;tty);
-		}
+	if (serial-&gt;dev) {
+		if (c_cflag &amp; HUPCL){
+			/* Disable flow control */
+			if (usb_control_msg(serial-&gt;dev, 
+					    usb_sndctrlpipe(serial-&gt;dev, 0),
+					    FTDI_SIO_SET_FLOW_CTRL_REQUEST,
+					    FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
+					    0, 0, buf, 0, WDR_TIMEOUT) &lt; 0) {
+				err("error from flowcontrol urb");
+			}	    
+
+			/* drop DTR */
+			if (set_dtr(serial-&gt;dev, usb_sndctrlpipe(serial-&gt;dev, 0), LOW) &lt; 0){
+				err("Error from DTR LOW urb");
+			}
+			/* drop RTS */
+			if (set_rts(serial-&gt;dev, usb_sndctrlpipe(serial-&gt;dev, 0),LOW) &lt; 0) {
+				err("Error from RTS LOW urb");
+			}	
+		} /* Note change no line is hupcl is off */
+
+		/* shutdown our bulk reads and writes */
+		/* ***CHECK*** behaviour when there is nothing queued */
+		usb_unlink_urb (port-&gt;write_urb);
+		usb_unlink_urb (port-&gt;read_urb);
 	}
-
-	up (&amp;port-&gt;sem);
-	MOD_DEC_USE_COUNT;
-
 } /* ftdi_close */
 
 
@@ -678,20 +646,17 @@
 		return (0);
 	}		
 
-	down(&amp;port-&gt;sem);
-
 	count += data_offset;
 	count = (count &gt; port-&gt;bulk_out_size) ? port-&gt;bulk_out_size : count;
 
 	/* Copy in the data to send */
 	if (from_user) {
-		if (copy_from_user((char *)port-&gt;write_urb-&gt;transfer_buffer + data_offset,
+		if (copy_from_user(port-&gt;write_urb-&gt;transfer_buffer + data_offset,
 				   buf, count - data_offset )){
-			up (&amp;port-&gt;sem);
 			return -EFAULT;
 		}
 	} else {
-		memcpy((char *)port-&gt;write_urb-&gt;transfer_buffer + data_offset,
+		memcpy(port-&gt;write_urb-&gt;transfer_buffer + data_offset,
 		       buf, count - data_offset );
 	}  
 
@@ -713,14 +678,11 @@
 	result = usb_submit_urb(port-&gt;write_urb);
 	if (result) {
 		err("%s - failed submitting write urb, error %d", __FUNCTION__, result);
-		up (&amp;port-&gt;sem);
 		return 0;
 	}
-	up (&amp;port-&gt;sem);
 
 	dbg("%s write returning: %d", __FUNCTION__, count - data_offset);
 	return (count - data_offset);
-
 } /* ftdi_write */
 
 
@@ -729,7 +691,7 @@
 	struct usb_serial_port *port = (struct usb_serial_port *)urb-&gt;context;
 	struct usb_serial *serial;
 
-	dbg(__FUNCTION__);
+	dbg("%s", __FUNCTION__);
 
 	if (port_paranoia_check (port, "ftdi_write_bulk_callback")) {
 		return;
</pre></body></html>