]> git.ipfire.org Git - people/arne_f/kernel.git/commit - drivers/usb/serial/ftdi_sio.c
usb: serial: ftdi_sio: Add missing chars_in_buffer function
authorJarkko Huijts <jarkko.huijts@gmail.com>
Wed, 10 Oct 2012 13:05:06 +0000 (15:05 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Oct 2012 16:42:26 +0000 (09:42 -0700)
commit6f602912c9d0c84c2edbd446dd9f72660b701605
tree55f34e6658cab9f17f845ec9255a76e25f42ee9f
parentbd066eef1aea5dd1f8e98934c4c6d21c5e0439c8
usb: serial: ftdi_sio: Add missing chars_in_buffer function

The driver does not wait until the hardware buffer (for data from the PC to the
UART line) is drained when tcdrain or close is called in an application.
Solution: Implement a chars_in_buffer function that checks both the software
and hardware buffer. If the TEMT (TX empty) bit of the line status register
indicates the hw buffer is not empty, let the function return at least 1. This
has been verified to work correctly with an FT232RL. The check on the hw buffer
can not be done for the original SIO device.

Signed-off-by: Jarkko Huijts <jarkko.huijts@gmail.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/serial/ftdi_sio.c