summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2010-03-17 22:00:44 (GMT)
committerGreg Kroah-Hartman <gregkh@suse.de>2010-05-20 20:21:33 (GMT)
commitec3ee5086c1e1b883292eaf795b5c1b0c25bcffe (patch)
tree676df22a9390c9147f1c131d5a091cb4d498d812
parent50dbb8528757b1977efd5d270ed9d262cbbef87d (diff)
downloadlinux-ec3ee5086c1e1b883292eaf795b5c1b0c25bcffe.tar.xz
USB: serial: clear fifo on close
Make sure fifo is emptied on close. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/serial/generic.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 2a3196a..583244b 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -156,13 +156,19 @@ EXPORT_SYMBOL_GPL(usb_serial_generic_open);
static void generic_cleanup(struct usb_serial_port *port)
{
struct usb_serial *serial = port->serial;
+ unsigned long flags;
dbg("%s - port %d", __func__, port->number);
if (serial->dev) {
/* shutdown any bulk transfers that might be going on */
- if (port->bulk_out_size)
+ if (port->bulk_out_size) {
usb_kill_urb(port->write_urb);
+
+ spin_lock_irqsave(&port->lock, flags);
+ kfifo_reset_out(&port->write_fifo);
+ spin_unlock_irqrestore(&port->lock, flags);
+ }
if (port->bulk_in_size)
usb_kill_urb(port->read_urb);
}