Greg --
Here is a simple patch that adds a low_level_locking flag to the usb_serial_device_type so that a USB serial driver can indicate that it does its own locking and does not want to use the usbserial semaphore. Any driver that does not explicitly set this flag will get the default behavior.
The semaphore is still used in open and close-- to protect usbserial data structures like open_count. But if a driver sets the low_level_locking flag then the semaphore will not be used in write, write_room, chars_in_buffer, throttle, unthrottle, ioctl, set_termios, and break. The driver is responsible for locking on its own in these functions.
If Pete's post_helper patch goes in, we can make that conditional on this flag, too.
USB serial drivers that do things right need a way to avoid the problems caused by the semaphore and the post_helper.
When I send you the new io_ti and io_edgeport drivers they will use this flag. I think the digi_acceleport driver can use this flag--I will send you a patch.
What do you think?
-- Al
diff -ur --exclude-from=diff.exclude linux-2.4.26/drivers/usb/serial/usb-serial.h linux-2.4.26-ion/drivers/usb/serial/usb-serial.h
--- linux-2.4.26/drivers/usb/serial/usb-serial.h Fri Nov 28 12:26:20 2003
+++ linux-2.4.26-ion/drivers/usb/serial/usb-serial.h Sun May 16 20:33:47 2004
@@ -216,6 +216,8 @@
char num_bulk_in;
char num_bulk_out;
char num_ports;
+ char low_level_locking; /* set to true to indicate the */
+ /* driver does its own locking */
struct list_head driver_list;
diff -ur --exclude-from=diff.exclude linux-2.4.26/drivers/usb/serial/usbserial.c linux-2.4.26-ion/drivers/usb/serial/usbserial.c
--- linux-2.4.26/drivers/usb/serial/usbserial.c Fri Nov 28 12:26:20 2003
+++ linux-2.4.26-ion/drivers/usb/serial/usbserial.c Sun May 16 21:15:29 2004
@@ -14,6 +14,12 @@
*
* See Documentation/usb/usb-serial.txt for more information on using this driver
*
+ * (5/15/2004) alborchers ([EMAIL PROTECTED])
+ * added low_level_locking flag for USB serial drivers that want to
+ * do their own locking on write, write_room, chars_in_buffer, throttle,
+ * unthrottle, ioctl, set_termios, and break and not use the buggy
+ * usbserial semaphore
+ *
* (10/10/2001) gkh
* usb_serial_disconnect() now sets the serial->dev pointer is to NULL to
* help prevent child drivers from accessing the device since it is now
@@ -595,7 +601,8 @@
if (!serial)
return -ENODEV;
- down (&port->sem); + if (!serial->type->low_level_locking) + down (&port->sem);
dbg("%s - port %d, %d byte(s)", __FUNCTION__, port->number, count);
@@ -611,7 +618,8 @@ retval = generic_write(port, from_user, buf, count);
exit: - up (&port->sem); + if (!serial->type->low_level_locking) + up (&port->sem); return retval; }
@@ -624,7 +632,8 @@ if (!serial) return -ENODEV;
- down (&port->sem); + if (!serial->type->low_level_locking) + down (&port->sem);
dbg("%s - port %d", __FUNCTION__, port->number);
@@ -640,7 +649,8 @@ retval = generic_write_room(port);
exit: - up (&port->sem); + if (!serial->type->low_level_locking) + up (&port->sem); return retval; }
@@ -653,7 +663,8 @@ if (!serial) return -ENODEV;
- down (&port->sem); + if (!serial->type->low_level_locking) + down (&port->sem);
dbg("%s = port %d", __FUNCTION__, port->number);
@@ -669,7 +680,8 @@ retval = generic_chars_in_buffer(port);
exit: - up (&port->sem); + if (!serial->type->low_level_locking) + up (&port->sem); return retval; }
@@ -681,7 +693,8 @@ if (!serial) return;
- down (&port->sem); + if (!serial->type->low_level_locking) + down (&port->sem);
dbg("%s - port %d", __FUNCTION__, port->number);
@@ -695,7 +708,8 @@ serial->type->throttle(port);
exit: - up (&port->sem); + if (!serial->type->low_level_locking) + up (&port->sem); }
static void serial_unthrottle (struct tty_struct * tty) @@ -706,7 +720,8 @@ if (!serial) return;
- down (&port->sem); + if (!serial->type->low_level_locking) + down (&port->sem);
dbg("%s - port %d", __FUNCTION__, port->number);
@@ -720,7 +735,8 @@ serial->type->unthrottle(port);
exit: - up (&port->sem); + if (!serial->type->low_level_locking) + up (&port->sem); }
static int serial_ioctl (struct tty_struct *tty, struct file * file, unsigned int cmd, unsigned long arg)
@@ -732,7 +748,8 @@
if (!serial)
return -ENODEV;
- down (&port->sem); + if (!serial->type->low_level_locking) + down (&port->sem);
dbg("%s - port %d, cmd 0x%.4x", __FUNCTION__, port->number, cmd);
@@ -748,7 +765,8 @@ retval = -ENOIOCTLCMD;
exit: - up (&port->sem); + if (!serial->type->low_level_locking) + up (&port->sem); return retval; }
@@ -760,7 +778,8 @@ if (!serial) return;
- down (&port->sem); + if (!serial->type->low_level_locking) + down (&port->sem);
dbg("%s - port %d", __FUNCTION__, port->number);
@@ -774,7 +793,8 @@ serial->type->set_termios(port, old);
exit: - up (&port->sem); + if (!serial->type->low_level_locking) + up (&port->sem); }
static void serial_break (struct tty_struct *tty, int break_state) @@ -785,7 +805,8 @@ if (!serial) return;
- down (&port->sem); + if (!serial->type->low_level_locking) + down (&port->sem);
dbg("%s - port %d", __FUNCTION__, port->number);
@@ -799,7 +820,8 @@ serial->type->break_ctl(port, break_state);
exit: - up (&port->sem); + if (!serial->type->low_level_locking) + up (&port->sem); }
static void serial_shutdown (struct usb_serial *serial)
------------------------------------------------------- This SF.Net email is sponsored by: SourceForge.net Broadband Sign-up now for SourceForge Broadband and get the fastest 6.0/768 connection for only $19.95/mo for the first 3 months! http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel