Re: [PATCH] USB and Driver Core patches for 2.6.10

From: Greg KH
Date: Sat Jan 08 2005 - 01:44:42 EST


ChangeSet 1.1938.446.11, 2004/12/15 16:01:23-08:00, eolson@xxxxxxx

[PATCH] usb-serial: add tty_hangup on disconnect

When a USB serial device is disconnected, user applications performing a
read() now receive an error code, rather than waiting indefinitely. The
included patch is originally from Al Borchers, massaged to apply to
2.6.9 and 2.6.10-rc2. I've tested it on 2.6.9, but not on 2.6.10-rc2.

Al Borcher's original post:
http://www.mail-archive.com/linux-usb-devel@xxxxxxxxxxxxxxxxxxxxx/msg27475.html

Signed-off-by: Edwin Olson (eolson@xxxxxxx)
Signed-off-by: Greg Kroah-Hartman <greg@xxxxxxxxx>


drivers/usb/serial/usb-serial.c | 7 +++++++
1 files changed, 7 insertions(+)


diff -Nru a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
--- a/drivers/usb/serial/usb-serial.c 2005-01-07 15:50:08 -08:00
+++ b/drivers/usb/serial/usb-serial.c 2005-01-07 15:50:08 -08:00
@@ -1238,13 +1238,20 @@

void usb_serial_disconnect(struct usb_interface *interface)
{
+ int i;
struct usb_serial *serial = usb_get_intfdata (interface);
struct device *dev = &interface->dev;
+ struct usb_serial_port *port;

dbg ("%s", __FUNCTION__);

usb_set_intfdata (interface, NULL);
if (serial) {
+ for (i = 0; i < serial->num_ports; ++i) {
+ port = serial->port[i];
+ if (port && port->tty)
+ tty_hangup(port->tty);
+ }
/* let the last holder of this object
* cause it to be cleaned up */
kref_put(&serial->kref, destroy_serial);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/