lkml.org 
[lkml]   [2010]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 8/9] USB: serial: clear fifo on close
Date
Make sure fifo is emptied on close.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
---
drivers/usb/serial/generic.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index d3ef69f..e0c7d53 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -155,13 +155,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);
}
--
1.7.0.2


\
 
 \ /
  Last update: 2010-03-17 23:11    [W:0.058 / U:46.136 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site