aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/isdn/gigaset/interface.c2
-rw-r--r--drivers/isdn/i4l/isdn_common.c5
-rw-r--r--drivers/isdn/i4l/isdn_common.h2
-rw-r--r--drivers/isdn/i4l/isdn_tty.c6
-rw-r--r--drivers/net/usb/hso.c7
-rw-r--r--drivers/s390/char/con3215.c3
-rw-r--r--drivers/s390/char/sclp_tty.c4
-rw-r--r--drivers/s390/char/sclp_vt220.c2
-rw-r--r--drivers/staging/ccg/u_serial.c2
-rw-r--r--drivers/tty/bfin_jtag_comm.c2
-rw-r--r--drivers/tty/ehv_bytechan.c2
-rw-r--r--drivers/tty/hvc/hvcs.c2
-rw-r--r--drivers/tty/ipwireless/tty.c2
-rw-r--r--drivers/tty/n_gsm.c2
-rw-r--r--drivers/tty/nozomi.c14
-rw-r--r--drivers/tty/pty.c2
-rw-r--r--drivers/tty/serial/amba-pl011.c6
-rw-r--r--drivers/tty/serial/atmel_serial.c6
-rw-r--r--drivers/tty/serial/crisv10.c2
-rw-r--r--drivers/tty/serial/icom.c2
-rw-r--r--drivers/tty/serial/ifx6x60.c2
-rw-r--r--drivers/tty/serial/ioc3_serial.c3
-rw-r--r--drivers/tty/serial/ioc4_serial.c2
-rw-r--r--drivers/tty/serial/jsm/jsm_tty.c2
-rw-r--r--drivers/tty/serial/mfd.c5
-rw-r--r--drivers/tty/serial/mrst_max3110.c2
-rw-r--r--drivers/tty/serial/msm_serial.c2
-rw-r--r--drivers/tty/serial/msm_serial_hs.c2
-rw-r--r--drivers/tty/serial/mxs-auart.c5
-rw-r--r--drivers/tty/serial/pch_uart.c10
-rw-r--r--drivers/tty/serial/sunhv.c13
-rw-r--r--drivers/usb/class/cdc-acm.c3
-rw-r--r--drivers/usb/gadget/u_serial.c11
-rw-r--r--drivers/usb/serial/aircable.c9
-rw-r--r--drivers/usb/serial/cyberjack.c2
-rw-r--r--drivers/usb/serial/garmin_gps.c2
-rw-r--r--drivers/usb/serial/generic.c2
-rw-r--r--drivers/usb/serial/io_edgeport.c12
-rw-r--r--drivers/usb/serial/io_ti.c13
-rw-r--r--drivers/usb/serial/ir-usb.c2
-rw-r--r--drivers/usb/serial/iuu_phoenix.c2
-rw-r--r--drivers/usb/serial/keyspan.c8
-rw-r--r--drivers/usb/serial/keyspan_pda.c2
-rw-r--r--drivers/usb/serial/kl5kusb105.c2
-rw-r--r--drivers/usb/serial/kobil_sct.c2
-rw-r--r--drivers/usb/serial/mct_u232.c2
-rw-r--r--drivers/usb/serial/metro-usb.c2
-rw-r--r--drivers/usb/serial/mos7720.c2
-rw-r--r--drivers/usb/serial/mos7840.c5
-rw-r--r--drivers/usb/serial/navman.c2
-rw-r--r--drivers/usb/serial/omninet.c5
-rw-r--r--drivers/usb/serial/opticon.c2
-rw-r--r--drivers/usb/serial/oti6858.c2
-rw-r--r--drivers/usb/serial/quatech2.c8
-rw-r--r--drivers/usb/serial/safe_serial.c2
-rw-r--r--drivers/usb/serial/sierra.c2
-rw-r--r--drivers/usb/serial/symbolserial.c3
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c11
-rw-r--r--drivers/usb/serial/usb_wwan.c2
-rw-r--r--include/linux/tty_flip.h5
-rw-r--r--net/bluetooth/rfcomm/tty.c5
-rw-r--r--net/irda/ircomm/ircomm_tty.c2
62 files changed, 130 insertions, 127 deletions
diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c
index 67abf3ff45e8..dd2a57eca2e7 100644
--- a/drivers/isdn/gigaset/interface.c
+++ b/drivers/isdn/gigaset/interface.c
@@ -569,7 +569,7 @@ void gigaset_if_receive(struct cardstate *cs,
569 return; 569 return;
570 } 570 }
571 571
572 tty_insert_flip_string(tty, buffer, len); 572 tty_insert_flip_string(&cs->port, buffer, len);
573 tty_flip_buffer_push(tty); 573 tty_flip_buffer_push(tty);
574 tty_kref_put(tty); 574 tty_kref_put(tty);
575} 575}
diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c
index 4a387ec021ad..b87d9e577be2 100644
--- a/drivers/isdn/i4l/isdn_common.c
+++ b/drivers/isdn/i4l/isdn_common.c
@@ -876,9 +876,8 @@ isdn_readbchan(int di, int channel, u_char *buf, u_char *fp, int len, wait_queue
876 * of the mapping (di,ch)<->minor, happen during the sleep? --he 876 * of the mapping (di,ch)<->minor, happen during the sleep? --he
877 */ 877 */
878int 878int
879isdn_readbchan_tty(int di, int channel, struct tty_struct *tty, int cisco_hack) 879isdn_readbchan_tty(int di, int channel, struct tty_port *port, int cisco_hack)
880{ 880{
881 struct tty_port *port = tty->port;
882 int count; 881 int count;
883 int count_pull; 882 int count_pull;
884 int count_put; 883 int count_put;
@@ -941,7 +940,7 @@ isdn_readbchan_tty(int di, int channel, struct tty_struct *tty, int cisco_hack)
941 } 940 }
942 count_put = count_pull; 941 count_put = count_pull;
943 if (count_put > 1) 942 if (count_put > 1)
944 tty_insert_flip_string(tty, skb->data, count_put - 1); 943 tty_insert_flip_string(port, skb->data, count_put - 1);
945 last = skb->data[count_put - 1]; 944 last = skb->data[count_put - 1];
946 len -= count_put; 945 len -= count_put;
947#ifdef CONFIG_ISDN_AUDIO 946#ifdef CONFIG_ISDN_AUDIO
diff --git a/drivers/isdn/i4l/isdn_common.h b/drivers/isdn/i4l/isdn_common.h
index 9a471f62e1d4..2260ef07ab9c 100644
--- a/drivers/isdn/i4l/isdn_common.h
+++ b/drivers/isdn/i4l/isdn_common.h
@@ -37,7 +37,7 @@ extern void isdn_timer_ctrl(int tf, int onoff);
37extern void isdn_unexclusive_channel(int di, int ch); 37extern void isdn_unexclusive_channel(int di, int ch);
38extern int isdn_getnum(char **); 38extern int isdn_getnum(char **);
39extern int isdn_readbchan(int, int, u_char *, u_char *, int, wait_queue_head_t *); 39extern int isdn_readbchan(int, int, u_char *, u_char *, int, wait_queue_head_t *);
40extern int isdn_readbchan_tty(int, int, struct tty_struct *, int); 40extern int isdn_readbchan_tty(int, int, struct tty_port *, int);
41extern int isdn_get_free_channel(int, int, int, int, int, char *); 41extern int isdn_get_free_channel(int, int, int, int, int, char *);
42extern int isdn_writebuf_skb_stub(int, int, int, struct sk_buff *); 42extern int isdn_writebuf_skb_stub(int, int, int, struct sk_buff *);
43extern int register_isdn(isdn_if *i); 43extern int register_isdn(isdn_if *i);
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c
index 32d65d4bc848..9bb9986659e4 100644
--- a/drivers/isdn/i4l/isdn_tty.c
+++ b/drivers/isdn/i4l/isdn_tty.c
@@ -101,7 +101,7 @@ isdn_tty_try_read(modem_info *info, struct sk_buff *skb)
101 } else { 101 } else {
102#endif 102#endif
103 if (len > 1) 103 if (len > 1)
104 tty_insert_flip_string(tty, skb->data, len - 1); 104 tty_insert_flip_string(port, skb->data, len - 1);
105 last = skb->data[len - 1]; 105 last = skb->data[len - 1];
106#ifdef CONFIG_ISDN_AUDIO 106#ifdef CONFIG_ISDN_AUDIO
107 } 107 }
@@ -150,9 +150,9 @@ isdn_tty_readmodem(void)
150 if (info->mcr & UART_MCR_RTS) { 150 if (info->mcr & UART_MCR_RTS) {
151 /* CISCO AsyncPPP Hack */ 151 /* CISCO AsyncPPP Hack */
152 if (!(info->emu.mdmreg[REG_CPPP] & BIT_CPPP)) 152 if (!(info->emu.mdmreg[REG_CPPP] & BIT_CPPP))
153 r = isdn_readbchan_tty(info->isdn_driver, info->isdn_channel, tty, 0); 153 r = isdn_readbchan_tty(info->isdn_driver, info->isdn_channel, &info->port, 0);
154 else 154 else
155 r = isdn_readbchan_tty(info->isdn_driver, info->isdn_channel, tty, 1); 155 r = isdn_readbchan_tty(info->isdn_driver, info->isdn_channel, &info->port, 1);
156 if (r) 156 if (r)
157 tty_flip_buffer_push(tty); 157 tty_flip_buffer_push(tty);
158 } else 158 } else
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index cd8ccb240f4b..d235ca07548f 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -2044,10 +2044,9 @@ static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial)
2044 tty_kref_put(tty); 2044 tty_kref_put(tty);
2045 return -1; 2045 return -1;
2046 } 2046 }
2047 curr_write_len = tty_insert_flip_string 2047 curr_write_len = tty_insert_flip_string(&serial->port,
2048 (tty, urb->transfer_buffer + 2048 urb->transfer_buffer + serial->curr_rx_urb_offset,
2049 serial->curr_rx_urb_offset, 2049 write_length_remaining);
2050 write_length_remaining);
2051 serial->curr_rx_urb_offset += curr_write_len; 2050 serial->curr_rx_urb_offset += curr_write_len;
2052 write_length_remaining -= curr_write_len; 2051 write_length_remaining -= curr_write_len;
2053 tty_flip_buffer_push(tty); 2052 tty_flip_buffer_push(tty);
diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c
index 7c7294590880..4c6743dd5357 100644
--- a/drivers/s390/char/con3215.c
+++ b/drivers/s390/char/con3215.c
@@ -425,7 +425,8 @@ static void raw3215_irq(struct ccw_device *cdev, unsigned long intparm,
425 count++; 425 count++;
426 } else 426 } else
427 count -= 2; 427 count -= 2;
428 tty_insert_flip_string(tty, raw->inbuf, count); 428 tty_insert_flip_string(&raw->port, raw->inbuf,
429 count);
429 tty_flip_buffer_push(tty); 430 tty_flip_buffer_push(tty);
430 break; 431 break;
431 } 432 }
diff --git a/drivers/s390/char/sclp_tty.c b/drivers/s390/char/sclp_tty.c
index c03863a7d455..3ffddbb53d2f 100644
--- a/drivers/s390/char/sclp_tty.c
+++ b/drivers/s390/char/sclp_tty.c
@@ -351,10 +351,10 @@ sclp_tty_input(unsigned char* buf, unsigned int count)
351 (strncmp((const char *) buf + count - 2, "^n", 2) && 351 (strncmp((const char *) buf + count - 2, "^n", 2) &&
352 strncmp((const char *) buf + count - 2, "\252n", 2))) { 352 strncmp((const char *) buf + count - 2, "\252n", 2))) {
353 /* add the auto \n */ 353 /* add the auto \n */
354 tty_insert_flip_string(tty, buf, count); 354 tty_insert_flip_string(&sclp_port, buf, count);
355 tty_insert_flip_char(&sclp_port, '\n', TTY_NORMAL); 355 tty_insert_flip_char(&sclp_port, '\n', TTY_NORMAL);
356 } else 356 } else
357 tty_insert_flip_string(tty, buf, count - 2); 357 tty_insert_flip_string(&sclp_port, buf, count - 2);
358 tty_flip_buffer_push(tty); 358 tty_flip_buffer_push(tty);
359 break; 359 break;
360 } 360 }
diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c
index effcc8756e0a..b5507f199b24 100644
--- a/drivers/s390/char/sclp_vt220.c
+++ b/drivers/s390/char/sclp_vt220.c
@@ -480,7 +480,7 @@ sclp_vt220_receiver_fn(struct evbuf_header *evbuf)
480 /* Send input to line discipline */ 480 /* Send input to line discipline */
481 buffer++; 481 buffer++;
482 count--; 482 count--;
483 tty_insert_flip_string(tty, buffer, count); 483 tty_insert_flip_string(&sclp_vt220_port, buffer, count);
484 tty_flip_buffer_push(tty); 484 tty_flip_buffer_push(tty);
485 break; 485 break;
486 } 486 }
diff --git a/drivers/staging/ccg/u_serial.c b/drivers/staging/ccg/u_serial.c
index 373c40656b52..7df2c02d1137 100644
--- a/drivers/staging/ccg/u_serial.c
+++ b/drivers/staging/ccg/u_serial.c
@@ -529,7 +529,7 @@ static void gs_rx_push(unsigned long _port)
529 size -= n; 529 size -= n;
530 } 530 }
531 531
532 count = tty_insert_flip_string(tty, packet, size); 532 count = tty_insert_flip_string(&port->port, packet, size);
533 if (count) 533 if (count)
534 do_push = true; 534 do_push = true;
535 if (count != size) { 535 if (count != size) {
diff --git a/drivers/tty/bfin_jtag_comm.c b/drivers/tty/bfin_jtag_comm.c
index 1cfcdbf1d0cc..143c38579cb5 100644
--- a/drivers/tty/bfin_jtag_comm.c
+++ b/drivers/tty/bfin_jtag_comm.c
@@ -104,7 +104,7 @@ bfin_jc_emudat_manager(void *arg)
104 size_t num_chars = (4 <= inbound_len ? 4 : inbound_len); 104 size_t num_chars = (4 <= inbound_len ? 4 : inbound_len);
105 pr_debug(" incoming data: 0x%08x (pushing %zu)\n", emudat, num_chars); 105 pr_debug(" incoming data: 0x%08x (pushing %zu)\n", emudat, num_chars);
106 inbound_len -= num_chars; 106 inbound_len -= num_chars;
107 tty_insert_flip_string(tty, (unsigned char *)&emudat, num_chars); 107 tty_insert_flip_string(&port, (unsigned char *)&emudat, num_chars);
108 tty_flip_buffer_push(tty); 108 tty_flip_buffer_push(tty);
109 } 109 }
110 } 110 }
diff --git a/drivers/tty/ehv_bytechan.c b/drivers/tty/ehv_bytechan.c
index af97e39d641c..5164f9a57017 100644
--- a/drivers/tty/ehv_bytechan.c
+++ b/drivers/tty/ehv_bytechan.c
@@ -407,7 +407,7 @@ static irqreturn_t ehv_bc_tty_rx_isr(int irq, void *data)
407 */ 407 */
408 408
409 /* Pass the received data to the tty layer. */ 409 /* Pass the received data to the tty layer. */
410 ret = tty_insert_flip_string(ttys, buffer, len); 410 ret = tty_insert_flip_string(&bc->port, buffer, len);
411 411
412 /* 'ret' is the number of bytes that the TTY layer accepted. 412 /* 'ret' is the number of bytes that the TTY layer accepted.
413 * If it's not equal to 'len', then it means the buffer is 413 * If it's not equal to 'len', then it means the buffer is
diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c
index 4a0ab98e9a63..7bfc0a924b2f 100644
--- a/drivers/tty/hvc/hvcs.c
+++ b/drivers/tty/hvc/hvcs.c
@@ -613,7 +613,7 @@ static int hvcs_io(struct hvcs_struct *hvcsd)
613 got = hvc_get_chars(unit_address, 613 got = hvc_get_chars(unit_address,
614 &buf[0], 614 &buf[0],
615 HVCS_BUFF_LEN); 615 HVCS_BUFF_LEN);
616 tty_insert_flip_string(tty, buf, got); 616 tty_insert_flip_string(&hvcsd->port, buf, got);
617 } 617 }
618 618
619 /* Give the TTY time to process the data we just sent. */ 619 /* Give the TTY time to process the data we just sent. */
diff --git a/drivers/tty/ipwireless/tty.c b/drivers/tty/ipwireless/tty.c
index 2cde13ddf9fc..a3ad5e14cbef 100644
--- a/drivers/tty/ipwireless/tty.c
+++ b/drivers/tty/ipwireless/tty.c
@@ -176,7 +176,7 @@ void ipwireless_tty_received(struct ipw_tty *tty, unsigned char *data,
176 } 176 }
177 mutex_unlock(&tty->ipw_tty_mutex); 177 mutex_unlock(&tty->ipw_tty_mutex);
178 178
179 work = tty_insert_flip_string(linux_tty, data, length); 179 work = tty_insert_flip_string(&tty->port, data, length);
180 180
181 if (work != length) 181 if (work != length)
182 printk(KERN_DEBUG IPWIRELESS_PCCARD_NAME 182 printk(KERN_DEBUG IPWIRELESS_PCCARD_NAME
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 769016504c88..4a3342d21c8f 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -1578,7 +1578,7 @@ static void gsm_dlci_data(struct gsm_dlci *dlci, u8 *data, int clen)
1578 /* Line state will go via DLCI 0 controls only */ 1578 /* Line state will go via DLCI 0 controls only */
1579 case 1: 1579 case 1:
1580 default: 1580 default:
1581 tty_insert_flip_string(tty, data, len); 1581 tty_insert_flip_string(port, data, len);
1582 tty_flip_buffer_push(tty); 1582 tty_flip_buffer_push(tty);
1583 } 1583 }
1584 tty_kref_put(tty); 1584 tty_kref_put(tty);
diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c
index 437a6366fb7b..941fe8060ea5 100644
--- a/drivers/tty/nozomi.c
+++ b/drivers/tty/nozomi.c
@@ -827,15 +827,10 @@ static int receive_data(enum port_type index, struct nozomi *dc)
827 struct tty_struct *tty = tty_port_tty_get(&port->port); 827 struct tty_struct *tty = tty_port_tty_get(&port->port);
828 int i, ret; 828 int i, ret;
829 829
830 if (unlikely(!tty)) {
831 DBG1("tty not open for port: %d?", index);
832 return 1;
833 }
834
835 read_mem32((u32 *) &size, addr, 4); 830 read_mem32((u32 *) &size, addr, 4);
836 /* DBG1( "%d bytes port: %d", size, index); */ 831 /* DBG1( "%d bytes port: %d", size, index); */
837 832
838 if (test_bit(TTY_THROTTLED, &tty->flags)) { 833 if (tty && test_bit(TTY_THROTTLED, &tty->flags)) {
839 DBG1("No room in tty, don't read data, don't ack interrupt, " 834 DBG1("No room in tty, don't read data, don't ack interrupt, "
840 "disable interrupt"); 835 "disable interrupt");
841 836
@@ -858,10 +853,11 @@ static int receive_data(enum port_type index, struct nozomi *dc)
858 tty_insert_flip_char(&port->port, buf[0], TTY_NORMAL); 853 tty_insert_flip_char(&port->port, buf[0], TTY_NORMAL);
859 size = 0; 854 size = 0;
860 } else if (size < RECEIVE_BUF_MAX) { 855 } else if (size < RECEIVE_BUF_MAX) {
861 size -= tty_insert_flip_string(tty, (char *) buf, size); 856 size -= tty_insert_flip_string(&port->port,
857 (char *)buf, size);
862 } else { 858 } else {
863 i = tty_insert_flip_string(tty, \ 859 i = tty_insert_flip_string(&port->port,
864 (char *) buf, RECEIVE_BUF_MAX); 860 (char *)buf, RECEIVE_BUF_MAX);
865 size -= i; 861 size -= i;
866 offset += i; 862 offset += i;
867 } 863 }
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index be6a373601b7..3c285d398f38 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -120,7 +120,7 @@ static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c)
120 120
121 if (c > 0) { 121 if (c > 0) {
122 /* Stuff the data into the input queue of the other end */ 122 /* Stuff the data into the input queue of the other end */
123 c = tty_insert_flip_string(to, buf, c); 123 c = tty_insert_flip_string(to->port, buf, c);
124 /* And shovel */ 124 /* And shovel */
125 if (c) { 125 if (c) {
126 tty_flip_buffer_push(to); 126 tty_flip_buffer_push(to);
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 7fca4022a8b2..e1257d17f5f0 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -698,7 +698,8 @@ static void pl011_dma_rx_chars(struct uart_amba_port *uap,
698 u32 pending, bool use_buf_b, 698 u32 pending, bool use_buf_b,
699 bool readfifo) 699 bool readfifo)
700{ 700{
701 struct tty_struct *tty = uap->port.state->port.tty; 701 struct tty_port *port = &uap->port.state->port;
702 struct tty_struct *tty = port->tty;
702 struct pl011_sgbuf *sgbuf = use_buf_b ? 703 struct pl011_sgbuf *sgbuf = use_buf_b ?
703 &uap->dmarx.sgbuf_b : &uap->dmarx.sgbuf_a; 704 &uap->dmarx.sgbuf_b : &uap->dmarx.sgbuf_a;
704 struct device *dev = uap->dmarx.chan->device->dev; 705 struct device *dev = uap->dmarx.chan->device->dev;
@@ -715,8 +716,7 @@ static void pl011_dma_rx_chars(struct uart_amba_port *uap,
715 * Note that tty_insert_flip_buf() tries to take as many chars 716 * Note that tty_insert_flip_buf() tries to take as many chars
716 * as it can. 717 * as it can.
717 */ 718 */
718 dma_count = tty_insert_flip_string(uap->port.state->port.tty, 719 dma_count = tty_insert_flip_string(port, sgbuf->buf, pending);
719 sgbuf->buf, pending);
720 720
721 /* Return buffer to device */ 721 /* Return buffer to device */
722 dma_sync_sg_for_device(dev, &sgbuf->sg, 1, DMA_FROM_DEVICE); 722 dma_sync_sg_for_device(dev, &sgbuf->sg, 1, DMA_FROM_DEVICE);
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 922e85aeb63a..929567038c5a 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -781,7 +781,8 @@ static void atmel_rx_from_ring(struct uart_port *port)
781static void atmel_rx_from_dma(struct uart_port *port) 781static void atmel_rx_from_dma(struct uart_port *port)
782{ 782{
783 struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); 783 struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
784 struct tty_struct *tty = port->state->port.tty; 784 struct tty_port *tport = &port->state->port;
785 struct tty_struct *tty = tport->tty;
785 struct atmel_dma_buffer *pdc; 786 struct atmel_dma_buffer *pdc;
786 int rx_idx = atmel_port->pdc_rx_idx; 787 int rx_idx = atmel_port->pdc_rx_idx;
787 unsigned int head; 788 unsigned int head;
@@ -820,7 +821,8 @@ static void atmel_rx_from_dma(struct uart_port *port)
820 */ 821 */
821 count = head - tail; 822 count = head - tail;
822 823
823 tty_insert_flip_string(tty, pdc->buf + pdc->ofs, count); 824 tty_insert_flip_string(tport, pdc->buf + pdc->ofs,
825 count);
824 826
825 dma_sync_single_for_device(port->dev, pdc->dma_addr, 827 dma_sync_single_for_device(port->dev, pdc->dma_addr,
826 pdc->dma_size, DMA_FROM_DEVICE); 828 pdc->dma_size, DMA_FROM_DEVICE);
diff --git a/drivers/tty/serial/crisv10.c b/drivers/tty/serial/crisv10.c
index d12306625458..c82601d4dc53 100644
--- a/drivers/tty/serial/crisv10.c
+++ b/drivers/tty/serial/crisv10.c
@@ -2119,7 +2119,7 @@ static void flush_to_flip_buffer(struct e100_serial *info)
2119 while ((buffer = info->first_recv_buffer) != NULL) { 2119 while ((buffer = info->first_recv_buffer) != NULL) {
2120 unsigned int count = buffer->length; 2120 unsigned int count = buffer->length;
2121 2121
2122 tty_insert_flip_string(tty, buffer->buffer, count); 2122 tty_insert_flip_string(&info->port, buffer->buffer, count);
2123 info->recv_cnt -= count; 2123 info->recv_cnt -= count;
2124 2124
2125 if (count == buffer->length) { 2125 if (count == buffer->length) {
diff --git a/drivers/tty/serial/icom.c b/drivers/tty/serial/icom.c
index 2b0b60ff7f01..54903ee5e5ab 100644
--- a/drivers/tty/serial/icom.c
+++ b/drivers/tty/serial/icom.c
@@ -762,7 +762,7 @@ static void recv_interrupt(u16 port_int_reg, struct icom_port *icom_port)
762 /* Block copy all but the last byte as this may have status */ 762 /* Block copy all but the last byte as this may have status */
763 if (count > 0) { 763 if (count > 0) {
764 first = icom_port->recv_buf[offset]; 764 first = icom_port->recv_buf[offset];
765 tty_insert_flip_string(tty, icom_port->recv_buf + offset, count - 1); 765 tty_insert_flip_string(port, icom_port->recv_buf + offset, count - 1);
766 } 766 }
767 767
768 icount = &icom_port->uart_port.icount; 768 icount = &icom_port->uart_port.icount;
diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index 675d94ab0aff..bfb634ea8145 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -672,7 +672,7 @@ static void ifx_spi_insert_flip_string(struct ifx_spi_device *ifx_dev,
672 struct tty_struct *tty = tty_port_tty_get(&ifx_dev->tty_port); 672 struct tty_struct *tty = tty_port_tty_get(&ifx_dev->tty_port);
673 if (!tty) 673 if (!tty)
674 return; 674 return;
675 tty_insert_flip_string(tty, chars, size); 675 tty_insert_flip_string(&ifx_dev->tty_port, chars, size);
676 tty_flip_buffer_push(tty); 676 tty_flip_buffer_push(tty);
677 tty_kref_put(tty); 677 tty_kref_put(tty);
678} 678}
diff --git a/drivers/tty/serial/ioc3_serial.c b/drivers/tty/serial/ioc3_serial.c
index d8f1d1d54471..0f25ce49c7f9 100644
--- a/drivers/tty/serial/ioc3_serial.c
+++ b/drivers/tty/serial/ioc3_serial.c
@@ -1415,7 +1415,8 @@ static int receive_chars(struct uart_port *the_port)
1415 read_count = do_read(the_port, ch, MAX_CHARS); 1415 read_count = do_read(the_port, ch, MAX_CHARS);
1416 if (read_count > 0) { 1416 if (read_count > 0) {
1417 flip = 1; 1417 flip = 1;
1418 read_room = tty_insert_flip_string(tty, ch, read_count); 1418 read_room = tty_insert_flip_string(&state->port, ch,
1419 read_count);
1419 the_port->icount.rx += read_count; 1420 the_port->icount.rx += read_count;
1420 } 1421 }
1421 spin_unlock_irqrestore(&the_port->lock, pflags); 1422 spin_unlock_irqrestore(&the_port->lock, pflags);
diff --git a/drivers/tty/serial/ioc4_serial.c b/drivers/tty/serial/ioc4_serial.c
index 710ce87ffbeb..3b021b03ae56 100644
--- a/drivers/tty/serial/ioc4_serial.c
+++ b/drivers/tty/serial/ioc4_serial.c
@@ -2362,7 +2362,7 @@ static void receive_chars(struct uart_port *the_port)
2362 icount = &the_port->icount; 2362 icount = &the_port->icount;
2363 read_count = do_read(the_port, ch, request_count); 2363 read_count = do_read(the_port, ch, request_count);
2364 if (read_count > 0) { 2364 if (read_count > 0) {
2365 tty_insert_flip_string(tty, ch, read_count); 2365 tty_insert_flip_string(&state->port, ch, read_count);
2366 icount->rx += read_count; 2366 icount->rx += read_count;
2367 } 2367 }
2368 } 2368 }
diff --git a/drivers/tty/serial/jsm/jsm_tty.c b/drivers/tty/serial/jsm/jsm_tty.c
index ac1d36cb2032..c9ce00dd1f8a 100644
--- a/drivers/tty/serial/jsm/jsm_tty.c
+++ b/drivers/tty/serial/jsm/jsm_tty.c
@@ -640,7 +640,7 @@ void jsm_input(struct jsm_channel *ch)
640 tty_insert_flip_char(port, *(ch->ch_rqueue +tail +i), TTY_NORMAL); 640 tty_insert_flip_char(port, *(ch->ch_rqueue +tail +i), TTY_NORMAL);
641 } 641 }
642 } else { 642 } else {
643 tty_insert_flip_string(tp, ch->ch_rqueue + tail, s) ; 643 tty_insert_flip_string(port, ch->ch_rqueue + tail, s);
644 } 644 }
645 tail += s; 645 tail += s;
646 n -= s; 646 n -= s;
diff --git a/drivers/tty/serial/mfd.c b/drivers/tty/serial/mfd.c
index 2c01344dc332..60d585ab4870 100644
--- a/drivers/tty/serial/mfd.c
+++ b/drivers/tty/serial/mfd.c
@@ -387,7 +387,8 @@ void hsu_dma_rx(struct uart_hsu_port *up, u32 int_sts)
387 struct hsu_dma_buffer *dbuf = &up->rxbuf; 387 struct hsu_dma_buffer *dbuf = &up->rxbuf;
388 struct hsu_dma_chan *chan = up->rxc; 388 struct hsu_dma_chan *chan = up->rxc;
389 struct uart_port *port = &up->port; 389 struct uart_port *port = &up->port;
390 struct tty_struct *tty = port->state->port.tty; 390 struct tty_port *tport = &port->state->port;
391 struct tty_struct *tty = tport->tty;
391 int count; 392 int count;
392 393
393 if (!tty) 394 if (!tty)
@@ -423,7 +424,7 @@ void hsu_dma_rx(struct uart_hsu_port *up, u32 int_sts)
423 * explicitly set tail to 0. So head will 424 * explicitly set tail to 0. So head will
424 * always be greater than tail. 425 * always be greater than tail.
425 */ 426 */
426 tty_insert_flip_string(tty, dbuf->buf, count); 427 tty_insert_flip_string(tport, dbuf->buf, count);
427 port->icount.rx += count; 428 port->icount.rx += count;
428 429
429 dma_sync_single_for_device(up->port.dev, dbuf->dma_addr, 430 dma_sync_single_for_device(up->port.dev, dbuf->dma_addr,
diff --git a/drivers/tty/serial/mrst_max3110.c b/drivers/tty/serial/mrst_max3110.c
index 776431ff0190..3b8df7b93b73 100644
--- a/drivers/tty/serial/mrst_max3110.c
+++ b/drivers/tty/serial/mrst_max3110.c
@@ -374,7 +374,7 @@ receive_chars(struct uart_max3110 *max, unsigned short *str, int len)
374 for (r = 0; w; r += usable, w -= usable) { 374 for (r = 0; w; r += usable, w -= usable) {
375 usable = tty_buffer_request_room(tport, w); 375 usable = tty_buffer_request_room(tport, w);
376 if (usable) { 376 if (usable) {
377 tty_insert_flip_string(tty, buf + r, usable); 377 tty_insert_flip_string(tport, buf + r, usable);
378 port->icount.rx += usable; 378 port->icount.rx += usable;
379 } 379 }
380 } 380 }
diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
index e4eb81a12793..cb787c0e279a 100644
--- a/drivers/tty/serial/msm_serial.c
+++ b/drivers/tty/serial/msm_serial.c
@@ -133,7 +133,7 @@ static void handle_rx_dm(struct uart_port *port, unsigned int misr)
133 port->icount.frame++; 133 port->icount.frame++;
134 134
135 /* TODO: handle sysrq */ 135 /* TODO: handle sysrq */
136 tty_insert_flip_string(tty, (char *) &c, 136 tty_insert_flip_string(tport, (char *)&c,
137 (count > 4) ? 4 : count); 137 (count > 4) ? 4 : count);
138 count -= 4; 138 count -= 4;
139 } 139 }
diff --git a/drivers/tty/serial/msm_serial_hs.c b/drivers/tty/serial/msm_serial_hs.c
index 6aa9d470ef54..11b7f5b2eb5f 100644
--- a/drivers/tty/serial/msm_serial_hs.c
+++ b/drivers/tty/serial/msm_serial_hs.c
@@ -961,7 +961,7 @@ static void msm_hs_dmov_rx_callback(struct msm_dmov_cmd *cmd_ptr,
961 rx_count = msm_hs_read(uport, UARTDM_RX_TOTAL_SNAP_ADDR); 961 rx_count = msm_hs_read(uport, UARTDM_RX_TOTAL_SNAP_ADDR);
962 962
963 if (0 != (uport->read_status_mask & CREAD)) { 963 if (0 != (uport->read_status_mask & CREAD)) {
964 retval = tty_insert_flip_string(tty, msm_uport->rx.buffer, 964 retval = tty_insert_flip_string(port, msm_uport->rx.buffer,
965 rx_count); 965 rx_count);
966 BUG_ON(retval != rx_count); 966 BUG_ON(retval != rx_count);
967 } 967 }
diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
index fa31bc38b105..37a0046ef531 100644
--- a/drivers/tty/serial/mxs-auart.c
+++ b/drivers/tty/serial/mxs-auart.c
@@ -457,7 +457,8 @@ static int mxs_auart_dma_prep_rx(struct mxs_auart_port *s);
457static void dma_rx_callback(void *arg) 457static void dma_rx_callback(void *arg)
458{ 458{
459 struct mxs_auart_port *s = (struct mxs_auart_port *) arg; 459 struct mxs_auart_port *s = (struct mxs_auart_port *) arg;
460 struct tty_struct *tty = s->port.state->port.tty; 460 struct tty_port *port = &s->port.state->port;
461 struct tty_struct *tty = port->tty;
461 int count; 462 int count;
462 u32 stat; 463 u32 stat;
463 464
@@ -468,7 +469,7 @@ static void dma_rx_callback(void *arg)
468 AUART_STAT_PERR | AUART_STAT_FERR); 469 AUART_STAT_PERR | AUART_STAT_FERR);
469 470
470 count = stat & AUART_STAT_RXCOUNT_MASK; 471 count = stat & AUART_STAT_RXCOUNT_MASK;
471 tty_insert_flip_string(tty, s->rx_dma_buf, count); 472 tty_insert_flip_string(port, s->rx_dma_buf, count);
472 473
473 writel(stat, s->port.membase + AUART_STAT); 474 writel(stat, s->port.membase + AUART_STAT);
474 tty_flip_buffer_push(tty); 475 tty_flip_buffer_push(tty);
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index 4f1774be2a8c..967f1cb311f3 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -591,17 +591,17 @@ static void pch_uart_hal_set_break(struct eg20t_port *priv, int on)
591static int push_rx(struct eg20t_port *priv, const unsigned char *buf, 591static int push_rx(struct eg20t_port *priv, const unsigned char *buf,
592 int size) 592 int size)
593{ 593{
594 struct uart_port *port; 594 struct uart_port *port = &priv->port;
595 struct tty_port *tport = &port->state->port;
595 struct tty_struct *tty; 596 struct tty_struct *tty;
596 597
597 port = &priv->port; 598 tty = tty_port_tty_get(tport);
598 tty = tty_port_tty_get(&port->state->port);
599 if (!tty) { 599 if (!tty) {
600 dev_dbg(priv->port.dev, "%s:tty is busy now", __func__); 600 dev_dbg(priv->port.dev, "%s:tty is busy now", __func__);
601 return -EBUSY; 601 return -EBUSY;
602 } 602 }
603 603
604 tty_insert_flip_string(tty, buf, size); 604 tty_insert_flip_string(tport, buf, size);
605 tty_flip_buffer_push(tty); 605 tty_flip_buffer_push(tty);
606 tty_kref_put(tty); 606 tty_kref_put(tty);
607 607
@@ -646,7 +646,7 @@ static int dma_push_rx(struct eg20t_port *priv, int size)
646 if (!room) 646 if (!room)
647 return room; 647 return room;
648 648
649 tty_insert_flip_string(tty, sg_virt(&priv->sg_rx), size); 649 tty_insert_flip_string(tport, sg_virt(&priv->sg_rx), size);
650 650
651 port->icount.rx += room; 651 port->icount.rx += room;
652 tty_kref_put(tty); 652 tty_kref_put(tty);
diff --git a/drivers/tty/serial/sunhv.c b/drivers/tty/serial/sunhv.c
index bbb102e3c035..defe92b19e16 100644
--- a/drivers/tty/serial/sunhv.c
+++ b/drivers/tty/serial/sunhv.c
@@ -72,7 +72,7 @@ static void transmit_chars_write(struct uart_port *port, struct circ_buf *xmit)
72 } 72 }
73} 73}
74 74
75static int receive_chars_getchar(struct uart_port *port, struct tty_struct *tty) 75static int receive_chars_getchar(struct uart_port *port)
76{ 76{
77 int saw_console_brk = 0; 77 int saw_console_brk = 0;
78 int limit = 10000; 78 int limit = 10000;
@@ -115,7 +115,7 @@ static int receive_chars_getchar(struct uart_port *port, struct tty_struct *tty)
115 return saw_console_brk; 115 return saw_console_brk;
116} 116}
117 117
118static int receive_chars_read(struct uart_port *port, struct tty_struct *tty) 118static int receive_chars_read(struct uart_port *port)
119{ 119{
120 int saw_console_brk = 0; 120 int saw_console_brk = 0;
121 int limit = 10000; 121 int limit = 10000;
@@ -152,12 +152,13 @@ static int receive_chars_read(struct uart_port *port, struct tty_struct *tty)
152 for (i = 0; i < bytes_read; i++) 152 for (i = 0; i < bytes_read; i++)
153 uart_handle_sysrq_char(port, con_read_page[i]); 153 uart_handle_sysrq_char(port, con_read_page[i]);
154 154
155 if (tty == NULL) 155 if (port->state == NULL)
156 continue; 156 continue;
157 157
158 port->icount.rx += bytes_read; 158 port->icount.rx += bytes_read;
159 159
160 tty_insert_flip_string(tty, con_read_page, bytes_read); 160 tty_insert_flip_string(&port->state->port, con_read_page,
161 bytes_read);
161 } 162 }
162 163
163 return saw_console_brk; 164 return saw_console_brk;
@@ -165,7 +166,7 @@ static int receive_chars_read(struct uart_port *port, struct tty_struct *tty)
165 166
166struct sunhv_ops { 167struct sunhv_ops {
167 void (*transmit_chars)(struct uart_port *port, struct circ_buf *xmit); 168 void (*transmit_chars)(struct uart_port *port, struct circ_buf *xmit);
168 int (*receive_chars)(struct uart_port *port, struct tty_struct *tty); 169 int (*receive_chars)(struct uart_port *port);
169}; 170};
170 171
171static struct sunhv_ops bychar_ops = { 172static struct sunhv_ops bychar_ops = {
@@ -187,7 +188,7 @@ static struct tty_struct *receive_chars(struct uart_port *port)
187 if (port->state != NULL) /* Unopened serial console */ 188 if (port->state != NULL) /* Unopened serial console */
188 tty = port->state->port.tty; 189 tty = port->state->port.tty;
189 190
190 if (sunhv_ops->receive_chars(port, tty)) 191 if (sunhv_ops->receive_chars(port))
191 sun_do_break(); 192 sun_do_break();
192 193
193 return tty; 194 return tty;
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 8d809a811e16..20dc2add27ba 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -419,7 +419,8 @@ static void acm_process_read_urb(struct acm *acm, struct urb *urb)
419 if (!tty) 419 if (!tty)
420 return; 420 return;
421 421
422 tty_insert_flip_string(tty, urb->transfer_buffer, urb->actual_length); 422 tty_insert_flip_string(&acm->port, urb->transfer_buffer,
423 urb->actual_length);
423 tty_flip_buffer_push(tty); 424 tty_flip_buffer_push(tty);
424 425
425 tty_kref_put(tty); 426 tty_kref_put(tty);
diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c
index d0f95482f40e..3560799d530a 100644
--- a/drivers/usb/gadget/u_serial.c
+++ b/drivers/usb/gadget/u_serial.c
@@ -495,12 +495,8 @@ static void gs_rx_push(unsigned long _port)
495 495
496 req = list_first_entry(queue, struct usb_request, list); 496 req = list_first_entry(queue, struct usb_request, list);
497 497
498 /* discard data if tty was closed */
499 if (!tty)
500 goto recycle;
501
502 /* leave data queued if tty was rx throttled */ 498 /* leave data queued if tty was rx throttled */
503 if (test_bit(TTY_THROTTLED, &tty->flags)) 499 if (tty && test_bit(TTY_THROTTLED, &tty->flags))
504 break; 500 break;
505 501
506 switch (req->status) { 502 switch (req->status) {
@@ -533,7 +529,8 @@ static void gs_rx_push(unsigned long _port)
533 size -= n; 529 size -= n;
534 } 530 }
535 531
536 count = tty_insert_flip_string(tty, packet, size); 532 count = tty_insert_flip_string(&port->port, packet,
533 size);
537 if (count) 534 if (count)
538 do_push = true; 535 do_push = true;
539 if (count != size) { 536 if (count != size) {
@@ -546,7 +543,7 @@ static void gs_rx_push(unsigned long _port)
546 } 543 }
547 port->n_read = 0; 544 port->n_read = 0;
548 } 545 }
549recycle: 546
550 list_move(&req->list, &port->read_pool); 547 list_move(&req->list, &port->read_pool);
551 port->read_started--; 548 port->read_started--;
552 } 549 }
diff --git a/drivers/usb/serial/aircable.c b/drivers/usb/serial/aircable.c
index 6d110a3bc7e7..3bb1f8f11fc8 100644
--- a/drivers/usb/serial/aircable.c
+++ b/drivers/usb/serial/aircable.c
@@ -119,9 +119,8 @@ static int aircable_probe(struct usb_serial *serial,
119 return 0; 119 return 0;
120} 120}
121 121
122static int aircable_process_packet(struct tty_struct *tty, 122static int aircable_process_packet(struct usb_serial_port *port,
123 struct usb_serial_port *port, int has_headers, 123 int has_headers, char *packet, int len)
124 char *packet, int len)
125{ 124{
126 if (has_headers) { 125 if (has_headers) {
127 len -= HCI_HEADER_LENGTH; 126 len -= HCI_HEADER_LENGTH;
@@ -132,7 +131,7 @@ static int aircable_process_packet(struct tty_struct *tty,
132 return 0; 131 return 0;
133 } 132 }
134 133
135 tty_insert_flip_string(tty, packet, len); 134 tty_insert_flip_string(&port->port, packet, len);
136 135
137 return len; 136 return len;
138} 137}
@@ -156,7 +155,7 @@ static void aircable_process_read_urb(struct urb *urb)
156 count = 0; 155 count = 0;
157 for (i = 0; i < urb->actual_length; i += HCI_COMPLETE_FRAME) { 156 for (i = 0; i < urb->actual_length; i += HCI_COMPLETE_FRAME) {
158 len = min_t(int, urb->actual_length - i, HCI_COMPLETE_FRAME); 157 len = min_t(int, urb->actual_length - i, HCI_COMPLETE_FRAME);
159 count += aircable_process_packet(tty, port, has_headers, 158 count += aircable_process_packet(port, has_headers,
160 &data[i], len); 159 &data[i], len);
161 } 160 }
162 161
diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c
index 69a4fa1cee25..e6976a974472 100644
--- a/drivers/usb/serial/cyberjack.c
+++ b/drivers/usb/serial/cyberjack.c
@@ -343,7 +343,7 @@ static void cyberjack_read_bulk_callback(struct urb *urb)
343 return; 343 return;
344 } 344 }
345 if (urb->actual_length) { 345 if (urb->actual_length) {
346 tty_insert_flip_string(tty, data, urb->actual_length); 346 tty_insert_flip_string(&port->port, data, urb->actual_length);
347 tty_flip_buffer_push(tty); 347 tty_flip_buffer_push(tty);
348 } 348 }
349 tty_kref_put(tty); 349 tty_kref_put(tty);
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c
index 203358d7e7bc..498b5f0da639 100644
--- a/drivers/usb/serial/garmin_gps.c
+++ b/drivers/usb/serial/garmin_gps.c
@@ -256,7 +256,7 @@ static void send_to_tty(struct usb_serial_port *port,
256 256
257 if (tty && actual_length) { 257 if (tty && actual_length) {
258 usb_serial_debug_data(&port->dev, __func__, actual_length, data); 258 usb_serial_debug_data(&port->dev, __func__, actual_length, data);
259 tty_insert_flip_string(tty, data, actual_length); 259 tty_insert_flip_string(&port->port, data, actual_length);
260 tty_flip_buffer_push(tty); 260 tty_flip_buffer_push(tty);
261 } 261 }
262 tty_kref_put(tty); 262 tty_kref_put(tty);
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index b00110cd5689..3780f6a501b3 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -328,7 +328,7 @@ void usb_serial_generic_process_read_urb(struct urb *urb)
328 stuff like 3G modems, so shortcircuit it in the 99.9999999% of cases 328 stuff like 3G modems, so shortcircuit it in the 99.9999999% of cases
329 where the USB serial is not a console anyway */ 329 where the USB serial is not a console anyway */
330 if (!port->port.console || !port->sysrq) 330 if (!port->port.console || !port->sysrq)
331 tty_insert_flip_string(tty, ch, urb->actual_length); 331 tty_insert_flip_string(&port->port, ch, urb->actual_length);
332 else { 332 else {
333 for (i = 0; i < urb->actual_length; i++, ch++) { 333 for (i = 0; i < urb->actual_length; i++, ch++) {
334 if (!usb_serial_handle_sysrq_char(port, *ch)) 334 if (!usb_serial_handle_sysrq_char(port, *ch))
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index 7b770c7f8b11..f96b91da964f 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -232,7 +232,7 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial,
232 unsigned char *buffer, __u16 bufferLength); 232 unsigned char *buffer, __u16 bufferLength);
233static void process_rcvd_status(struct edgeport_serial *edge_serial, 233static void process_rcvd_status(struct edgeport_serial *edge_serial,
234 __u8 byte2, __u8 byte3); 234 __u8 byte2, __u8 byte3);
235static void edge_tty_recv(struct device *dev, struct tty_struct *tty, 235static void edge_tty_recv(struct usb_serial_port *port, struct tty_struct *tty,
236 unsigned char *data, int length); 236 unsigned char *data, int length);
237static void handle_new_msr(struct edgeport_port *edge_port, __u8 newMsr); 237static void handle_new_msr(struct edgeport_port *edge_port, __u8 newMsr);
238static void handle_new_lsr(struct edgeport_port *edge_port, __u8 lsrData, 238static void handle_new_lsr(struct edgeport_port *edge_port, __u8 lsrData,
@@ -1865,7 +1865,7 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial,
1865 if (tty) { 1865 if (tty) {
1866 dev_dbg(dev, "%s - Sending %d bytes to TTY for port %d\n", 1866 dev_dbg(dev, "%s - Sending %d bytes to TTY for port %d\n",
1867 __func__, rxLen, edge_serial->rxPort); 1867 __func__, rxLen, edge_serial->rxPort);
1868 edge_tty_recv(&edge_serial->serial->dev->dev, tty, buffer, rxLen); 1868 edge_tty_recv(edge_port->port, tty, buffer, rxLen);
1869 tty_kref_put(tty); 1869 tty_kref_put(tty);
1870 } 1870 }
1871 edge_port->icount.rx += rxLen; 1871 edge_port->icount.rx += rxLen;
@@ -2017,14 +2017,14 @@ static void process_rcvd_status(struct edgeport_serial *edge_serial,
2017 * edge_tty_recv 2017 * edge_tty_recv
2018 * this function passes data on to the tty flip buffer 2018 * this function passes data on to the tty flip buffer
2019 *****************************************************************************/ 2019 *****************************************************************************/
2020static void edge_tty_recv(struct device *dev, struct tty_struct *tty, 2020static void edge_tty_recv(struct usb_serial_port *port, struct tty_struct *tty,
2021 unsigned char *data, int length) 2021 unsigned char *data, int length)
2022{ 2022{
2023 int cnt; 2023 int cnt;
2024 2024
2025 cnt = tty_insert_flip_string(tty, data, length); 2025 cnt = tty_insert_flip_string(&port->port, data, length);
2026 if (cnt < length) { 2026 if (cnt < length) {
2027 dev_err(dev, "%s - dropping data, %d bytes lost\n", 2027 dev_err(&port->dev, "%s - dropping data, %d bytes lost\n",
2028 __func__, length - cnt); 2028 __func__, length - cnt);
2029 } 2029 }
2030 data += cnt; 2030 data += cnt;
@@ -2090,7 +2090,7 @@ static void handle_new_lsr(struct edgeport_port *edge_port, __u8 lsrData,
2090 struct tty_struct *tty = 2090 struct tty_struct *tty =
2091 tty_port_tty_get(&edge_port->port->port); 2091 tty_port_tty_get(&edge_port->port->port);
2092 if (tty) { 2092 if (tty) {
2093 edge_tty_recv(&edge_port->port->dev, tty, &data, 1); 2093 edge_tty_recv(edge_port->port, tty, &data, 1);
2094 tty_kref_put(tty); 2094 tty_kref_put(tty);
2095 } 2095 }
2096 } 2096 }
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index 58184f3de686..1286a0b2e2b7 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -201,7 +201,7 @@ static int closing_wait = EDGE_CLOSING_WAIT;
201static bool ignore_cpu_rev; 201static bool ignore_cpu_rev;
202static int default_uart_mode; /* RS232 */ 202static int default_uart_mode; /* RS232 */
203 203
204static void edge_tty_recv(struct device *dev, struct tty_struct *tty, 204static void edge_tty_recv(struct usb_serial_port *port, struct tty_struct *tty,
205 unsigned char *data, int length); 205 unsigned char *data, int length);
206 206
207static void stop_read(struct edgeport_port *edge_port); 207static void stop_read(struct edgeport_port *edge_port);
@@ -1557,7 +1557,7 @@ static void handle_new_lsr(struct edgeport_port *edge_port, int lsr_data,
1557 if (lsr_data) { 1557 if (lsr_data) {
1558 tty = tty_port_tty_get(&edge_port->port->port); 1558 tty = tty_port_tty_get(&edge_port->port->port);
1559 if (tty) { 1559 if (tty) {
1560 edge_tty_recv(&edge_port->port->dev, tty, &data, 1); 1560 edge_tty_recv(edge_port->port, tty, &data, 1);
1561 tty_kref_put(tty); 1561 tty_kref_put(tty);
1562 } 1562 }
1563 } 1563 }
@@ -1722,7 +1722,8 @@ static void edge_bulk_in_callback(struct urb *urb)
1722 dev_dbg(dev, "%s - close pending, dropping data on the floor\n", 1722 dev_dbg(dev, "%s - close pending, dropping data on the floor\n",
1723 __func__); 1723 __func__);
1724 else 1724 else
1725 edge_tty_recv(dev, tty, data, urb->actual_length); 1725 edge_tty_recv(edge_port->port, tty, data,
1726 urb->actual_length);
1726 edge_port->icount.rx += urb->actual_length; 1727 edge_port->icount.rx += urb->actual_length;
1727 } 1728 }
1728 tty_kref_put(tty); 1729 tty_kref_put(tty);
@@ -1740,14 +1741,14 @@ exit:
1740 dev_err(dev, "%s - usb_submit_urb failed with result %d\n", __func__, retval); 1741 dev_err(dev, "%s - usb_submit_urb failed with result %d\n", __func__, retval);
1741} 1742}
1742 1743
1743static void edge_tty_recv(struct device *dev, struct tty_struct *tty, 1744static void edge_tty_recv(struct usb_serial_port *port, struct tty_struct *tty,
1744 unsigned char *data, int length) 1745 unsigned char *data, int length)
1745{ 1746{
1746 int queued; 1747 int queued;
1747 1748
1748 queued = tty_insert_flip_string(tty, data, length); 1749 queued = tty_insert_flip_string(&port->port, data, length);
1749 if (queued < length) 1750 if (queued < length)
1750 dev_err(dev, "%s - dropping data, %d bytes lost\n", 1751 dev_err(&port->dev, "%s - dropping data, %d bytes lost\n",
1751 __func__, length - queued); 1752 __func__, length - queued);
1752 tty_flip_buffer_push(tty); 1753 tty_flip_buffer_push(tty);
1753} 1754}
diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c
index e24e2d4f4c1b..171dae1f4a62 100644
--- a/drivers/usb/serial/ir-usb.c
+++ b/drivers/usb/serial/ir-usb.c
@@ -305,7 +305,7 @@ static void ir_process_read_urb(struct urb *urb)
305 tty = tty_port_tty_get(&port->port); 305 tty = tty_port_tty_get(&port->port);
306 if (!tty) 306 if (!tty)
307 return; 307 return;
308 tty_insert_flip_string(tty, data + 1, urb->actual_length - 1); 308 tty_insert_flip_string(&port->port, data + 1, urb->actual_length - 1);
309 tty_flip_buffer_push(tty); 309 tty_flip_buffer_push(tty);
310 tty_kref_put(tty); 310 tty_kref_put(tty);
311} 311}
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c
index 1e1fbed65ef2..dd0d910730c7 100644
--- a/drivers/usb/serial/iuu_phoenix.c
+++ b/drivers/usb/serial/iuu_phoenix.c
@@ -596,7 +596,7 @@ static void read_buf_callback(struct urb *urb)
596 if (data == NULL) 596 if (data == NULL)
597 dev_dbg(&port->dev, "%s - data is NULL !!!\n", __func__); 597 dev_dbg(&port->dev, "%s - data is NULL !!!\n", __func__);
598 if (tty && urb->actual_length && data) { 598 if (tty && urb->actual_length && data) {
599 tty_insert_flip_string(tty, data, urb->actual_length); 599 tty_insert_flip_string(&port->port, data, urb->actual_length);
600 tty_flip_buffer_push(tty); 600 tty_flip_buffer_push(tty);
601 } 601 }
602 tty_kref_put(tty); 602 tty_kref_put(tty);
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index a4f5caebda43..14a219ba4ee6 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -472,7 +472,8 @@ static void usa28_indat_callback(struct urb *urb)
472 472
473 tty = tty_port_tty_get(&port->port); 473 tty = tty_port_tty_get(&port->port);
474 if (tty && urb->actual_length) { 474 if (tty && urb->actual_length) {
475 tty_insert_flip_string(tty, data, urb->actual_length); 475 tty_insert_flip_string(&port->port, data,
476 urb->actual_length);
476 tty_flip_buffer_push(tty); 477 tty_flip_buffer_push(tty);
477 } 478 }
478 tty_kref_put(tty); 479 tty_kref_put(tty);
@@ -688,7 +689,7 @@ static void usa49_indat_callback(struct urb *urb)
688 /* 0x80 bit is error flag */ 689 /* 0x80 bit is error flag */
689 if ((data[0] & 0x80) == 0) { 690 if ((data[0] & 0x80) == 0) {
690 /* no error on any byte */ 691 /* no error on any byte */
691 tty_insert_flip_string(tty, data + 1, 692 tty_insert_flip_string(&port->port, data + 1,
692 urb->actual_length - 1); 693 urb->actual_length - 1);
693 } else { 694 } else {
694 /* some bytes had errors, every byte has status */ 695 /* some bytes had errors, every byte has status */
@@ -816,7 +817,8 @@ static void usa90_indat_callback(struct urb *urb)
816 otherwise looks like usa26 data format */ 817 otherwise looks like usa26 data format */
817 818
818 if (p_priv->baud > 57600) 819 if (p_priv->baud > 57600)
819 tty_insert_flip_string(tty, data, urb->actual_length); 820 tty_insert_flip_string(&port->port, data,
821 urb->actual_length);
820 else { 822 else {
821 /* 0x80 bit is error flag */ 823 /* 0x80 bit is error flag */
822 if ((data[0] & 0x80) == 0) { 824 if ((data[0] & 0x80) == 0) {
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
index 41b01092af07..334b1a295c6b 100644
--- a/drivers/usb/serial/keyspan_pda.c
+++ b/drivers/usb/serial/keyspan_pda.c
@@ -166,7 +166,7 @@ static void keyspan_pda_rx_interrupt(struct urb *urb)
166 tty = tty_port_tty_get(&port->port); 166 tty = tty_port_tty_get(&port->port);
167 /* rest of message is rx data */ 167 /* rest of message is rx data */
168 if (tty && urb->actual_length) { 168 if (tty && urb->actual_length) {
169 tty_insert_flip_string(tty, data + 1, 169 tty_insert_flip_string(&port->port, data + 1,
170 urb->actual_length - 1); 170 urb->actual_length - 1);
171 tty_flip_buffer_push(tty); 171 tty_flip_buffer_push(tty);
172 } 172 }
diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c
index fc9e14a1e9b3..8ee0825ad700 100644
--- a/drivers/usb/serial/kl5kusb105.c
+++ b/drivers/usb/serial/kl5kusb105.c
@@ -411,7 +411,7 @@ static void klsi_105_process_read_urb(struct urb *urb)
411 len = urb->actual_length - KLSI_HDR_LEN; 411 len = urb->actual_length - KLSI_HDR_LEN;
412 } 412 }
413 413
414 tty_insert_flip_string(tty, data + KLSI_HDR_LEN, len); 414 tty_insert_flip_string(&port->port, data + KLSI_HDR_LEN, len);
415 tty_flip_buffer_push(tty); 415 tty_flip_buffer_push(tty);
416 tty_kref_put(tty); 416 tty_kref_put(tty);
417} 417}
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c
index b747ba615d0b..135c8b4b26f7 100644
--- a/drivers/usb/serial/kobil_sct.c
+++ b/drivers/usb/serial/kobil_sct.c
@@ -353,7 +353,7 @@ static void kobil_read_int_callback(struct urb *urb)
353 */ 353 */
354 /* END DEBUG */ 354 /* END DEBUG */
355 355
356 tty_insert_flip_string(tty, data, urb->actual_length); 356 tty_insert_flip_string(&port->port, data, urb->actual_length);
357 tty_flip_buffer_push(tty); 357 tty_flip_buffer_push(tty);
358 } 358 }
359 tty_kref_put(tty); 359 tty_kref_put(tty);
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
index b6911757c855..ba20bb037b28 100644
--- a/drivers/usb/serial/mct_u232.c
+++ b/drivers/usb/serial/mct_u232.c
@@ -563,7 +563,7 @@ static void mct_u232_read_int_callback(struct urb *urb)
563 if (urb->actual_length) { 563 if (urb->actual_length) {
564 tty = tty_port_tty_get(&port->port); 564 tty = tty_port_tty_get(&port->port);
565 if (tty) { 565 if (tty) {
566 tty_insert_flip_string(tty, data, 566 tty_insert_flip_string(&port->port, data,
567 urb->actual_length); 567 urb->actual_length);
568 tty_flip_buffer_push(tty); 568 tty_flip_buffer_push(tty);
569 } 569 }
diff --git a/drivers/usb/serial/metro-usb.c b/drivers/usb/serial/metro-usb.c
index 3d258448c29a..6264f3974ea7 100644
--- a/drivers/usb/serial/metro-usb.c
+++ b/drivers/usb/serial/metro-usb.c
@@ -127,7 +127,7 @@ static void metrousb_read_int_callback(struct urb *urb)
127 tty = tty_port_tty_get(&port->port); 127 tty = tty_port_tty_get(&port->port);
128 if (tty && urb->actual_length) { 128 if (tty && urb->actual_length) {
129 /* Loop through the data copying each byte to the tty layer. */ 129 /* Loop through the data copying each byte to the tty layer. */
130 tty_insert_flip_string(tty, data, urb->actual_length); 130 tty_insert_flip_string(&port->port, data, urb->actual_length);
131 131
132 /* Force the data to the tty layer. */ 132 /* Force the data to the tty layer. */
133 tty_flip_buffer_push(tty); 133 tty_flip_buffer_push(tty);
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index f57a6b1fe787..22818fb765e0 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -915,7 +915,7 @@ static void mos7720_bulk_in_callback(struct urb *urb)
915 915
916 tty = tty_port_tty_get(&port->port); 916 tty = tty_port_tty_get(&port->port);
917 if (tty && urb->actual_length) { 917 if (tty && urb->actual_length) {
918 tty_insert_flip_string(tty, data, urb->actual_length); 918 tty_insert_flip_string(&port->port, data, urb->actual_length);
919 tty_flip_buffer_push(tty); 919 tty_flip_buffer_push(tty);
920 } 920 }
921 tty_kref_put(tty); 921 tty_kref_put(tty);
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 66d9e088d9d9..3ddd7a1f7ff3 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -773,9 +773,10 @@ static void mos7840_bulk_in_callback(struct urb *urb)
773 usb_serial_debug_data(&port->dev, __func__, urb->actual_length, data); 773 usb_serial_debug_data(&port->dev, __func__, urb->actual_length, data);
774 774
775 if (urb->actual_length) { 775 if (urb->actual_length) {
776 tty = tty_port_tty_get(&mos7840_port->port->port); 776 struct tty_port *tport = &mos7840_port->port->port;
777 tty = tty_port_tty_get(tport);
777 if (tty) { 778 if (tty) {
778 tty_insert_flip_string(tty, data, urb->actual_length); 779 tty_insert_flip_string(tport, data, urb->actual_length);
779 tty_flip_buffer_push(tty); 780 tty_flip_buffer_push(tty);
780 tty_kref_put(tty); 781 tty_kref_put(tty);
781 } 782 }
diff --git a/drivers/usb/serial/navman.c b/drivers/usb/serial/navman.c
index 1566f8f500ae..0d96a1a7b9e5 100644
--- a/drivers/usb/serial/navman.c
+++ b/drivers/usb/serial/navman.c
@@ -57,7 +57,7 @@ static void navman_read_int_callback(struct urb *urb)
57 57
58 tty = tty_port_tty_get(&port->port); 58 tty = tty_port_tty_get(&port->port);
59 if (tty && urb->actual_length) { 59 if (tty && urb->actual_length) {
60 tty_insert_flip_string(tty, data, urb->actual_length); 60 tty_insert_flip_string(&port->port, data, urb->actual_length);
61 tty_flip_buffer_push(tty); 61 tty_flip_buffer_push(tty);
62 } 62 }
63 tty_kref_put(tty); 63 tty_kref_put(tty);
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c
index 7818af931a48..338191bae5a3 100644
--- a/drivers/usb/serial/omninet.c
+++ b/drivers/usb/serial/omninet.c
@@ -176,8 +176,9 @@ static void omninet_read_bulk_callback(struct urb *urb)
176 if (urb->actual_length && header->oh_len) { 176 if (urb->actual_length && header->oh_len) {
177 struct tty_struct *tty = tty_port_tty_get(&port->port); 177 struct tty_struct *tty = tty_port_tty_get(&port->port);
178 if (tty) { 178 if (tty) {
179 tty_insert_flip_string(tty, data + OMNINET_DATAOFFSET, 179 tty_insert_flip_string(&port->port,
180 header->oh_len); 180 data + OMNINET_DATAOFFSET,
181 header->oh_len);
181 tty_flip_buffer_push(tty); 182 tty_flip_buffer_push(tty);
182 tty_kref_put(tty); 183 tty_kref_put(tty);
183 } 184 }
diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c
index c6bfb83efb1e..d3b74e50aff1 100644
--- a/drivers/usb/serial/opticon.c
+++ b/drivers/usb/serial/opticon.c
@@ -57,7 +57,7 @@ static void opticon_process_data_packet(struct usb_serial_port *port,
57 if (!tty) 57 if (!tty)
58 return; 58 return;
59 59
60 tty_insert_flip_string(tty, buf, len); 60 tty_insert_flip_string(&port->port, buf, len);
61 tty_flip_buffer_push(tty); 61 tty_flip_buffer_push(tty);
62 tty_kref_put(tty); 62 tty_kref_put(tty);
63} 63}
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c
index d217fd6ee43f..7a53fe9f3af3 100644
--- a/drivers/usb/serial/oti6858.c
+++ b/drivers/usb/serial/oti6858.c
@@ -837,7 +837,7 @@ static void oti6858_read_bulk_callback(struct urb *urb)
837 837
838 tty = tty_port_tty_get(&port->port); 838 tty = tty_port_tty_get(&port->port);
839 if (tty != NULL && urb->actual_length > 0) { 839 if (tty != NULL && urb->actual_length > 0) {
840 tty_insert_flip_string(tty, data, urb->actual_length); 840 tty_insert_flip_string(&port->port, data, urb->actual_length);
841 tty_flip_buffer_push(tty); 841 tty_flip_buffer_push(tty);
842 } 842 }
843 tty_kref_put(tty); 843 tty_kref_put(tty);
diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c
index 1e67fd89e346..5dccc4f957df 100644
--- a/drivers/usb/serial/quatech2.c
+++ b/drivers/usb/serial/quatech2.c
@@ -698,7 +698,7 @@ void qt2_process_read_urb(struct urb *urb)
698 break; 698 break;
699 case QT2_CONTROL_ESCAPE: 699 case QT2_CONTROL_ESCAPE:
700 tty_buffer_request_room(&port->port, 2); 700 tty_buffer_request_room(&port->port, 2);
701 tty_insert_flip_string(tty, ch, 2); 701 tty_insert_flip_string(&port->port, ch, 2);
702 i += 2; 702 i += 2;
703 escapeflag = true; 703 escapeflag = true;
704 break; 704 break;
@@ -712,10 +712,8 @@ void qt2_process_read_urb(struct urb *urb)
712 continue; 712 continue;
713 } 713 }
714 714
715 if (tty) { 715 tty_buffer_request_room(&port->port, 1);
716 tty_buffer_request_room(&port->port, 1); 716 tty_insert_flip_string(&port->port, ch, 1);
717 tty_insert_flip_string(tty, ch, 1);
718 }
719 } 717 }
720 718
721 if (tty) { 719 if (tty) {
diff --git a/drivers/usb/serial/safe_serial.c b/drivers/usb/serial/safe_serial.c
index c949ce6ef0c6..ad12e9e2c7ee 100644
--- a/drivers/usb/serial/safe_serial.c
+++ b/drivers/usb/serial/safe_serial.c
@@ -235,7 +235,7 @@ static void safe_process_read_urb(struct urb *urb)
235 dev_info(&urb->dev->dev, "%s - actual: %d\n", __func__, actual_length); 235 dev_info(&urb->dev->dev, "%s - actual: %d\n", __func__, actual_length);
236 length = actual_length; 236 length = actual_length;
237out: 237out:
238 tty_insert_flip_string(tty, data, length); 238 tty_insert_flip_string(&port->port, data, length);
239 tty_flip_buffer_push(tty); 239 tty_flip_buffer_push(tty);
240err: 240err:
241 tty_kref_put(tty); 241 tty_kref_put(tty);
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index af06f2f5f38b..64e53fda149b 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -583,7 +583,7 @@ static void sierra_indat_callback(struct urb *urb)
583 if (urb->actual_length) { 583 if (urb->actual_length) {
584 tty = tty_port_tty_get(&port->port); 584 tty = tty_port_tty_get(&port->port);
585 if (tty) { 585 if (tty) {
586 tty_insert_flip_string(tty, data, 586 tty_insert_flip_string(&port->port, data,
587 urb->actual_length); 587 urb->actual_length);
588 tty_flip_buffer_push(tty); 588 tty_flip_buffer_push(tty);
589 589
diff --git a/drivers/usb/serial/symbolserial.c b/drivers/usb/serial/symbolserial.c
index 701fffa8431f..2ffa6ae3b5ed 100644
--- a/drivers/usb/serial/symbolserial.c
+++ b/drivers/usb/serial/symbolserial.c
@@ -84,7 +84,8 @@ static void symbol_int_callback(struct urb *urb)
84 */ 84 */
85 tty = tty_port_tty_get(&port->port); 85 tty = tty_port_tty_get(&port->port);
86 if (tty) { 86 if (tty) {
87 tty_insert_flip_string(tty, &data[1], data_length); 87 tty_insert_flip_string(&port->port, &data[1],
88 data_length);
88 tty_flip_buffer_push(tty); 89 tty_flip_buffer_push(tty);
89 tty_kref_put(tty); 90 tty_kref_put(tty);
90 } 91 }
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index f2530d2ef3c4..05077e3c7631 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -121,7 +121,7 @@ static void ti_interrupt_callback(struct urb *urb);
121static void ti_bulk_in_callback(struct urb *urb); 121static void ti_bulk_in_callback(struct urb *urb);
122static void ti_bulk_out_callback(struct urb *urb); 122static void ti_bulk_out_callback(struct urb *urb);
123 123
124static void ti_recv(struct device *dev, struct tty_struct *tty, 124static void ti_recv(struct usb_serial_port *port, struct tty_struct *tty,
125 unsigned char *data, int length); 125 unsigned char *data, int length);
126static void ti_send(struct ti_port *tport); 126static void ti_send(struct ti_port *tport);
127static int ti_set_mcr(struct ti_port *tport, unsigned int mcr); 127static int ti_set_mcr(struct ti_port *tport, unsigned int mcr);
@@ -1155,8 +1155,7 @@ static void ti_bulk_in_callback(struct urb *urb)
1155 dev_dbg(dev, "%s - port closed, dropping data\n", 1155 dev_dbg(dev, "%s - port closed, dropping data\n",
1156 __func__); 1156 __func__);
1157 else 1157 else
1158 ti_recv(&urb->dev->dev, tty, 1158 ti_recv(port, tty, urb->transfer_buffer,
1159 urb->transfer_buffer,
1160 urb->actual_length); 1159 urb->actual_length);
1161 spin_lock(&tport->tp_lock); 1160 spin_lock(&tport->tp_lock);
1162 tport->tp_icount.rx += urb->actual_length; 1161 tport->tp_icount.rx += urb->actual_length;
@@ -1210,15 +1209,15 @@ static void ti_bulk_out_callback(struct urb *urb)
1210} 1209}
1211 1210
1212 1211
1213static void ti_recv(struct device *dev, struct tty_struct *tty, 1212static void ti_recv(struct usb_serial_port *port, struct tty_struct *tty,
1214 unsigned char *data, int length) 1213 unsigned char *data, int length)
1215{ 1214{
1216 int cnt; 1215 int cnt;
1217 1216
1218 do { 1217 do {
1219 cnt = tty_insert_flip_string(tty, data, length); 1218 cnt = tty_insert_flip_string(&port->port, data, length);
1220 if (cnt < length) { 1219 if (cnt < length) {
1221 dev_err(dev, "%s - dropping data, %d bytes lost\n", 1220 dev_err(&port->dev, "%s - dropping data, %d bytes lost\n",
1222 __func__, length - cnt); 1221 __func__, length - cnt);
1223 if (cnt == 0) 1222 if (cnt == 0)
1224 break; 1223 break;
diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
index 01c94aada56c..293b460030cb 100644
--- a/drivers/usb/serial/usb_wwan.c
+++ b/drivers/usb/serial/usb_wwan.c
@@ -291,7 +291,7 @@ static void usb_wwan_indat_callback(struct urb *urb)
291 tty = tty_port_tty_get(&port->port); 291 tty = tty_port_tty_get(&port->port);
292 if (tty) { 292 if (tty) {
293 if (urb->actual_length) { 293 if (urb->actual_length) {
294 tty_insert_flip_string(tty, data, 294 tty_insert_flip_string(&port->port, data,
295 urb->actual_length); 295 urb->actual_length);
296 tty_flip_buffer_push(tty); 296 tty_flip_buffer_push(tty);
297 } else 297 } else
diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h
index f9acb578c6ad..5cb694aba322 100644
--- a/include/linux/tty_flip.h
+++ b/include/linux/tty_flip.h
@@ -24,9 +24,10 @@ static inline int tty_insert_flip_char(struct tty_port *port,
24 return tty_insert_flip_string_flags(port, &ch, &flag, 1); 24 return tty_insert_flip_string_flags(port, &ch, &flag, 1);
25} 25}
26 26
27static inline int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars, size_t size) 27static inline int tty_insert_flip_string(struct tty_port *port,
28 const unsigned char *chars, size_t size)
28{ 29{
29 return tty_insert_flip_string_fixed_flag(tty->port, chars, TTY_NORMAL, size); 30 return tty_insert_flip_string_fixed_flag(port, chars, TTY_NORMAL, size);
30} 31}
31 32
32#endif /* _LINUX_TTY_FLIP_H */ 33#endif /* _LINUX_TTY_FLIP_H */
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index bd6fd0f43d2b..cbec3b642871 100644
--- a/net/bluetooth/rfcomm/tty.c
+++ b/net/bluetooth/rfcomm/tty.c
@@ -556,7 +556,7 @@ static void rfcomm_dev_data_ready(struct rfcomm_dlc *dlc, struct sk_buff *skb)
556 556
557 BT_DBG("dlc %p tty %p len %d", dlc, tty, skb->len); 557 BT_DBG("dlc %p tty %p len %d", dlc, tty, skb->len);
558 558
559 tty_insert_flip_string(tty, skb->data, skb->len); 559 tty_insert_flip_string(&dev->port, skb->data, skb->len);
560 tty_flip_buffer_push(tty); 560 tty_flip_buffer_push(tty);
561 561
562 kfree_skb(skb); 562 kfree_skb(skb);
@@ -633,7 +633,8 @@ static void rfcomm_tty_copy_pending(struct rfcomm_dev *dev)
633 rfcomm_dlc_lock(dev->dlc); 633 rfcomm_dlc_lock(dev->dlc);
634 634
635 while ((skb = skb_dequeue(&dev->pending))) { 635 while ((skb = skb_dequeue(&dev->pending))) {
636 inserted += tty_insert_flip_string(tty, skb->data, skb->len); 636 inserted += tty_insert_flip_string(&dev->port, skb->data,
637 skb->len);
637 kfree_skb(skb); 638 kfree_skb(skb);
638 } 639 }
639 640
diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c
index a68c88cdec6e..14b08e376f9f 100644
--- a/net/irda/ircomm/ircomm_tty.c
+++ b/net/irda/ircomm/ircomm_tty.c
@@ -1141,7 +1141,7 @@ static int ircomm_tty_data_indication(void *instance, void *sap,
1141 * Use flip buffer functions since the code may be called from interrupt 1141 * Use flip buffer functions since the code may be called from interrupt
1142 * context 1142 * context
1143 */ 1143 */
1144 tty_insert_flip_string(tty, skb->data, skb->len); 1144 tty_insert_flip_string(&self->port, skb->data, skb->len);
1145 tty_flip_buffer_push(tty); 1145 tty_flip_buffer_push(tty);
1146 tty_kref_put(tty); 1146 tty_kref_put(tty);
1147 1147