summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorAlan Cox <alan@redhat.com>2009-01-02 14:47:06 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-02 19:19:40 +0100
commiteff6937a46e096eb35c16a391617b7a5e098a30c (patch)
treebc3d6be6f85a61d27af3f86eb0e8b65b9f83f059 /drivers/usb
parentserial: set correct baud_base for Oxford Semiconductor Ltd EXSYS EX-41092 Dua... (diff)
downloadlinux-eff6937a46e096eb35c16a391617b7a5e098a30c.tar.xz
linux-eff6937a46e096eb35c16a391617b7a5e098a30c.zip
tty: USB tty devices can block in tcdrain when unplugged
The underlying problem is that the device methods don't all correctly handle disconnected status and some keep reporting bytes pending which causes tcdrain to stall. When the cable is unplugged they are definitely gone, and as this is true for all USB cables we can fix it in the core usb serial code. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/serial/usb-serial.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index aafa684a900f..8d5189096470 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -339,6 +339,10 @@ static int serial_chars_in_buffer(struct tty_struct *tty)
dbg("%s = port %d", __func__, port->number);
WARN_ON(!port->port.count);
+ /* if the device was unplugged then any remaining characters
+ fell out of the connector ;) */
+ if (port->serial->disconnected)
+ return 0;
/* pass on to the driver specific version of this function */
return port->serial->type->chars_in_buffer(tty);
}