aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/serial/ftdi_sio.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 1159fd4cd94d..a62a75a679cd 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -924,7 +924,7 @@ static int ftdi_tiocmset(struct tty_struct *tty,
924static int ftdi_ioctl(struct tty_struct *tty, 924static int ftdi_ioctl(struct tty_struct *tty,
925 unsigned int cmd, unsigned long arg); 925 unsigned int cmd, unsigned long arg);
926static void ftdi_break_ctl(struct tty_struct *tty, int break_state); 926static void ftdi_break_ctl(struct tty_struct *tty, int break_state);
927static int ftdi_chars_in_buffer(struct tty_struct *tty); 927static bool ftdi_tx_empty(struct usb_serial_port *port);
928static int ftdi_get_modem_status(struct usb_serial_port *port, 928static int ftdi_get_modem_status(struct usb_serial_port *port,
929 unsigned char status[2]); 929 unsigned char status[2]);
930 930
@@ -961,7 +961,7 @@ static struct usb_serial_driver ftdi_sio_device = {
961 .ioctl = ftdi_ioctl, 961 .ioctl = ftdi_ioctl,
962 .set_termios = ftdi_set_termios, 962 .set_termios = ftdi_set_termios,
963 .break_ctl = ftdi_break_ctl, 963 .break_ctl = ftdi_break_ctl,
964 .chars_in_buffer = ftdi_chars_in_buffer, 964 .tx_empty = ftdi_tx_empty,
965}; 965};
966 966
967static struct usb_serial_driver * const serial_drivers[] = { 967static struct usb_serial_driver * const serial_drivers[] = {
@@ -2056,27 +2056,18 @@ static void ftdi_break_ctl(struct tty_struct *tty, int break_state)
2056 2056
2057} 2057}
2058 2058
2059static int ftdi_chars_in_buffer(struct tty_struct *tty) 2059static bool ftdi_tx_empty(struct usb_serial_port *port)
2060{ 2060{
2061 struct usb_serial_port *port = tty->driver_data;
2062 int chars;
2063 unsigned char buf[2]; 2061 unsigned char buf[2];
2064 int ret; 2062 int ret;
2065 2063
2066 chars = usb_serial_generic_chars_in_buffer(tty);
2067 if (chars)
2068 goto out;
2069
2070 /* Check if hardware buffer is empty. */
2071 ret = ftdi_get_modem_status(port, buf); 2064 ret = ftdi_get_modem_status(port, buf);
2072 if (ret == 2) { 2065 if (ret == 2) {
2073 if (!(buf[1] & FTDI_RS_TEMT)) 2066 if (!(buf[1] & FTDI_RS_TEMT))
2074 chars = 1; 2067 return false;
2075 } 2068 }
2076out:
2077 dev_dbg(&port->dev, "%s - %d\n", __func__, chars);
2078 2069
2079 return chars; 2070 return true;
2080} 2071}
2081 2072
2082/* old_termios contains the original termios settings and tty->termios contains 2073/* old_termios contains the original termios settings and tty->termios contains