diff options
author | Johan Hovold <jhovold@gmail.com> | 2013-04-18 11:33:19 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-04-19 13:24:13 -0400 |
commit | 113ec31e16afe197a668d4b63ce41e04dc706c64 (patch) | |
tree | c1e6a24acc2e824a84cdf54d836dda64eaa6dd4e | |
parent | a8ec374f96da361e7a31113b1e471065adf33d7c (diff) |
USB: ti_usb_3410_5052: move write-fifo flushing to close
Move write-fifo flushing from ti_drain to close where it belongs.
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/serial/ti_usb_3410_5052.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 07268591b0d1..a49d2a746ccf 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
@@ -128,7 +128,7 @@ static int ti_set_serial_info(struct tty_struct *tty, struct ti_port *tport, | |||
128 | struct serial_struct __user *new_arg); | 128 | struct serial_struct __user *new_arg); |
129 | static void ti_handle_new_msr(struct ti_port *tport, __u8 msr); | 129 | static void ti_handle_new_msr(struct ti_port *tport, __u8 msr); |
130 | 130 | ||
131 | static void ti_drain(struct ti_port *tport, unsigned long timeout, int flush); | 131 | static void ti_drain(struct ti_port *tport, unsigned long timeout); |
132 | 132 | ||
133 | static void ti_stop_read(struct ti_port *tport, struct tty_struct *tty); | 133 | static void ti_stop_read(struct ti_port *tport, struct tty_struct *tty); |
134 | static int ti_restart_read(struct ti_port *tport, struct tty_struct *tty); | 134 | static int ti_restart_read(struct ti_port *tport, struct tty_struct *tty); |
@@ -601,6 +601,7 @@ static void ti_close(struct usb_serial_port *port) | |||
601 | int port_number; | 601 | int port_number; |
602 | int status; | 602 | int status; |
603 | int do_unlock; | 603 | int do_unlock; |
604 | unsigned long flags; | ||
604 | 605 | ||
605 | tdev = usb_get_serial_data(port->serial); | 606 | tdev = usb_get_serial_data(port->serial); |
606 | tport = usb_get_serial_port_data(port); | 607 | tport = usb_get_serial_port_data(port); |
@@ -609,11 +610,14 @@ static void ti_close(struct usb_serial_port *port) | |||
609 | 610 | ||
610 | tport->tp_is_open = 0; | 611 | tport->tp_is_open = 0; |
611 | 612 | ||
612 | ti_drain(tport, (tport->tp_closing_wait*HZ)/100, 1); | 613 | ti_drain(tport, (tport->tp_closing_wait*HZ)/100); |
613 | 614 | ||
614 | usb_kill_urb(port->read_urb); | 615 | usb_kill_urb(port->read_urb); |
615 | usb_kill_urb(port->write_urb); | 616 | usb_kill_urb(port->write_urb); |
616 | tport->tp_write_urb_in_use = 0; | 617 | tport->tp_write_urb_in_use = 0; |
618 | spin_lock_irqsave(&tport->tp_lock, flags); | ||
619 | kfifo_reset_out(&tport->write_fifo); | ||
620 | spin_unlock_irqrestore(&tport->tp_lock, flags); | ||
617 | 621 | ||
618 | port_number = port->number - port->serial->minor; | 622 | port_number = port->number - port->serial->minor; |
619 | 623 | ||
@@ -965,7 +969,7 @@ static void ti_break(struct tty_struct *tty, int break_state) | |||
965 | if (tport == NULL) | 969 | if (tport == NULL) |
966 | return; | 970 | return; |
967 | 971 | ||
968 | ti_drain(tport, (tport->tp_closing_wait*HZ)/100, 0); | 972 | ti_drain(tport, (tport->tp_closing_wait*HZ)/100); |
969 | 973 | ||
970 | status = ti_write_byte(port, tport->tp_tdev, | 974 | status = ti_write_byte(port, tport->tp_tdev, |
971 | tport->tp_uart_base_addr + TI_UART_OFFSET_LCR, | 975 | tport->tp_uart_base_addr + TI_UART_OFFSET_LCR, |
@@ -1361,7 +1365,7 @@ static void ti_handle_new_msr(struct ti_port *tport, __u8 msr) | |||
1361 | } | 1365 | } |
1362 | 1366 | ||
1363 | 1367 | ||
1364 | static void ti_drain(struct ti_port *tport, unsigned long timeout, int flush) | 1368 | static void ti_drain(struct ti_port *tport, unsigned long timeout) |
1365 | { | 1369 | { |
1366 | struct ti_device *tdev = tport->tp_tdev; | 1370 | struct ti_device *tdev = tport->tp_tdev; |
1367 | struct usb_serial_port *port = tport->tp_port; | 1371 | struct usb_serial_port *port = tport->tp_port; |
@@ -1386,11 +1390,6 @@ static void ti_drain(struct ti_port *tport, unsigned long timeout, int flush) | |||
1386 | } | 1390 | } |
1387 | set_current_state(TASK_RUNNING); | 1391 | set_current_state(TASK_RUNNING); |
1388 | remove_wait_queue(&tport->tp_write_wait, &wait); | 1392 | remove_wait_queue(&tport->tp_write_wait, &wait); |
1389 | |||
1390 | /* flush any remaining data in the buffer */ | ||
1391 | if (flush) | ||
1392 | kfifo_reset_out(&tport->write_fifo); | ||
1393 | |||
1394 | spin_unlock_irq(&tport->tp_lock); | 1393 | spin_unlock_irq(&tport->tp_lock); |
1395 | 1394 | ||
1396 | mutex_lock(&port->serial->disc_mutex); | 1395 | mutex_lock(&port->serial->disc_mutex); |