diff options
author | Johan Hovold <jhovold@gmail.com> | 2010-03-17 18:00:44 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-20 16:21:33 -0400 |
commit | ec3ee5086c1e1b883292eaf795b5c1b0c25bcffe (patch) | |
tree | 676df22a9390c9147f1c131d5a091cb4d498d812 /drivers/usb/serial/generic.c | |
parent | 50dbb8528757b1977efd5d270ed9d262cbbef87d (diff) |
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>
Diffstat (limited to 'drivers/usb/serial/generic.c')
-rw-r--r-- | 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 2a3196a2c66c..583244bd84b1 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -156,13 +156,19 @@ EXPORT_SYMBOL_GPL(usb_serial_generic_open); | |||
156 | static void generic_cleanup(struct usb_serial_port *port) | 156 | static void generic_cleanup(struct usb_serial_port *port) |
157 | { | 157 | { |
158 | struct usb_serial *serial = port->serial; | 158 | struct usb_serial *serial = port->serial; |
159 | unsigned long flags; | ||
159 | 160 | ||
160 | dbg("%s - port %d", __func__, port->number); | 161 | dbg("%s - port %d", __func__, port->number); |
161 | 162 | ||
162 | if (serial->dev) { | 163 | if (serial->dev) { |
163 | /* shutdown any bulk transfers that might be going on */ | 164 | /* shutdown any bulk transfers that might be going on */ |
164 | if (port->bulk_out_size) | 165 | if (port->bulk_out_size) { |
165 | usb_kill_urb(port->write_urb); | 166 | usb_kill_urb(port->write_urb); |
167 | |||
168 | spin_lock_irqsave(&port->lock, flags); | ||
169 | kfifo_reset_out(&port->write_fifo); | ||
170 | spin_unlock_irqrestore(&port->lock, flags); | ||
171 | } | ||
166 | if (port->bulk_in_size) | 172 | if (port->bulk_in_size) |
167 | usb_kill_urb(port->read_urb); | 173 | usb_kill_urb(port->read_urb); |
168 | } | 174 | } |