diff options
Diffstat (limited to 'drivers/usb/serial/ftdi_sio.c')
-rw-r--r-- | drivers/usb/serial/ftdi_sio.c | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 242b5776648a..7260ec660347 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -189,6 +189,8 @@ static struct usb_device_id id_table_combined [] = { | |||
189 | { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_PID) }, | 189 | { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_PID) }, |
190 | { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_BOOST_PID) }, | 190 | { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_BOOST_PID) }, |
191 | { USB_DEVICE(NEWPORT_VID, NEWPORT_AGILIS_PID) }, | 191 | { USB_DEVICE(NEWPORT_VID, NEWPORT_AGILIS_PID) }, |
192 | { USB_DEVICE(NEWPORT_VID, NEWPORT_CONEX_CC_PID) }, | ||
193 | { USB_DEVICE(NEWPORT_VID, NEWPORT_CONEX_AGP_PID) }, | ||
192 | { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) }, | 194 | { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) }, |
193 | { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) }, | 195 | { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) }, |
194 | { USB_DEVICE(FTDI_VID, FTDI_SPROG_II) }, | 196 | { USB_DEVICE(FTDI_VID, FTDI_SPROG_II) }, |
@@ -924,8 +926,8 @@ static int ftdi_tiocmset(struct tty_struct *tty, | |||
924 | static int ftdi_ioctl(struct tty_struct *tty, | 926 | static int ftdi_ioctl(struct tty_struct *tty, |
925 | unsigned int cmd, unsigned long arg); | 927 | unsigned int cmd, unsigned long arg); |
926 | static void ftdi_break_ctl(struct tty_struct *tty, int break_state); | 928 | static void ftdi_break_ctl(struct tty_struct *tty, int break_state); |
927 | static int ftdi_chars_in_buffer(struct tty_struct *tty); | 929 | static bool ftdi_tx_empty(struct usb_serial_port *port); |
928 | static int ftdi_get_modem_status(struct tty_struct *tty, | 930 | static int ftdi_get_modem_status(struct usb_serial_port *port, |
929 | unsigned char status[2]); | 931 | unsigned char status[2]); |
930 | 932 | ||
931 | static unsigned short int ftdi_232am_baud_base_to_divisor(int baud, int base); | 933 | static unsigned short int ftdi_232am_baud_base_to_divisor(int baud, int base); |
@@ -961,7 +963,7 @@ static struct usb_serial_driver ftdi_sio_device = { | |||
961 | .ioctl = ftdi_ioctl, | 963 | .ioctl = ftdi_ioctl, |
962 | .set_termios = ftdi_set_termios, | 964 | .set_termios = ftdi_set_termios, |
963 | .break_ctl = ftdi_break_ctl, | 965 | .break_ctl = ftdi_break_ctl, |
964 | .chars_in_buffer = ftdi_chars_in_buffer, | 966 | .tx_empty = ftdi_tx_empty, |
965 | }; | 967 | }; |
966 | 968 | ||
967 | static struct usb_serial_driver * const serial_drivers[] = { | 969 | static struct usb_serial_driver * const serial_drivers[] = { |
@@ -2056,27 +2058,18 @@ static void ftdi_break_ctl(struct tty_struct *tty, int break_state) | |||
2056 | 2058 | ||
2057 | } | 2059 | } |
2058 | 2060 | ||
2059 | static int ftdi_chars_in_buffer(struct tty_struct *tty) | 2061 | static bool ftdi_tx_empty(struct usb_serial_port *port) |
2060 | { | 2062 | { |
2061 | struct usb_serial_port *port = tty->driver_data; | ||
2062 | int chars; | ||
2063 | unsigned char buf[2]; | 2063 | unsigned char buf[2]; |
2064 | int ret; | 2064 | int ret; |
2065 | 2065 | ||
2066 | chars = usb_serial_generic_chars_in_buffer(tty); | 2066 | ret = ftdi_get_modem_status(port, buf); |
2067 | if (chars) | ||
2068 | goto out; | ||
2069 | |||
2070 | /* Check if hardware buffer is empty. */ | ||
2071 | ret = ftdi_get_modem_status(tty, buf); | ||
2072 | if (ret == 2) { | 2067 | if (ret == 2) { |
2073 | if (!(buf[1] & FTDI_RS_TEMT)) | 2068 | if (!(buf[1] & FTDI_RS_TEMT)) |
2074 | chars = 1; | 2069 | return false; |
2075 | } | 2070 | } |
2076 | out: | ||
2077 | dev_dbg(&port->dev, "%s - %d\n", __func__, chars); | ||
2078 | 2071 | ||
2079 | return chars; | 2072 | return true; |
2080 | } | 2073 | } |
2081 | 2074 | ||
2082 | /* old_termios contains the original termios settings and tty->termios contains | 2075 | /* old_termios contains the original termios settings and tty->termios contains |
@@ -2268,10 +2261,9 @@ no_c_cflag_changes: | |||
2268 | * Returns the number of status bytes retrieved (device dependant), or | 2261 | * Returns the number of status bytes retrieved (device dependant), or |
2269 | * negative error code. | 2262 | * negative error code. |
2270 | */ | 2263 | */ |
2271 | static int ftdi_get_modem_status(struct tty_struct *tty, | 2264 | static int ftdi_get_modem_status(struct usb_serial_port *port, |
2272 | unsigned char status[2]) | 2265 | unsigned char status[2]) |
2273 | { | 2266 | { |
2274 | struct usb_serial_port *port = tty->driver_data; | ||
2275 | struct ftdi_private *priv = usb_get_serial_port_data(port); | 2267 | struct ftdi_private *priv = usb_get_serial_port_data(port); |
2276 | unsigned char *buf; | 2268 | unsigned char *buf; |
2277 | int len; | 2269 | int len; |
@@ -2336,7 +2328,7 @@ static int ftdi_tiocmget(struct tty_struct *tty) | |||
2336 | unsigned char buf[2]; | 2328 | unsigned char buf[2]; |
2337 | int ret; | 2329 | int ret; |
2338 | 2330 | ||
2339 | ret = ftdi_get_modem_status(tty, buf); | 2331 | ret = ftdi_get_modem_status(port, buf); |
2340 | if (ret < 0) | 2332 | if (ret < 0) |
2341 | return ret; | 2333 | return ret; |
2342 | 2334 | ||