diff options
Diffstat (limited to 'drivers/usb/serial/ftdi_sio.c')
-rw-r--r-- | drivers/usb/serial/ftdi_sio.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index ba68835d06a6..eaa038d032b8 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -1960,9 +1960,8 @@ static int ftdi_prepare_write_buffer(struct usb_serial_port *port, | |||
1960 | 1960 | ||
1961 | #define FTDI_RS_ERR_MASK (FTDI_RS_BI | FTDI_RS_PE | FTDI_RS_FE | FTDI_RS_OE) | 1961 | #define FTDI_RS_ERR_MASK (FTDI_RS_BI | FTDI_RS_PE | FTDI_RS_FE | FTDI_RS_OE) |
1962 | 1962 | ||
1963 | static int ftdi_process_packet(struct tty_struct *tty, | 1963 | static int ftdi_process_packet(struct usb_serial_port *port, |
1964 | struct usb_serial_port *port, struct ftdi_private *priv, | 1964 | struct ftdi_private *priv, char *packet, int len) |
1965 | char *packet, int len) | ||
1966 | { | 1965 | { |
1967 | int i; | 1966 | int i; |
1968 | char status; | 1967 | char status; |
@@ -2012,7 +2011,7 @@ static int ftdi_process_packet(struct tty_struct *tty, | |||
2012 | /* Overrun is special, not associated with a char */ | 2011 | /* Overrun is special, not associated with a char */ |
2013 | if (packet[1] & FTDI_RS_OE) { | 2012 | if (packet[1] & FTDI_RS_OE) { |
2014 | priv->icount.overrun++; | 2013 | priv->icount.overrun++; |
2015 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | 2014 | tty_insert_flip_char(&port->port, 0, TTY_OVERRUN); |
2016 | } | 2015 | } |
2017 | } | 2016 | } |
2018 | 2017 | ||
@@ -2031,10 +2030,10 @@ static int ftdi_process_packet(struct tty_struct *tty, | |||
2031 | if (port->port.console && port->sysrq) { | 2030 | if (port->port.console && port->sysrq) { |
2032 | for (i = 0; i < len; i++, ch++) { | 2031 | for (i = 0; i < len; i++, ch++) { |
2033 | if (!usb_serial_handle_sysrq_char(port, *ch)) | 2032 | if (!usb_serial_handle_sysrq_char(port, *ch)) |
2034 | tty_insert_flip_char(tty, *ch, flag); | 2033 | tty_insert_flip_char(&port->port, *ch, flag); |
2035 | } | 2034 | } |
2036 | } else { | 2035 | } else { |
2037 | tty_insert_flip_string_fixed_flag(tty, ch, flag, len); | 2036 | tty_insert_flip_string_fixed_flag(&port->port, ch, flag, len); |
2038 | } | 2037 | } |
2039 | 2038 | ||
2040 | return len; | 2039 | return len; |
@@ -2043,25 +2042,19 @@ static int ftdi_process_packet(struct tty_struct *tty, | |||
2043 | static void ftdi_process_read_urb(struct urb *urb) | 2042 | static void ftdi_process_read_urb(struct urb *urb) |
2044 | { | 2043 | { |
2045 | struct usb_serial_port *port = urb->context; | 2044 | struct usb_serial_port *port = urb->context; |
2046 | struct tty_struct *tty; | ||
2047 | struct ftdi_private *priv = usb_get_serial_port_data(port); | 2045 | struct ftdi_private *priv = usb_get_serial_port_data(port); |
2048 | char *data = (char *)urb->transfer_buffer; | 2046 | char *data = (char *)urb->transfer_buffer; |
2049 | int i; | 2047 | int i; |
2050 | int len; | 2048 | int len; |
2051 | int count = 0; | 2049 | int count = 0; |
2052 | 2050 | ||
2053 | tty = tty_port_tty_get(&port->port); | ||
2054 | if (!tty) | ||
2055 | return; | ||
2056 | |||
2057 | for (i = 0; i < urb->actual_length; i += priv->max_packet_size) { | 2051 | for (i = 0; i < urb->actual_length; i += priv->max_packet_size) { |
2058 | len = min_t(int, urb->actual_length - i, priv->max_packet_size); | 2052 | len = min_t(int, urb->actual_length - i, priv->max_packet_size); |
2059 | count += ftdi_process_packet(tty, port, priv, &data[i], len); | 2053 | count += ftdi_process_packet(port, priv, &data[i], len); |
2060 | } | 2054 | } |
2061 | 2055 | ||
2062 | if (count) | 2056 | if (count) |
2063 | tty_flip_buffer_push(tty); | 2057 | tty_flip_buffer_push(&port->port); |
2064 | tty_kref_put(tty); | ||
2065 | } | 2058 | } |
2066 | 2059 | ||
2067 | static void ftdi_break_ctl(struct tty_struct *tty, int break_state) | 2060 | static void ftdi_break_ctl(struct tty_struct *tty, int break_state) |