This is a note to let you know that I've just added the patch titled

    USB: ti_usb_3410_5052: fix chars_in_buffer overhead

to the 3.9-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     usb-ti_usb_3410_5052-fix-chars_in_buffer-overhead.patch
and it can be found in the queue-3.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From ff93b19eed0d5c124ee7168650a8e2e120ac8ea4 Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Sun, 5 May 2013 20:32:32 +0200
Subject: USB: ti_usb_3410_5052: fix chars_in_buffer overhead

From: Johan Hovold <[email protected]>

commit ff93b19eed0d5c124ee7168650a8e2e120ac8ea4 upstream.

Use the new generic usb-serial wait_until_sent implementation to wait
for hardware buffers to drain.

This removes the need to check the hardware buffers in chars_in_buffer
and thus removes the overhead introduced by commit 2c992cd73 ("USB:
ti_usb_3410_5052: query hardware-buffer status in chars_in_buffer")
without breaking tty_wait_until_sent (used by, for example, tcdrain,
tcsendbreak and close).

Signed-off-by: Johan Hovold <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 drivers/usb/serial/ti_usb_3410_5052.c |   23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -103,6 +103,7 @@ static int ti_write(struct tty_struct *t
                const unsigned char *data, int count);
 static int ti_write_room(struct tty_struct *tty);
 static int ti_chars_in_buffer(struct tty_struct *tty);
+static bool ti_tx_empty(struct usb_serial_port *port);
 static void ti_throttle(struct tty_struct *tty);
 static void ti_unthrottle(struct tty_struct *tty);
 static int ti_ioctl(struct tty_struct *tty,
@@ -228,6 +229,7 @@ static struct usb_serial_driver ti_1port
        .write                  = ti_write,
        .write_room             = ti_write_room,
        .chars_in_buffer        = ti_chars_in_buffer,
+       .tx_empty               = ti_tx_empty,
        .throttle               = ti_throttle,
        .unthrottle             = ti_unthrottle,
        .ioctl                  = ti_ioctl,
@@ -258,6 +260,7 @@ static struct usb_serial_driver ti_2port
        .write                  = ti_write,
        .write_room             = ti_write_room,
        .chars_in_buffer        = ti_chars_in_buffer,
+       .tx_empty               = ti_tx_empty,
        .throttle               = ti_throttle,
        .unthrottle             = ti_unthrottle,
        .ioctl                  = ti_ioctl,
@@ -686,8 +689,6 @@ static int ti_chars_in_buffer(struct tty
        struct ti_port *tport = usb_get_serial_port_data(port);
        int chars = 0;
        unsigned long flags;
-       int ret;
-       u8 lsr;
 
        if (tport == NULL)
                return 0;
@@ -696,16 +697,22 @@ static int ti_chars_in_buffer(struct tty
        chars = kfifo_len(&tport->write_fifo);
        spin_unlock_irqrestore(&tport->tp_lock, flags);
 
-       if (!chars) {
-               ret = ti_get_lsr(tport, &lsr);
-               if (!ret && !(lsr & TI_LSR_TX_EMPTY))
-                       chars = 1;
-       }
-
        dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars);
        return chars;
 }
 
+static bool ti_tx_empty(struct usb_serial_port *port)
+{
+       struct ti_port *tport = usb_get_serial_port_data(port);
+       int ret;
+       u8 lsr;
+
+       ret = ti_get_lsr(tport, &lsr);
+       if (!ret && !(lsr & TI_LSR_TX_EMPTY))
+               return false;
+
+       return true;
+}
 
 static void ti_throttle(struct tty_struct *tty)
 {


Patches currently in stable-queue which might be from [email protected] are

queue-3.9/usb-mos7720-fix-dma-to-stack.patch
queue-3.9/usb-ti_usb_3410_5052-fix-chars_in_buffer-overhead.patch
queue-3.9/usb-ftdi_sio-clean-up-get_modem_status.patch
queue-3.9/usb-ftdi_sio-fix-chars_in_buffer-overhead.patch
queue-3.9/usb-zte_ev-fix-broken-open.patch
queue-3.9/usb-ark3116-fix-control-message-timeout.patch
queue-3.9/usb-serial-add-wait_until_sent-operation.patch
queue-3.9/usb-io_ti-fix-chars_in_buffer-overhead.patch
queue-3.9/usb-mos7840-fix-dma-to-stack.patch
queue-3.9/usb-serial-fix-treo-kyocera-interrrupt-in-urb-context.patch
queue-3.9/usb-ti_usb_3410_5052-query-hardware-buffer-status-in-chars_in_buffer.patch
queue-3.9/usb-serial-add-generic-wait_until_sent-implementation.patch
queue-3.9/usb-mos7720-fix-hardware-flow-control.patch
queue-3.9/usb-keyspan-fix-bogus-array-index.patch
queue-3.9/usb-zte_ev-fix-control-message-timeouts.patch
queue-3.9/usb-mos7720-fix-message-timeouts.patch
queue-3.9/usb-iuu_phoenix-fix-bulk-message-timeout.patch
queue-3.9/usb-whiteheat-fix-broken-port-configuration.patch
queue-3.9/usb-ti_usb_3410_5052-remove-lsr-from-port-data.patch
queue-3.9/usb-visor-fix-initialisation-of-treo-kyocera-devices.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to