From 92a19f9cec9a80ad93c06e115822deb729e2c6ad Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Thu, 3 Jan 2013 15:53:03 +0100 Subject: TTY: switch tty_insert_flip_char Now, we start converting tty buffer functions to actually use tty_port. This will allow us to get rid of the need of tty in many call sites. Only tty_port will needed and hence no more tty_port_tty_get in those paths. tty_insert_flip_char is the next one to proceed. This one is used all over the code, so the patch is huge. Signed-off-by: Jiri Slaby Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/ark3116.c | 2 +- drivers/usb/serial/belkin_sa.c | 2 +- drivers/usb/serial/digi_acceleport.c | 2 +- drivers/usb/serial/f81232.c | 5 +++-- drivers/usb/serial/ftdi_sio.c | 11 +++++------ drivers/usb/serial/generic.c | 2 +- drivers/usb/serial/keyspan.c | 21 ++++++++++++--------- drivers/usb/serial/pl2303.c | 5 +++-- drivers/usb/serial/spcp8x5.c | 2 +- drivers/usb/serial/ssu100.c | 10 +++++----- 10 files changed, 33 insertions(+), 29 deletions(-) (limited to 'drivers/usb') diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c index e2d653d00ea..1614feb6a76 100644 --- a/drivers/usb/serial/ark3116.c +++ b/drivers/usb/serial/ark3116.c @@ -703,7 +703,7 @@ static void ark3116_process_read_urb(struct urb *urb) /* overrun is special, not associated with a char */ if (lsr & UART_LSR_OE) - tty_insert_flip_char(tty, 0, TTY_OVERRUN); + tty_insert_flip_char(&port->port, 0, TTY_OVERRUN); } tty_insert_flip_string_fixed_flag(&port->port, data, tty_flag, urb->actual_length); diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c index a213d1be946..7ba2c0bdcec 100644 --- a/drivers/usb/serial/belkin_sa.c +++ b/drivers/usb/serial/belkin_sa.c @@ -276,7 +276,7 @@ static void belkin_sa_process_read_urb(struct urb *urb) /* Overrun is special, not associated with a char. */ if (status & BELKIN_SA_LSR_OE) - tty_insert_flip_char(tty, 0, TTY_OVERRUN); + tty_insert_flip_char(&port->port, 0, TTY_OVERRUN); } tty_insert_flip_string_fixed_flag(&port->port, data, tty_flag, diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index efbc4035410..b5fa738512c 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c @@ -1441,7 +1441,7 @@ static int digi_read_inb_callback(struct urb *urb) /* overrun is special, not associated with a char */ if (port_status & DIGI_OVERRUN_ERROR) - tty_insert_flip_char(tty, 0, TTY_OVERRUN); + tty_insert_flip_char(&port->port, 0, TTY_OVERRUN); /* break takes precedence over parity, */ /* which takes precedence over framing errors */ diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c index a8c6430bf1b..6b880c33d25 100644 --- a/drivers/usb/serial/f81232.c +++ b/drivers/usb/serial/f81232.c @@ -133,12 +133,13 @@ static void f81232_process_read_urb(struct urb *urb) /* overrun is special, not associated with a char */ if (line_status & UART_OVERRUN_ERROR) - tty_insert_flip_char(tty, 0, TTY_OVERRUN); + tty_insert_flip_char(&port->port, 0, TTY_OVERRUN); if (port->port.console && port->sysrq) { for (i = 0; i < urb->actual_length; ++i) if (!usb_serial_handle_sysrq_char(port, data[i])) - tty_insert_flip_char(tty, data[i], tty_flag); + tty_insert_flip_char(&port->port, data[i], + tty_flag); } else { tty_insert_flip_string_fixed_flag(&port->port, data, tty_flag, urb->actual_length); diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 0416d952a44..eb59ba3789a 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -1958,9 +1958,8 @@ static int ftdi_prepare_write_buffer(struct usb_serial_port *port, #define FTDI_RS_ERR_MASK (FTDI_RS_BI | FTDI_RS_PE | FTDI_RS_FE | FTDI_RS_OE) -static int ftdi_process_packet(struct tty_struct *tty, - struct usb_serial_port *port, struct ftdi_private *priv, - char *packet, int len) +static int ftdi_process_packet(struct usb_serial_port *port, + struct ftdi_private *priv, char *packet, int len) { int i; char status; @@ -2010,7 +2009,7 @@ static int ftdi_process_packet(struct tty_struct *tty, /* Overrun is special, not associated with a char */ if (packet[1] & FTDI_RS_OE) { priv->icount.overrun++; - tty_insert_flip_char(tty, 0, TTY_OVERRUN); + tty_insert_flip_char(&port->port, 0, TTY_OVERRUN); } } @@ -2029,7 +2028,7 @@ static int ftdi_process_packet(struct tty_struct *tty, if (port->port.console && port->sysrq) { for (i = 0; i < len; i++, ch++) { if (!usb_serial_handle_sysrq_char(port, *ch)) - tty_insert_flip_char(tty, *ch, flag); + tty_insert_flip_char(&port->port, *ch, flag); } } else { tty_insert_flip_string_fixed_flag(&port->port, ch, flag, len); @@ -2054,7 +2053,7 @@ static void ftdi_process_read_urb(struct urb *urb) for (i = 0; i < urb->actual_length; i += priv->max_packet_size) { len = min_t(int, urb->actual_length - i, priv->max_packet_size); - count += ftdi_process_packet(tty, port, priv, &data[i], len); + count += ftdi_process_packet(port, priv, &data[i], len); } if (count) diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 2ea70a63199..b00110cd568 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c @@ -332,7 +332,7 @@ void usb_serial_generic_process_read_urb(struct urb *urb) else { for (i = 0; i < urb->actual_length; i++, ch++) { if (!usb_serial_handle_sysrq_char(port, *ch)) - tty_insert_flip_char(tty, *ch, TTY_NORMAL); + tty_insert_flip_char(&port->port, *ch, TTY_NORMAL); } } tty_flip_buffer_push(tty); diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index 97bc49f68ef..a4f5caebda4 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c @@ -315,7 +315,7 @@ static void usa26_indat_callback(struct urb *urb) else err = 0; for (i = 1; i < urb->actual_length ; ++i) - tty_insert_flip_char(tty, data[i], err); + tty_insert_flip_char(&port->port, data[i], err); } else { /* some bytes had errors, every byte has status */ dev_dbg(&port->dev, "%s - RX error!!!!\n", __func__); @@ -328,7 +328,8 @@ static void usa26_indat_callback(struct urb *urb) if (stat & RXERROR_PARITY) flag |= TTY_PARITY; /* XXX should handle break (0x10) */ - tty_insert_flip_char(tty, data[i+1], flag); + tty_insert_flip_char(&port->port, data[i+1], + flag); } } tty_flip_buffer_push(tty); @@ -700,7 +701,8 @@ static void usa49_indat_callback(struct urb *urb) if (stat & RXERROR_PARITY) flag |= TTY_PARITY; /* XXX should handle break (0x10) */ - tty_insert_flip_char(tty, data[i+1], flag); + tty_insert_flip_char(&port->port, data[i+1], + flag); } } tty_flip_buffer_push(tty); @@ -751,7 +753,8 @@ static void usa49wg_indat_callback(struct urb *urb) /* no error on any byte */ i++; for (x = 1; x < len ; ++x) - tty_insert_flip_char(tty, data[i++], 0); + tty_insert_flip_char(&port->port, + data[i++], 0); } else { /* * some bytes had errors, every byte has status @@ -765,7 +768,7 @@ static void usa49wg_indat_callback(struct urb *urb) if (stat & RXERROR_PARITY) flag |= TTY_PARITY; /* XXX should handle break (0x10) */ - tty_insert_flip_char(tty, + tty_insert_flip_char(&port->port, data[i+1], flag); i += 2; } @@ -824,8 +827,8 @@ static void usa90_indat_callback(struct urb *urb) else err = 0; for (i = 1; i < urb->actual_length ; ++i) - tty_insert_flip_char(tty, data[i], - err); + tty_insert_flip_char(&port->port, + data[i], err); } else { /* some bytes had errors, every byte has status */ dev_dbg(&port->dev, "%s - RX error!!!!\n", __func__); @@ -838,8 +841,8 @@ static void usa90_indat_callback(struct urb *urb) if (stat & RXERROR_PARITY) flag |= TTY_PARITY; /* XXX should handle break (0x10) */ - tty_insert_flip_char(tty, data[i+1], - flag); + tty_insert_flip_char(&port->port, + data[i+1], flag); } } } diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 86789b0477c..00047f3c729 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c @@ -805,12 +805,13 @@ static void pl2303_process_read_urb(struct urb *urb) /* overrun is special, not associated with a char */ if (line_status & UART_OVERRUN_ERROR) - tty_insert_flip_char(tty, 0, TTY_OVERRUN); + tty_insert_flip_char(&port->port, 0, TTY_OVERRUN); if (port->port.console && port->sysrq) { for (i = 0; i < urb->actual_length; ++i) if (!usb_serial_handle_sysrq_char(port, data[i])) - tty_insert_flip_char(tty, data[i], tty_flag); + tty_insert_flip_char(&port->port, data[i], + tty_flag); } else { tty_insert_flip_string_fixed_flag(&port->port, data, tty_flag, urb->actual_length); diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c index fa42f1b907d..04e37315272 100644 --- a/drivers/usb/serial/spcp8x5.c +++ b/drivers/usb/serial/spcp8x5.c @@ -498,7 +498,7 @@ static void spcp8x5_process_read_urb(struct urb *urb) /* overrun is special, not associated with a char */ if (status & UART_OVERRUN_ERROR) - tty_insert_flip_char(tty, 0, TTY_OVERRUN); + tty_insert_flip_char(&port->port, 0, TTY_OVERRUN); if (status & UART_DCD) usb_serial_handle_dcd_change(port, tty, diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c index 37476c6240c..38713156e95 100644 --- a/drivers/usb/serial/ssu100.c +++ b/drivers/usb/serial/ssu100.c @@ -582,8 +582,7 @@ static void ssu100_update_lsr(struct usb_serial_port *port, u8 lsr, } -static int ssu100_process_packet(struct urb *urb, - struct tty_struct *tty) +static int ssu100_process_packet(struct urb *urb) { struct usb_serial_port *port = urb->context; char *packet = (char *)urb->transfer_buffer; @@ -598,7 +597,8 @@ static int ssu100_process_packet(struct urb *urb, if (packet[2] == 0x00) { ssu100_update_lsr(port, packet[3], &flag); if (flag == TTY_OVERRUN) - tty_insert_flip_char(tty, 0, TTY_OVERRUN); + tty_insert_flip_char(&port->port, 0, + TTY_OVERRUN); } if (packet[2] == 0x01) ssu100_update_msr(port, packet[3]); @@ -614,7 +614,7 @@ static int ssu100_process_packet(struct urb *urb, if (port->port.console && port->sysrq) { for (i = 0; i < len; i++, ch++) { if (!usb_serial_handle_sysrq_char(port, *ch)) - tty_insert_flip_char(tty, *ch, flag); + tty_insert_flip_char(&port->port, *ch, flag); } } else tty_insert_flip_string_fixed_flag(&port->port, ch, flag, len); @@ -632,7 +632,7 @@ static void ssu100_process_read_urb(struct urb *urb) if (!tty) return; - count = ssu100_process_packet(urb, tty); + count = ssu100_process_packet(urb); if (count) tty_flip_buffer_push(tty); -- cgit v1.2.3