diff options
author | Jiri Slaby <jslaby@suse.cz> | 2013-01-03 09:53:06 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-16 01:30:15 -0500 |
commit | 2e124b4a390ca85325fae75764bef92f0547fa25 (patch) | |
tree | 5519fbcdbe954e79b271ea6d31ac5a4dc754c4f5 /drivers/tty | |
parent | d6c53c0e9bd0a83f9f9ddbc9fd80141a54d83896 (diff) |
TTY: switch tty_flip_buffer_push
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.
Now, the one where most of tty_port_tty_get gets removed:
tty_flip_buffer_push.
IOW we also closed all the races in drivers not using tty_port_tty_get
at all yet.
Also we move tty_flip_buffer_push declaration from include/linux/tty.h
to include/linux/tty_flip.h to all others while we are changing it
anyway.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
85 files changed, 224 insertions, 468 deletions
diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c index 2d1357acbc23..4c7d70172193 100644 --- a/drivers/tty/amiserial.c +++ b/drivers/tty/amiserial.c | |||
@@ -251,7 +251,6 @@ static void receive_chars(struct serial_state *info) | |||
251 | { | 251 | { |
252 | int status; | 252 | int status; |
253 | int serdatr; | 253 | int serdatr; |
254 | struct tty_struct *tty = info->tport.tty; | ||
255 | unsigned char ch, flag; | 254 | unsigned char ch, flag; |
256 | struct async_icount *icount; | 255 | struct async_icount *icount; |
257 | int oe = 0; | 256 | int oe = 0; |
@@ -314,7 +313,7 @@ static void receive_chars(struct serial_state *info) | |||
314 | #endif | 313 | #endif |
315 | flag = TTY_BREAK; | 314 | flag = TTY_BREAK; |
316 | if (info->tport.flags & ASYNC_SAK) | 315 | if (info->tport.flags & ASYNC_SAK) |
317 | do_SAK(tty); | 316 | do_SAK(info->tport.tty); |
318 | } else if (status & UART_LSR_PE) | 317 | } else if (status & UART_LSR_PE) |
319 | flag = TTY_PARITY; | 318 | flag = TTY_PARITY; |
320 | else if (status & UART_LSR_FE) | 319 | else if (status & UART_LSR_FE) |
@@ -331,7 +330,7 @@ static void receive_chars(struct serial_state *info) | |||
331 | tty_insert_flip_char(&info->tport, ch, flag); | 330 | tty_insert_flip_char(&info->tport, ch, flag); |
332 | if (oe == 1) | 331 | if (oe == 1) |
333 | tty_insert_flip_char(&info->tport, 0, TTY_OVERRUN); | 332 | tty_insert_flip_char(&info->tport, 0, TTY_OVERRUN); |
334 | tty_flip_buffer_push(tty); | 333 | tty_flip_buffer_push(&info->tport); |
335 | out: | 334 | out: |
336 | return; | 335 | return; |
337 | } | 336 | } |
diff --git a/drivers/tty/bfin_jtag_comm.c b/drivers/tty/bfin_jtag_comm.c index 143c38579cb5..a93a424873fa 100644 --- a/drivers/tty/bfin_jtag_comm.c +++ b/drivers/tty/bfin_jtag_comm.c | |||
@@ -95,18 +95,16 @@ bfin_jc_emudat_manager(void *arg) | |||
95 | 95 | ||
96 | /* if incoming data is ready, eat it */ | 96 | /* if incoming data is ready, eat it */ |
97 | if (bfin_read_DBGSTAT() & EMUDIF) { | 97 | if (bfin_read_DBGSTAT() & EMUDIF) { |
98 | if (tty != NULL) { | 98 | uint32_t emudat = bfin_read_emudat(); |
99 | uint32_t emudat = bfin_read_emudat(); | 99 | if (inbound_len == 0) { |
100 | if (inbound_len == 0) { | 100 | pr_debug("incoming length: 0x%08x\n", emudat); |
101 | pr_debug("incoming length: 0x%08x\n", emudat); | 101 | inbound_len = emudat; |
102 | inbound_len = emudat; | 102 | } else { |
103 | } else { | 103 | size_t num_chars = (4 <= inbound_len ? 4 : inbound_len); |
104 | size_t num_chars = (4 <= inbound_len ? 4 : inbound_len); | 104 | 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); | 105 | inbound_len -= num_chars; |
106 | inbound_len -= num_chars; | 106 | tty_insert_flip_string(&port, (unsigned char *)&emudat, num_chars); |
107 | tty_insert_flip_string(&port, (unsigned char *)&emudat, num_chars); | 107 | tty_flip_buffer_push(&port); |
108 | tty_flip_buffer_push(tty); | ||
109 | } | ||
110 | } | 108 | } |
111 | } | 109 | } |
112 | 110 | ||
diff --git a/drivers/tty/ehv_bytechan.c b/drivers/tty/ehv_bytechan.c index 5164f9a57017..ed92622b8949 100644 --- a/drivers/tty/ehv_bytechan.c +++ b/drivers/tty/ehv_bytechan.c | |||
@@ -371,16 +371,11 @@ console_initcall(ehv_bc_console_init); | |||
371 | static irqreturn_t ehv_bc_tty_rx_isr(int irq, void *data) | 371 | static irqreturn_t ehv_bc_tty_rx_isr(int irq, void *data) |
372 | { | 372 | { |
373 | struct ehv_bc_data *bc = data; | 373 | struct ehv_bc_data *bc = data; |
374 | struct tty_struct *ttys = tty_port_tty_get(&bc->port); | ||
375 | unsigned int rx_count, tx_count, len; | 374 | unsigned int rx_count, tx_count, len; |
376 | int count; | 375 | int count; |
377 | char buffer[EV_BYTE_CHANNEL_MAX_BYTES]; | 376 | char buffer[EV_BYTE_CHANNEL_MAX_BYTES]; |
378 | int ret; | 377 | int ret; |
379 | 378 | ||
380 | /* ttys could be NULL during a hangup */ | ||
381 | if (!ttys) | ||
382 | return IRQ_HANDLED; | ||
383 | |||
384 | /* Find out how much data needs to be read, and then ask the TTY layer | 379 | /* Find out how much data needs to be read, and then ask the TTY layer |
385 | * if it can handle that much. We want to ensure that every byte we | 380 | * if it can handle that much. We want to ensure that every byte we |
386 | * read from the byte channel will be accepted by the TTY layer. | 381 | * read from the byte channel will be accepted by the TTY layer. |
@@ -422,9 +417,7 @@ static irqreturn_t ehv_bc_tty_rx_isr(int irq, void *data) | |||
422 | } | 417 | } |
423 | 418 | ||
424 | /* Tell the tty layer that we're done. */ | 419 | /* Tell the tty layer that we're done. */ |
425 | tty_flip_buffer_push(ttys); | 420 | tty_flip_buffer_push(&bc->port); |
426 | |||
427 | tty_kref_put(ttys); | ||
428 | 421 | ||
429 | return IRQ_HANDLED; | 422 | return IRQ_HANDLED; |
430 | } | 423 | } |
diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c index 8c2fe3a0e091..eb255e807c06 100644 --- a/drivers/tty/hvc/hvc_console.c +++ b/drivers/tty/hvc/hvc_console.c | |||
@@ -691,7 +691,7 @@ int hvc_poll(struct hvc_struct *hp) | |||
691 | a minimum for performance. */ | 691 | a minimum for performance. */ |
692 | timeout = MIN_TIMEOUT; | 692 | timeout = MIN_TIMEOUT; |
693 | 693 | ||
694 | tty_flip_buffer_push(tty); | 694 | tty_flip_buffer_push(&hp->port); |
695 | } | 695 | } |
696 | tty_kref_put(tty); | 696 | tty_kref_put(tty); |
697 | 697 | ||
diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c index 7bfc0a924b2f..1956593ee89d 100644 --- a/drivers/tty/hvc/hvcs.c +++ b/drivers/tty/hvc/hvcs.c | |||
@@ -623,7 +623,7 @@ static int hvcs_io(struct hvcs_struct *hvcsd) | |||
623 | spin_unlock_irqrestore(&hvcsd->lock, flags); | 623 | spin_unlock_irqrestore(&hvcsd->lock, flags); |
624 | /* This is synch because tty->low_latency == 1 */ | 624 | /* This is synch because tty->low_latency == 1 */ |
625 | if(got) | 625 | if(got) |
626 | tty_flip_buffer_push(tty); | 626 | tty_flip_buffer_push(&hvcsd->port); |
627 | 627 | ||
628 | if (!got) { | 628 | if (!got) { |
629 | /* Do this _after_ the flip_buffer_push */ | 629 | /* Do this _after_ the flip_buffer_push */ |
diff --git a/drivers/tty/hvc/hvsi.c b/drivers/tty/hvc/hvsi.c index 1f528b8ebf5f..dc591290120b 100644 --- a/drivers/tty/hvc/hvsi.c +++ b/drivers/tty/hvc/hvsi.c | |||
@@ -465,7 +465,7 @@ static int hvsi_load_chunk(struct hvsi_struct *hp, struct tty_struct *tty, | |||
465 | compact_inbuf(hp, packet); | 465 | compact_inbuf(hp, packet); |
466 | 466 | ||
467 | if (flip) | 467 | if (flip) |
468 | tty_flip_buffer_push(tty); | 468 | tty_flip_buffer_push(&hp->port); |
469 | 469 | ||
470 | return 1; | 470 | return 1; |
471 | } | 471 | } |
@@ -511,7 +511,7 @@ static irqreturn_t hvsi_interrupt(int irq, void *arg) | |||
511 | /* we weren't hung up and we weren't throttled, so we can | 511 | /* we weren't hung up and we weren't throttled, so we can |
512 | * deliver the rest now */ | 512 | * deliver the rest now */ |
513 | hvsi_send_overflow(hp); | 513 | hvsi_send_overflow(hp); |
514 | tty_flip_buffer_push(tty); | 514 | tty_flip_buffer_push(&hp->port); |
515 | } | 515 | } |
516 | spin_unlock_irqrestore(&hp->lock, flags); | 516 | spin_unlock_irqrestore(&hp->lock, flags); |
517 | 517 | ||
@@ -998,7 +998,7 @@ static void hvsi_unthrottle(struct tty_struct *tty) | |||
998 | spin_lock_irqsave(&hp->lock, flags); | 998 | spin_lock_irqsave(&hp->lock, flags); |
999 | if (hp->n_throttle) { | 999 | if (hp->n_throttle) { |
1000 | hvsi_send_overflow(hp); | 1000 | hvsi_send_overflow(hp); |
1001 | tty_flip_buffer_push(tty); | 1001 | tty_flip_buffer_push(&hp->port); |
1002 | } | 1002 | } |
1003 | spin_unlock_irqrestore(&hp->lock, flags); | 1003 | spin_unlock_irqrestore(&hp->lock, flags); |
1004 | 1004 | ||
diff --git a/drivers/tty/ipwireless/tty.c b/drivers/tty/ipwireless/tty.c index c43da7445432..8fd72ff9436e 100644 --- a/drivers/tty/ipwireless/tty.c +++ b/drivers/tty/ipwireless/tty.c | |||
@@ -160,15 +160,9 @@ static void ipw_close(struct tty_struct *linux_tty, struct file *filp) | |||
160 | void ipwireless_tty_received(struct ipw_tty *tty, unsigned char *data, | 160 | void ipwireless_tty_received(struct ipw_tty *tty, unsigned char *data, |
161 | unsigned int length) | 161 | unsigned int length) |
162 | { | 162 | { |
163 | struct tty_struct *linux_tty; | ||
164 | int work = 0; | 163 | int work = 0; |
165 | 164 | ||
166 | mutex_lock(&tty->ipw_tty_mutex); | 165 | mutex_lock(&tty->ipw_tty_mutex); |
167 | linux_tty = tty->port.tty; | ||
168 | if (linux_tty == NULL) { | ||
169 | mutex_unlock(&tty->ipw_tty_mutex); | ||
170 | return; | ||
171 | } | ||
172 | 166 | ||
173 | if (!tty->port.count) { | 167 | if (!tty->port.count) { |
174 | mutex_unlock(&tty->ipw_tty_mutex); | 168 | mutex_unlock(&tty->ipw_tty_mutex); |
@@ -187,7 +181,7 @@ void ipwireless_tty_received(struct ipw_tty *tty, unsigned char *data, | |||
187 | * This may sleep if ->low_latency is set | 181 | * This may sleep if ->low_latency is set |
188 | */ | 182 | */ |
189 | if (work) | 183 | if (work) |
190 | tty_flip_buffer_push(linux_tty); | 184 | tty_flip_buffer_push(&tty->port); |
191 | } | 185 | } |
192 | 186 | ||
193 | static void ipw_write_packet_sent_callback(void *callback_data, | 187 | static void ipw_write_packet_sent_callback(void *callback_data, |
diff --git a/drivers/tty/isicom.c b/drivers/tty/isicom.c index c70144f55fc0..858291ca889c 100644 --- a/drivers/tty/isicom.c +++ b/drivers/tty/isicom.c | |||
@@ -637,7 +637,7 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id) | |||
637 | tty_insert_flip_char(&port->port, 0, TTY_BREAK); | 637 | tty_insert_flip_char(&port->port, 0, TTY_BREAK); |
638 | if (port->port.flags & ASYNC_SAK) | 638 | if (port->port.flags & ASYNC_SAK) |
639 | do_SAK(tty); | 639 | do_SAK(tty); |
640 | tty_flip_buffer_push(tty); | 640 | tty_flip_buffer_push(&port->port); |
641 | break; | 641 | break; |
642 | 642 | ||
643 | case 2: /* Statistics */ | 643 | case 2: /* Statistics */ |
@@ -671,7 +671,7 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id) | |||
671 | byte_count -= 2; | 671 | byte_count -= 2; |
672 | } | 672 | } |
673 | } | 673 | } |
674 | tty_flip_buffer_push(tty); | 674 | tty_flip_buffer_push(&port->port); |
675 | } | 675 | } |
676 | outw(0x0000, base+0x04); /* enable interrupts */ | 676 | outw(0x0000, base+0x04); /* enable interrupts */ |
677 | spin_unlock(&card->card_lock); | 677 | spin_unlock(&card->card_lock); |
diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index e9cdfdfe06e9..ad34a202a34d 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c | |||
@@ -2145,7 +2145,7 @@ end_intr: | |||
2145 | * recursive locking. | 2145 | * recursive locking. |
2146 | */ | 2146 | */ |
2147 | spin_unlock(&port->slock); | 2147 | spin_unlock(&port->slock); |
2148 | tty_flip_buffer_push(tty); | 2148 | tty_flip_buffer_push(&port->port); |
2149 | spin_lock(&port->slock); | 2149 | spin_lock(&port->slock); |
2150 | } | 2150 | } |
2151 | 2151 | ||
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 4a3342d21c8f..d84dcfeadce3 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c | |||
@@ -1141,7 +1141,6 @@ static void gsm_control_modem(struct gsm_mux *gsm, u8 *data, int clen) | |||
1141 | static void gsm_control_rls(struct gsm_mux *gsm, u8 *data, int clen) | 1141 | static void gsm_control_rls(struct gsm_mux *gsm, u8 *data, int clen) |
1142 | { | 1142 | { |
1143 | struct tty_port *port; | 1143 | struct tty_port *port; |
1144 | struct tty_struct *tty; | ||
1145 | unsigned int addr = 0 ; | 1144 | unsigned int addr = 0 ; |
1146 | u8 bits; | 1145 | u8 bits; |
1147 | int len = clen; | 1146 | int len = clen; |
@@ -1174,12 +1173,8 @@ static void gsm_control_rls(struct gsm_mux *gsm, u8 *data, int clen) | |||
1174 | if (bits & 8) | 1173 | if (bits & 8) |
1175 | tty_insert_flip_char(port, 0, TTY_FRAME); | 1174 | tty_insert_flip_char(port, 0, TTY_FRAME); |
1176 | 1175 | ||
1177 | /* See if we have an uplink tty */ | 1176 | tty_flip_buffer_push(port); |
1178 | tty = tty_port_tty_get(port); | 1177 | |
1179 | if (tty) { | ||
1180 | tty_flip_buffer_push(tty); | ||
1181 | tty_kref_put(tty); | ||
1182 | } | ||
1183 | gsm_control_reply(gsm, CMD_RLS, data, clen); | 1178 | gsm_control_reply(gsm, CMD_RLS, data, clen); |
1184 | } | 1179 | } |
1185 | 1180 | ||
@@ -1552,36 +1547,37 @@ static void gsm_dlci_data(struct gsm_dlci *dlci, u8 *data, int clen) | |||
1552 | { | 1547 | { |
1553 | /* krefs .. */ | 1548 | /* krefs .. */ |
1554 | struct tty_port *port = &dlci->port; | 1549 | struct tty_port *port = &dlci->port; |
1555 | struct tty_struct *tty = tty_port_tty_get(port); | 1550 | struct tty_struct *tty; |
1556 | unsigned int modem = 0; | 1551 | unsigned int modem = 0; |
1557 | int len = clen; | 1552 | int len = clen; |
1558 | 1553 | ||
1559 | if (debug & 16) | 1554 | if (debug & 16) |
1560 | pr_debug("%d bytes for tty %p\n", len, tty); | 1555 | pr_debug("%d bytes for tty\n", len); |
1561 | if (tty) { | 1556 | switch (dlci->adaption) { |
1562 | switch (dlci->adaption) { | 1557 | /* Unsupported types */ |
1563 | /* Unsupported types */ | 1558 | /* Packetised interruptible data */ |
1564 | /* Packetised interruptible data */ | 1559 | case 4: |
1565 | case 4: | 1560 | break; |
1566 | break; | 1561 | /* Packetised uininterruptible voice/data */ |
1567 | /* Packetised uininterruptible voice/data */ | 1562 | case 3: |
1568 | case 3: | 1563 | break; |
1569 | break; | 1564 | /* Asynchronous serial with line state in each frame */ |
1570 | /* Asynchronous serial with line state in each frame */ | 1565 | case 2: |
1571 | case 2: | 1566 | while (gsm_read_ea(&modem, *data++) == 0) { |
1572 | while (gsm_read_ea(&modem, *data++) == 0) { | 1567 | len--; |
1573 | len--; | 1568 | if (len == 0) |
1574 | if (len == 0) | 1569 | return; |
1575 | return; | 1570 | } |
1576 | } | 1571 | tty = tty_port_tty_get(port); |
1572 | if (tty) { | ||
1577 | gsm_process_modem(tty, dlci, modem, clen); | 1573 | gsm_process_modem(tty, dlci, modem, clen); |
1578 | /* Line state will go via DLCI 0 controls only */ | 1574 | tty_kref_put(tty); |
1579 | case 1: | ||
1580 | default: | ||
1581 | tty_insert_flip_string(port, data, len); | ||
1582 | tty_flip_buffer_push(tty); | ||
1583 | } | 1575 | } |
1584 | tty_kref_put(tty); | 1576 | /* Line state will go via DLCI 0 controls only */ |
1577 | case 1: | ||
1578 | default: | ||
1579 | tty_insert_flip_string(port, data, len); | ||
1580 | tty_flip_buffer_push(port); | ||
1585 | } | 1581 | } |
1586 | } | 1582 | } |
1587 | 1583 | ||
diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c index 941fe8060ea5..afdd7732d925 100644 --- a/drivers/tty/nozomi.c +++ b/drivers/tty/nozomi.c | |||
@@ -1272,15 +1272,11 @@ static irqreturn_t interrupt_handler(int irq, void *dev_id) | |||
1272 | 1272 | ||
1273 | exit_handler: | 1273 | exit_handler: |
1274 | spin_unlock(&dc->spin_mutex); | 1274 | spin_unlock(&dc->spin_mutex); |
1275 | for (a = 0; a < NOZOMI_MAX_PORTS; a++) { | 1275 | |
1276 | struct tty_struct *tty; | 1276 | for (a = 0; a < NOZOMI_MAX_PORTS; a++) |
1277 | if (test_and_clear_bit(a, &dc->flip)) { | 1277 | if (test_and_clear_bit(a, &dc->flip)) |
1278 | tty = tty_port_tty_get(&dc->port[a].port); | 1278 | tty_flip_buffer_push(&dc->port[a].port); |
1279 | if (tty) | 1279 | |
1280 | tty_flip_buffer_push(tty); | ||
1281 | tty_kref_put(tty); | ||
1282 | } | ||
1283 | } | ||
1284 | return IRQ_HANDLED; | 1280 | return IRQ_HANDLED; |
1285 | none: | 1281 | none: |
1286 | spin_unlock(&dc->spin_mutex); | 1282 | spin_unlock(&dc->spin_mutex); |
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index 3c285d398f38..32d027c303aa 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c | |||
@@ -123,7 +123,7 @@ static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c) | |||
123 | c = tty_insert_flip_string(to->port, 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->port); |
127 | tty_wakeup(tty); | 127 | tty_wakeup(tty); |
128 | } | 128 | } |
129 | } | 129 | } |
diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c index 5848a767001a..8073cc0dff59 100644 --- a/drivers/tty/rocket.c +++ b/drivers/tty/rocket.c | |||
@@ -315,9 +315,8 @@ static inline int rocket_paranoia_check(struct r_port *info, | |||
315 | * that receive data is present on a serial port. Pulls data from FIFO, moves it into the | 315 | * that receive data is present on a serial port. Pulls data from FIFO, moves it into the |
316 | * tty layer. | 316 | * tty layer. |
317 | */ | 317 | */ |
318 | static void rp_do_receive(struct r_port *info, | 318 | static void rp_do_receive(struct r_port *info, CHANNEL_t *cp, |
319 | struct tty_struct *tty, | 319 | unsigned int ChanStatus) |
320 | CHANNEL_t * cp, unsigned int ChanStatus) | ||
321 | { | 320 | { |
322 | unsigned int CharNStat; | 321 | unsigned int CharNStat; |
323 | int ToRecv, wRecv, space; | 322 | int ToRecv, wRecv, space; |
@@ -416,7 +415,7 @@ static void rp_do_receive(struct r_port *info, | |||
416 | cbuf[ToRecv - 1] = sInB(sGetTxRxDataIO(cp)); | 415 | cbuf[ToRecv - 1] = sInB(sGetTxRxDataIO(cp)); |
417 | } | 416 | } |
418 | /* Push the data up to the tty layer */ | 417 | /* Push the data up to the tty layer */ |
419 | tty_flip_buffer_push(tty); | 418 | tty_flip_buffer_push(&info->port); |
420 | } | 419 | } |
421 | 420 | ||
422 | /* | 421 | /* |
@@ -495,7 +494,6 @@ static void rp_do_transmit(struct r_port *info) | |||
495 | static void rp_handle_port(struct r_port *info) | 494 | static void rp_handle_port(struct r_port *info) |
496 | { | 495 | { |
497 | CHANNEL_t *cp; | 496 | CHANNEL_t *cp; |
498 | struct tty_struct *tty; | ||
499 | unsigned int IntMask, ChanStatus; | 497 | unsigned int IntMask, ChanStatus; |
500 | 498 | ||
501 | if (!info) | 499 | if (!info) |
@@ -506,12 +504,7 @@ static void rp_handle_port(struct r_port *info) | |||
506 | "info->flags & NOT_INIT\n"); | 504 | "info->flags & NOT_INIT\n"); |
507 | return; | 505 | return; |
508 | } | 506 | } |
509 | tty = tty_port_tty_get(&info->port); | 507 | |
510 | if (!tty) { | ||
511 | printk(KERN_WARNING "rp: WARNING: rp_handle_port called with " | ||
512 | "tty==NULL\n"); | ||
513 | return; | ||
514 | } | ||
515 | cp = &info->channel; | 508 | cp = &info->channel; |
516 | 509 | ||
517 | IntMask = sGetChanIntID(cp) & info->intmask; | 510 | IntMask = sGetChanIntID(cp) & info->intmask; |
@@ -520,7 +513,7 @@ static void rp_handle_port(struct r_port *info) | |||
520 | #endif | 513 | #endif |
521 | ChanStatus = sGetChanStatus(cp); | 514 | ChanStatus = sGetChanStatus(cp); |
522 | if (IntMask & RXF_TRIG) { /* Rx FIFO trigger level */ | 515 | if (IntMask & RXF_TRIG) { /* Rx FIFO trigger level */ |
523 | rp_do_receive(info, tty, cp, ChanStatus); | 516 | rp_do_receive(info, cp, ChanStatus); |
524 | } | 517 | } |
525 | if (IntMask & DELTA_CD) { /* CD change */ | 518 | if (IntMask & DELTA_CD) { /* CD change */ |
526 | #if (defined(ROCKET_DEBUG_OPEN) || defined(ROCKET_DEBUG_INTR) || defined(ROCKET_DEBUG_HANGUP)) | 519 | #if (defined(ROCKET_DEBUG_OPEN) || defined(ROCKET_DEBUG_INTR) || defined(ROCKET_DEBUG_HANGUP)) |
@@ -528,10 +521,15 @@ static void rp_handle_port(struct r_port *info) | |||
528 | (ChanStatus & CD_ACT) ? "on" : "off"); | 521 | (ChanStatus & CD_ACT) ? "on" : "off"); |
529 | #endif | 522 | #endif |
530 | if (!(ChanStatus & CD_ACT) && info->cd_status) { | 523 | if (!(ChanStatus & CD_ACT) && info->cd_status) { |
524 | struct tty_struct *tty; | ||
531 | #ifdef ROCKET_DEBUG_HANGUP | 525 | #ifdef ROCKET_DEBUG_HANGUP |
532 | printk(KERN_INFO "CD drop, calling hangup.\n"); | 526 | printk(KERN_INFO "CD drop, calling hangup.\n"); |
533 | #endif | 527 | #endif |
534 | tty_hangup(tty); | 528 | tty = tty_port_tty_get(&info->port); |
529 | if (tty) { | ||
530 | tty_hangup(tty); | ||
531 | tty_kref_put(tty); | ||
532 | } | ||
535 | } | 533 | } |
536 | info->cd_status = (ChanStatus & CD_ACT) ? 1 : 0; | 534 | info->cd_status = (ChanStatus & CD_ACT) ? 1 : 0; |
537 | wake_up_interruptible(&info->port.open_wait); | 535 | wake_up_interruptible(&info->port.open_wait); |
@@ -544,7 +542,6 @@ static void rp_handle_port(struct r_port *info) | |||
544 | printk(KERN_INFO "DSR change...\n"); | 542 | printk(KERN_INFO "DSR change...\n"); |
545 | } | 543 | } |
546 | #endif | 544 | #endif |
547 | tty_kref_put(tty); | ||
548 | } | 545 | } |
549 | 546 | ||
550 | /* | 547 | /* |
diff --git a/drivers/tty/serial/21285.c b/drivers/tty/serial/21285.c index a44345a2dbb4..c7e8b60b6177 100644 --- a/drivers/tty/serial/21285.c +++ b/drivers/tty/serial/21285.c | |||
@@ -85,7 +85,6 @@ static void serial21285_enable_ms(struct uart_port *port) | |||
85 | static irqreturn_t serial21285_rx_chars(int irq, void *dev_id) | 85 | static irqreturn_t serial21285_rx_chars(int irq, void *dev_id) |
86 | { | 86 | { |
87 | struct uart_port *port = dev_id; | 87 | struct uart_port *port = dev_id; |
88 | struct tty_struct *tty = port->state->port.tty; | ||
89 | unsigned int status, ch, flag, rxs, max_count = 256; | 88 | unsigned int status, ch, flag, rxs, max_count = 256; |
90 | 89 | ||
91 | status = *CSR_UARTFLG; | 90 | status = *CSR_UARTFLG; |
@@ -115,7 +114,7 @@ static irqreturn_t serial21285_rx_chars(int irq, void *dev_id) | |||
115 | 114 | ||
116 | status = *CSR_UARTFLG; | 115 | status = *CSR_UARTFLG; |
117 | } | 116 | } |
118 | tty_flip_buffer_push(tty); | 117 | tty_flip_buffer_push(&port->state->port); |
119 | 118 | ||
120 | return IRQ_HANDLED; | 119 | return IRQ_HANDLED; |
121 | } | 120 | } |
diff --git a/drivers/tty/serial/8250/8250.c b/drivers/tty/serial/8250/8250.c index 5fb6577b94dc..0d771ec16750 100644 --- a/drivers/tty/serial/8250/8250.c +++ b/drivers/tty/serial/8250/8250.c | |||
@@ -1323,7 +1323,6 @@ unsigned char | |||
1323 | serial8250_rx_chars(struct uart_8250_port *up, unsigned char lsr) | 1323 | serial8250_rx_chars(struct uart_8250_port *up, unsigned char lsr) |
1324 | { | 1324 | { |
1325 | struct uart_port *port = &up->port; | 1325 | struct uart_port *port = &up->port; |
1326 | struct tty_struct *tty = port->state->port.tty; | ||
1327 | unsigned char ch; | 1326 | unsigned char ch; |
1328 | int max_count = 256; | 1327 | int max_count = 256; |
1329 | char flag; | 1328 | char flag; |
@@ -1388,7 +1387,7 @@ ignore_char: | |||
1388 | lsr = serial_in(up, UART_LSR); | 1387 | lsr = serial_in(up, UART_LSR); |
1389 | } while ((lsr & (UART_LSR_DR | UART_LSR_BI)) && (max_count-- > 0)); | 1388 | } while ((lsr & (UART_LSR_DR | UART_LSR_BI)) && (max_count-- > 0)); |
1390 | spin_unlock(&port->lock); | 1389 | spin_unlock(&port->lock); |
1391 | tty_flip_buffer_push(tty); | 1390 | tty_flip_buffer_push(&port->state->port); |
1392 | spin_lock(&port->lock); | 1391 | spin_lock(&port->lock); |
1393 | return lsr; | 1392 | return lsr; |
1394 | } | 1393 | } |
diff --git a/drivers/tty/serial/altera_jtaguart.c b/drivers/tty/serial/altera_jtaguart.c index 872f14ae43d2..84b90fd48063 100644 --- a/drivers/tty/serial/altera_jtaguart.c +++ b/drivers/tty/serial/altera_jtaguart.c | |||
@@ -139,7 +139,7 @@ static void altera_jtaguart_rx_chars(struct altera_jtaguart *pp) | |||
139 | uart_insert_char(port, 0, 0, ch, flag); | 139 | uart_insert_char(port, 0, 0, ch, flag); |
140 | } | 140 | } |
141 | 141 | ||
142 | tty_flip_buffer_push(port->state->port.tty); | 142 | tty_flip_buffer_push(&port->state->port); |
143 | } | 143 | } |
144 | 144 | ||
145 | static void altera_jtaguart_tx_chars(struct altera_jtaguart *pp) | 145 | static void altera_jtaguart_tx_chars(struct altera_jtaguart *pp) |
diff --git a/drivers/tty/serial/altera_uart.c b/drivers/tty/serial/altera_uart.c index 684a0808e1c7..e133c8814bb5 100644 --- a/drivers/tty/serial/altera_uart.c +++ b/drivers/tty/serial/altera_uart.c | |||
@@ -231,7 +231,7 @@ static void altera_uart_rx_chars(struct altera_uart *pp) | |||
231 | flag); | 231 | flag); |
232 | } | 232 | } |
233 | 233 | ||
234 | tty_flip_buffer_push(port->state->port.tty); | 234 | tty_flip_buffer_push(&port->state->port); |
235 | } | 235 | } |
236 | 236 | ||
237 | static void altera_uart_tx_chars(struct altera_uart *pp) | 237 | static void altera_uart_tx_chars(struct altera_uart *pp) |
diff --git a/drivers/tty/serial/amba-pl010.c b/drivers/tty/serial/amba-pl010.c index 22317dd16474..c36840519527 100644 --- a/drivers/tty/serial/amba-pl010.c +++ b/drivers/tty/serial/amba-pl010.c | |||
@@ -116,7 +116,6 @@ static void pl010_enable_ms(struct uart_port *port) | |||
116 | 116 | ||
117 | static void pl010_rx_chars(struct uart_amba_port *uap) | 117 | static void pl010_rx_chars(struct uart_amba_port *uap) |
118 | { | 118 | { |
119 | struct tty_struct *tty = uap->port.state->port.tty; | ||
120 | unsigned int status, ch, flag, rsr, max_count = 256; | 119 | unsigned int status, ch, flag, rsr, max_count = 256; |
121 | 120 | ||
122 | status = readb(uap->port.membase + UART01x_FR); | 121 | status = readb(uap->port.membase + UART01x_FR); |
@@ -165,7 +164,7 @@ static void pl010_rx_chars(struct uart_amba_port *uap) | |||
165 | status = readb(uap->port.membase + UART01x_FR); | 164 | status = readb(uap->port.membase + UART01x_FR); |
166 | } | 165 | } |
167 | spin_unlock(&uap->port.lock); | 166 | spin_unlock(&uap->port.lock); |
168 | tty_flip_buffer_push(tty); | 167 | tty_flip_buffer_push(&uap->port.state->port); |
169 | spin_lock(&uap->port.lock); | 168 | spin_lock(&uap->port.lock); |
170 | } | 169 | } |
171 | 170 | ||
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index e1257d17f5f0..3ea5408fcbeb 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c | |||
@@ -699,7 +699,6 @@ static void pl011_dma_rx_chars(struct uart_amba_port *uap, | |||
699 | bool readfifo) | 699 | bool readfifo) |
700 | { | 700 | { |
701 | struct tty_port *port = &uap->port.state->port; | 701 | struct tty_port *port = &uap->port.state->port; |
702 | struct tty_struct *tty = port->tty; | ||
703 | struct pl011_sgbuf *sgbuf = use_buf_b ? | 702 | struct pl011_sgbuf *sgbuf = use_buf_b ? |
704 | &uap->dmarx.sgbuf_b : &uap->dmarx.sgbuf_a; | 703 | &uap->dmarx.sgbuf_b : &uap->dmarx.sgbuf_a; |
705 | struct device *dev = uap->dmarx.chan->device->dev; | 704 | struct device *dev = uap->dmarx.chan->device->dev; |
@@ -754,7 +753,7 @@ static void pl011_dma_rx_chars(struct uart_amba_port *uap, | |||
754 | dev_vdbg(uap->port.dev, | 753 | dev_vdbg(uap->port.dev, |
755 | "Took %d chars from DMA buffer and %d chars from the FIFO\n", | 754 | "Took %d chars from DMA buffer and %d chars from the FIFO\n", |
756 | dma_count, fifotaken); | 755 | dma_count, fifotaken); |
757 | tty_flip_buffer_push(tty); | 756 | tty_flip_buffer_push(port); |
758 | spin_lock(&uap->port.lock); | 757 | spin_lock(&uap->port.lock); |
759 | } | 758 | } |
760 | 759 | ||
@@ -1076,12 +1075,10 @@ static void pl011_enable_ms(struct uart_port *port) | |||
1076 | 1075 | ||
1077 | static void pl011_rx_chars(struct uart_amba_port *uap) | 1076 | static void pl011_rx_chars(struct uart_amba_port *uap) |
1078 | { | 1077 | { |
1079 | struct tty_struct *tty = uap->port.state->port.tty; | ||
1080 | |||
1081 | pl011_fifo_to_tty(uap); | 1078 | pl011_fifo_to_tty(uap); |
1082 | 1079 | ||
1083 | spin_unlock(&uap->port.lock); | 1080 | spin_unlock(&uap->port.lock); |
1084 | tty_flip_buffer_push(tty); | 1081 | tty_flip_buffer_push(&uap->port.state->port); |
1085 | /* | 1082 | /* |
1086 | * If we were temporarily out of DMA mode for a while, | 1083 | * If we were temporarily out of DMA mode for a while, |
1087 | * attempt to switch back to DMA mode again. | 1084 | * attempt to switch back to DMA mode again. |
diff --git a/drivers/tty/serial/apbuart.c b/drivers/tty/serial/apbuart.c index 59ae2b53e765..6331464d9101 100644 --- a/drivers/tty/serial/apbuart.c +++ b/drivers/tty/serial/apbuart.c | |||
@@ -78,7 +78,6 @@ static void apbuart_enable_ms(struct uart_port *port) | |||
78 | 78 | ||
79 | static void apbuart_rx_chars(struct uart_port *port) | 79 | static void apbuart_rx_chars(struct uart_port *port) |
80 | { | 80 | { |
81 | struct tty_struct *tty = port->state->port.tty; | ||
82 | unsigned int status, ch, rsr, flag; | 81 | unsigned int status, ch, rsr, flag; |
83 | unsigned int max_chars = port->fifosize; | 82 | unsigned int max_chars = port->fifosize; |
84 | 83 | ||
@@ -126,7 +125,7 @@ static void apbuart_rx_chars(struct uart_port *port) | |||
126 | status = UART_GET_STATUS(port); | 125 | status = UART_GET_STATUS(port); |
127 | } | 126 | } |
128 | 127 | ||
129 | tty_flip_buffer_push(tty); | 128 | tty_flip_buffer_push(&port->state->port); |
130 | } | 129 | } |
131 | 130 | ||
132 | static void apbuart_tx_chars(struct uart_port *port) | 131 | static void apbuart_tx_chars(struct uart_port *port) |
diff --git a/drivers/tty/serial/ar933x_uart.c b/drivers/tty/serial/ar933x_uart.c index 6ca5dd615f9e..27f20c57abed 100644 --- a/drivers/tty/serial/ar933x_uart.c +++ b/drivers/tty/serial/ar933x_uart.c | |||
@@ -298,10 +298,8 @@ static void ar933x_uart_set_termios(struct uart_port *port, | |||
298 | static void ar933x_uart_rx_chars(struct ar933x_uart_port *up) | 298 | static void ar933x_uart_rx_chars(struct ar933x_uart_port *up) |
299 | { | 299 | { |
300 | struct tty_port *port = &up->port.state->port; | 300 | struct tty_port *port = &up->port.state->port; |
301 | struct tty_struct *tty; | ||
302 | int max_count = 256; | 301 | int max_count = 256; |
303 | 302 | ||
304 | tty = tty_port_tty_get(port); | ||
305 | do { | 303 | do { |
306 | unsigned int rdata; | 304 | unsigned int rdata; |
307 | unsigned char ch; | 305 | unsigned char ch; |
@@ -324,10 +322,7 @@ static void ar933x_uart_rx_chars(struct ar933x_uart_port *up) | |||
324 | tty_insert_flip_char(port, ch, TTY_NORMAL); | 322 | tty_insert_flip_char(port, ch, TTY_NORMAL); |
325 | } while (max_count-- > 0); | 323 | } while (max_count-- > 0); |
326 | 324 | ||
327 | if (tty) { | 325 | tty_flip_buffer_push(port); |
328 | tty_flip_buffer_push(tty); | ||
329 | tty_kref_put(tty); | ||
330 | } | ||
331 | } | 326 | } |
332 | 327 | ||
333 | static void ar933x_uart_tx_chars(struct ar933x_uart_port *up) | 328 | static void ar933x_uart_tx_chars(struct ar933x_uart_port *up) |
diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c index b46860104312..da734222e537 100644 --- a/drivers/tty/serial/arc_uart.c +++ b/drivers/tty/serial/arc_uart.c | |||
@@ -211,12 +211,8 @@ static void arc_serial_start_tx(struct uart_port *port) | |||
211 | 211 | ||
212 | static void arc_serial_rx_chars(struct arc_uart_port *uart) | 212 | static void arc_serial_rx_chars(struct arc_uart_port *uart) |
213 | { | 213 | { |
214 | struct tty_struct *tty = tty_port_tty_get(&uart->port.state->port); | ||
215 | unsigned int status, ch, flg = 0; | 214 | unsigned int status, ch, flg = 0; |
216 | 215 | ||
217 | if (!tty) | ||
218 | return; | ||
219 | |||
220 | /* | 216 | /* |
221 | * UART has 4 deep RX-FIFO. Driver's recongnition of this fact | 217 | * UART has 4 deep RX-FIFO. Driver's recongnition of this fact |
222 | * is very subtle. Here's how ... | 218 | * is very subtle. Here's how ... |
@@ -252,10 +248,8 @@ static void arc_serial_rx_chars(struct arc_uart_port *uart) | |||
252 | uart_insert_char(&uart->port, status, RXOERR, ch, flg); | 248 | uart_insert_char(&uart->port, status, RXOERR, ch, flg); |
253 | 249 | ||
254 | done: | 250 | done: |
255 | tty_flip_buffer_push(tty); | 251 | tty_flip_buffer_push(&uart->port.state->port); |
256 | } | 252 | } |
257 | |||
258 | tty_kref_put(tty); | ||
259 | } | 253 | } |
260 | 254 | ||
261 | /* | 255 | /* |
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index 929567038c5a..d4a7c241b751 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c | |||
@@ -774,7 +774,7 @@ static void atmel_rx_from_ring(struct uart_port *port) | |||
774 | * uart_start(), which takes the lock. | 774 | * uart_start(), which takes the lock. |
775 | */ | 775 | */ |
776 | spin_unlock(&port->lock); | 776 | spin_unlock(&port->lock); |
777 | tty_flip_buffer_push(port->state->port.tty); | 777 | tty_flip_buffer_push(&port->state->port); |
778 | spin_lock(&port->lock); | 778 | spin_lock(&port->lock); |
779 | } | 779 | } |
780 | 780 | ||
@@ -782,7 +782,6 @@ static 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_port *tport = &port->state->port; | 784 | struct tty_port *tport = &port->state->port; |
785 | struct tty_struct *tty = tport->tty; | ||
786 | struct atmel_dma_buffer *pdc; | 785 | struct atmel_dma_buffer *pdc; |
787 | int rx_idx = atmel_port->pdc_rx_idx; | 786 | int rx_idx = atmel_port->pdc_rx_idx; |
788 | unsigned int head; | 787 | unsigned int head; |
@@ -850,7 +849,7 @@ static void atmel_rx_from_dma(struct uart_port *port) | |||
850 | * uart_start(), which takes the lock. | 849 | * uart_start(), which takes the lock. |
851 | */ | 850 | */ |
852 | spin_unlock(&port->lock); | 851 | spin_unlock(&port->lock); |
853 | tty_flip_buffer_push(tty); | 852 | tty_flip_buffer_push(tport); |
854 | spin_lock(&port->lock); | 853 | spin_lock(&port->lock); |
855 | 854 | ||
856 | UART_PUT_IER(port, ATMEL_US_ENDRX | ATMEL_US_TIMEOUT); | 855 | UART_PUT_IER(port, ATMEL_US_ENDRX | ATMEL_US_TIMEOUT); |
diff --git a/drivers/tty/serial/bcm63xx_uart.c b/drivers/tty/serial/bcm63xx_uart.c index de30b1909728..719594e5fc21 100644 --- a/drivers/tty/serial/bcm63xx_uart.c +++ b/drivers/tty/serial/bcm63xx_uart.c | |||
@@ -236,14 +236,12 @@ static const char *bcm_uart_type(struct uart_port *port) | |||
236 | static void bcm_uart_do_rx(struct uart_port *port) | 236 | static void bcm_uart_do_rx(struct uart_port *port) |
237 | { | 237 | { |
238 | struct tty_port *port = &port->state->port; | 238 | struct tty_port *port = &port->state->port; |
239 | struct tty_struct *tty; | ||
240 | unsigned int max_count; | 239 | unsigned int max_count; |
241 | 240 | ||
242 | /* limit number of char read in interrupt, should not be | 241 | /* limit number of char read in interrupt, should not be |
243 | * higher than fifo size anyway since we're much faster than | 242 | * higher than fifo size anyway since we're much faster than |
244 | * serial port */ | 243 | * serial port */ |
245 | max_count = 32; | 244 | max_count = 32; |
246 | tty = port->tty; | ||
247 | do { | 245 | do { |
248 | unsigned int iestat, c, cstat; | 246 | unsigned int iestat, c, cstat; |
249 | char flag; | 247 | char flag; |
@@ -305,7 +303,7 @@ static void bcm_uart_do_rx(struct uart_port *port) | |||
305 | 303 | ||
306 | } while (--max_count); | 304 | } while (--max_count); |
307 | 305 | ||
308 | tty_flip_buffer_push(tty); | 306 | tty_flip_buffer_push(port); |
309 | } | 307 | } |
310 | 308 | ||
311 | /* | 309 | /* |
diff --git a/drivers/tty/serial/bfin_sport_uart.c b/drivers/tty/serial/bfin_sport_uart.c index e4d3ac2e8992..487c173b0f72 100644 --- a/drivers/tty/serial/bfin_sport_uart.c +++ b/drivers/tty/serial/bfin_sport_uart.c | |||
@@ -150,7 +150,6 @@ static irqreturn_t sport_uart_rx_irq(int irq, void *dev_id) | |||
150 | { | 150 | { |
151 | struct sport_uart_port *up = dev_id; | 151 | struct sport_uart_port *up = dev_id; |
152 | struct tty_port *port = &up->port.state->port; | 152 | struct tty_port *port = &up->port.state->port; |
153 | struct tty_struct *tty = tport->tty; | ||
154 | unsigned int ch; | 153 | unsigned int ch; |
155 | 154 | ||
156 | spin_lock(&up->port.lock); | 155 | spin_lock(&up->port.lock); |
@@ -162,7 +161,8 @@ static irqreturn_t sport_uart_rx_irq(int irq, void *dev_id) | |||
162 | if (!uart_handle_sysrq_char(&up->port, ch)) | 161 | if (!uart_handle_sysrq_char(&up->port, ch)) |
163 | tty_insert_flip_char(port, ch, TTY_NORMAL); | 162 | tty_insert_flip_char(port, ch, TTY_NORMAL); |
164 | } | 163 | } |
165 | tty_flip_buffer_push(tty); | 164 | /* XXX this won't deadlock with lowlat? */ |
165 | tty_flip_buffer_push(port); | ||
166 | 166 | ||
167 | spin_unlock(&up->port.lock); | 167 | spin_unlock(&up->port.lock); |
168 | 168 | ||
diff --git a/drivers/tty/serial/bfin_uart.c b/drivers/tty/serial/bfin_uart.c index 2e2b2c1cb722..12dceda9db33 100644 --- a/drivers/tty/serial/bfin_uart.c +++ b/drivers/tty/serial/bfin_uart.c | |||
@@ -223,7 +223,6 @@ static void bfin_serial_enable_ms(struct uart_port *port) | |||
223 | #ifdef CONFIG_SERIAL_BFIN_PIO | 223 | #ifdef CONFIG_SERIAL_BFIN_PIO |
224 | static void bfin_serial_rx_chars(struct bfin_serial_port *uart) | 224 | static void bfin_serial_rx_chars(struct bfin_serial_port *uart) |
225 | { | 225 | { |
226 | struct tty_struct *tty = NULL; | ||
227 | unsigned int status, ch, flg; | 226 | unsigned int status, ch, flg; |
228 | static struct timeval anomaly_start = { .tv_sec = 0 }; | 227 | static struct timeval anomaly_start = { .tv_sec = 0 }; |
229 | 228 | ||
@@ -242,11 +241,9 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart) | |||
242 | return; | 241 | return; |
243 | } | 242 | } |
244 | 243 | ||
245 | if (!uart->port.state || !uart->port.state->port.tty) | 244 | if (!uart->port.state) |
246 | return; | 245 | return; |
247 | #endif | 246 | #endif |
248 | tty = uart->port.state->port.tty; | ||
249 | |||
250 | if (ANOMALY_05000363) { | 247 | if (ANOMALY_05000363) { |
251 | /* The BF533 (and BF561) family of processors have a nice anomaly | 248 | /* The BF533 (and BF561) family of processors have a nice anomaly |
252 | * where they continuously generate characters for a "single" break. | 249 | * where they continuously generate characters for a "single" break. |
@@ -325,7 +322,7 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart) | |||
325 | uart_insert_char(&uart->port, status, OE, ch, flg); | 322 | uart_insert_char(&uart->port, status, OE, ch, flg); |
326 | 323 | ||
327 | ignore_char: | 324 | ignore_char: |
328 | tty_flip_buffer_push(tty); | 325 | tty_flip_buffer_push(&uart->port.state->port); |
329 | } | 326 | } |
330 | 327 | ||
331 | static void bfin_serial_tx_chars(struct bfin_serial_port *uart) | 328 | static void bfin_serial_tx_chars(struct bfin_serial_port *uart) |
@@ -426,7 +423,6 @@ static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart) | |||
426 | 423 | ||
427 | static void bfin_serial_dma_rx_chars(struct bfin_serial_port *uart) | 424 | static void bfin_serial_dma_rx_chars(struct bfin_serial_port *uart) |
428 | { | 425 | { |
429 | struct tty_struct *tty = uart->port.state->port.tty; | ||
430 | int i, flg, status; | 426 | int i, flg, status; |
431 | 427 | ||
432 | status = UART_GET_LSR(uart); | 428 | status = UART_GET_LSR(uart); |
@@ -471,7 +467,7 @@ static void bfin_serial_dma_rx_chars(struct bfin_serial_port *uart) | |||
471 | } | 467 | } |
472 | 468 | ||
473 | dma_ignore_char: | 469 | dma_ignore_char: |
474 | tty_flip_buffer_push(tty); | 470 | tty_flip_buffer_push(&uart->port.state->port); |
475 | } | 471 | } |
476 | 472 | ||
477 | void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart) | 473 | void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart) |
diff --git a/drivers/tty/serial/clps711x.c b/drivers/tty/serial/clps711x.c index 3fd2526d121e..bfb17968c8db 100644 --- a/drivers/tty/serial/clps711x.c +++ b/drivers/tty/serial/clps711x.c | |||
@@ -85,12 +85,8 @@ static void uart_clps711x_enable_ms(struct uart_port *port) | |||
85 | static irqreturn_t uart_clps711x_int_rx(int irq, void *dev_id) | 85 | static irqreturn_t uart_clps711x_int_rx(int irq, void *dev_id) |
86 | { | 86 | { |
87 | struct uart_port *port = dev_id; | 87 | struct uart_port *port = dev_id; |
88 | struct tty_struct *tty = tty_port_tty_get(&port->state->port); | ||
89 | unsigned int status, ch, flg; | 88 | unsigned int status, ch, flg; |
90 | 89 | ||
91 | if (!tty) | ||
92 | return IRQ_HANDLED; | ||
93 | |||
94 | for (;;) { | 90 | for (;;) { |
95 | status = clps_readl(SYSFLG(port)); | 91 | status = clps_readl(SYSFLG(port)); |
96 | if (status & SYSFLG_URXFE) | 92 | if (status & SYSFLG_URXFE) |
@@ -130,9 +126,7 @@ static irqreturn_t uart_clps711x_int_rx(int irq, void *dev_id) | |||
130 | uart_insert_char(port, status, UARTDR_OVERR, ch, flg); | 126 | uart_insert_char(port, status, UARTDR_OVERR, ch, flg); |
131 | } | 127 | } |
132 | 128 | ||
133 | tty_flip_buffer_push(tty); | 129 | tty_flip_buffer_push(&port->state->port); |
134 | |||
135 | tty_kref_put(tty); | ||
136 | 130 | ||
137 | return IRQ_HANDLED; | 131 | return IRQ_HANDLED; |
138 | } | 132 | } |
diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c index 0bb24378a3c0..97f4e1858649 100644 --- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c | |||
@@ -246,7 +246,6 @@ static void cpm_uart_int_rx(struct uart_port *port) | |||
246 | unsigned char ch; | 246 | unsigned char ch; |
247 | u8 *cp; | 247 | u8 *cp; |
248 | struct tty_port *tport = &port->state->port; | 248 | struct tty_port *tport = &port->state->port; |
249 | struct tty_struct *tty = tport->tty; | ||
250 | struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port; | 249 | struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port; |
251 | cbd_t __iomem *bdp; | 250 | cbd_t __iomem *bdp; |
252 | u16 status; | 251 | u16 status; |
@@ -323,7 +322,7 @@ static void cpm_uart_int_rx(struct uart_port *port) | |||
323 | pinfo->rx_cur = bdp; | 322 | pinfo->rx_cur = bdp; |
324 | 323 | ||
325 | /* activate BH processing */ | 324 | /* activate BH processing */ |
326 | tty_flip_buffer_push(tty); | 325 | tty_flip_buffer_push(tport); |
327 | 326 | ||
328 | return; | 327 | return; |
329 | 328 | ||
diff --git a/drivers/tty/serial/crisv10.c b/drivers/tty/serial/crisv10.c index 52449adc09ac..45acf103433e 100644 --- a/drivers/tty/serial/crisv10.c +++ b/drivers/tty/serial/crisv10.c | |||
@@ -2104,17 +2104,10 @@ static int force_eop_if_needed(struct e100_serial *info) | |||
2104 | 2104 | ||
2105 | static void flush_to_flip_buffer(struct e100_serial *info) | 2105 | static void flush_to_flip_buffer(struct e100_serial *info) |
2106 | { | 2106 | { |
2107 | struct tty_struct *tty; | ||
2108 | struct etrax_recv_buffer *buffer; | 2107 | struct etrax_recv_buffer *buffer; |
2109 | unsigned long flags; | 2108 | unsigned long flags; |
2110 | 2109 | ||
2111 | local_irq_save(flags); | 2110 | local_irq_save(flags); |
2112 | tty = info->port.tty; | ||
2113 | |||
2114 | if (!tty) { | ||
2115 | local_irq_restore(flags); | ||
2116 | return; | ||
2117 | } | ||
2118 | 2111 | ||
2119 | while ((buffer = info->first_recv_buffer) != NULL) { | 2112 | while ((buffer = info->first_recv_buffer) != NULL) { |
2120 | unsigned int count = buffer->length; | 2113 | unsigned int count = buffer->length; |
@@ -2138,7 +2131,7 @@ static void flush_to_flip_buffer(struct e100_serial *info) | |||
2138 | local_irq_restore(flags); | 2131 | local_irq_restore(flags); |
2139 | 2132 | ||
2140 | /* This includes a check for low-latency */ | 2133 | /* This includes a check for low-latency */ |
2141 | tty_flip_buffer_push(tty); | 2134 | tty_flip_buffer_push(&info->port); |
2142 | } | 2135 | } |
2143 | 2136 | ||
2144 | static void check_flush_timeout(struct e100_serial *info) | 2137 | static void check_flush_timeout(struct e100_serial *info) |
@@ -2274,12 +2267,6 @@ static | |||
2274 | struct e100_serial * handle_ser_rx_interrupt_no_dma(struct e100_serial *info) | 2267 | struct e100_serial * handle_ser_rx_interrupt_no_dma(struct e100_serial *info) |
2275 | { | 2268 | { |
2276 | unsigned long data_read; | 2269 | unsigned long data_read; |
2277 | struct tty_struct *tty = info->port.tty; | ||
2278 | |||
2279 | if (!tty) { | ||
2280 | printk("!NO TTY!\n"); | ||
2281 | return info; | ||
2282 | } | ||
2283 | 2270 | ||
2284 | /* Read data and status at the same time */ | 2271 | /* Read data and status at the same time */ |
2285 | data_read = *((unsigned long *)&info->ioport[REG_DATA_STATUS32]); | 2272 | data_read = *((unsigned long *)&info->ioport[REG_DATA_STATUS32]); |
@@ -2382,7 +2369,7 @@ more_data: | |||
2382 | goto more_data; | 2369 | goto more_data; |
2383 | } | 2370 | } |
2384 | 2371 | ||
2385 | tty_flip_buffer_push(info->port.tty); | 2372 | tty_flip_buffer_push(&info->port); |
2386 | return info; | 2373 | return info; |
2387 | } | 2374 | } |
2388 | 2375 | ||
diff --git a/drivers/tty/serial/dz.c b/drivers/tty/serial/dz.c index 6491b8644a7f..2f2b2e538a54 100644 --- a/drivers/tty/serial/dz.c +++ b/drivers/tty/serial/dz.c | |||
@@ -187,7 +187,6 @@ static inline void dz_receive_chars(struct dz_mux *mux) | |||
187 | { | 187 | { |
188 | struct uart_port *uport; | 188 | struct uart_port *uport; |
189 | struct dz_port *dport = &mux->dport[0]; | 189 | struct dz_port *dport = &mux->dport[0]; |
190 | struct tty_struct *tty = NULL; | ||
191 | struct uart_icount *icount; | 190 | struct uart_icount *icount; |
192 | int lines_rx[DZ_NB_PORT] = { [0 ... DZ_NB_PORT - 1] = 0 }; | 191 | int lines_rx[DZ_NB_PORT] = { [0 ... DZ_NB_PORT - 1] = 0 }; |
193 | unsigned char ch, flag; | 192 | unsigned char ch, flag; |
@@ -197,7 +196,6 @@ static inline void dz_receive_chars(struct dz_mux *mux) | |||
197 | while ((status = dz_in(dport, DZ_RBUF)) & DZ_DVAL) { | 196 | while ((status = dz_in(dport, DZ_RBUF)) & DZ_DVAL) { |
198 | dport = &mux->dport[LINE(status)]; | 197 | dport = &mux->dport[LINE(status)]; |
199 | uport = &dport->port; | 198 | uport = &dport->port; |
200 | tty = uport->state->port.tty; /* point to the proper dev */ | ||
201 | 199 | ||
202 | ch = UCHAR(status); /* grab the char */ | 200 | ch = UCHAR(status); /* grab the char */ |
203 | flag = TTY_NORMAL; | 201 | flag = TTY_NORMAL; |
@@ -249,7 +247,7 @@ static inline void dz_receive_chars(struct dz_mux *mux) | |||
249 | } | 247 | } |
250 | for (i = 0; i < DZ_NB_PORT; i++) | 248 | for (i = 0; i < DZ_NB_PORT; i++) |
251 | if (lines_rx[i]) | 249 | if (lines_rx[i]) |
252 | tty_flip_buffer_push(mux->dport[i].port.state->port.tty); | 250 | tty_flip_buffer_push(&mux->dport[i].port.state->port); |
253 | } | 251 | } |
254 | 252 | ||
255 | /* | 253 | /* |
diff --git a/drivers/tty/serial/efm32-uart.c b/drivers/tty/serial/efm32-uart.c index bdf67b0cb8b6..de14bd7dce10 100644 --- a/drivers/tty/serial/efm32-uart.c +++ b/drivers/tty/serial/efm32-uart.c | |||
@@ -249,12 +249,9 @@ static irqreturn_t efm32_uart_rxirq(int irq, void *data) | |||
249 | int handled = IRQ_NONE; | 249 | int handled = IRQ_NONE; |
250 | struct uart_port *port = &efm_port->port; | 250 | struct uart_port *port = &efm_port->port; |
251 | struct tty_port *tport = &port->state->port; | 251 | struct tty_port *tport = &port->state->port; |
252 | struct tty_struct *tty; | ||
253 | 252 | ||
254 | spin_lock(&port->lock); | 253 | spin_lock(&port->lock); |
255 | 254 | ||
256 | tty = tty_kref_get(tport->tty); | ||
257 | |||
258 | if (irqflag & UARTn_IF_RXDATAV) { | 255 | if (irqflag & UARTn_IF_RXDATAV) { |
259 | efm32_uart_write32(efm_port, UARTn_IF_RXDATAV, UARTn_IFC); | 256 | efm32_uart_write32(efm_port, UARTn_IF_RXDATAV, UARTn_IFC); |
260 | efm32_uart_rx_chars(efm_port); | 257 | efm32_uart_rx_chars(efm_port); |
@@ -270,10 +267,7 @@ static irqreturn_t efm32_uart_rxirq(int irq, void *data) | |||
270 | handled = IRQ_HANDLED; | 267 | handled = IRQ_HANDLED; |
271 | } | 268 | } |
272 | 269 | ||
273 | if (tty) { | 270 | tty_flip_buffer_push(tport); |
274 | tty_flip_buffer_push(tty); | ||
275 | tty_kref_put(tty); | ||
276 | } | ||
277 | 271 | ||
278 | spin_unlock(&port->lock); | 272 | spin_unlock(&port->lock); |
279 | 273 | ||
diff --git a/drivers/tty/serial/icom.c b/drivers/tty/serial/icom.c index 54903ee5e5ab..bc9e6b017b05 100644 --- a/drivers/tty/serial/icom.c +++ b/drivers/tty/serial/icom.c | |||
@@ -735,7 +735,6 @@ static void recv_interrupt(u16 port_int_reg, struct icom_port *icom_port) | |||
735 | { | 735 | { |
736 | short int count, rcv_buff; | 736 | short int count, rcv_buff; |
737 | struct tty_port *port = &icom_port->uart_port.state->port; | 737 | struct tty_port *port = &icom_port->uart_port.state->port; |
738 | struct tty_struct *tty = port->tty; | ||
739 | unsigned short int status; | 738 | unsigned short int status; |
740 | struct uart_icount *icount; | 739 | struct uart_icount *icount; |
741 | unsigned long offset; | 740 | unsigned long offset; |
@@ -835,7 +834,7 @@ ignore_char: | |||
835 | status = cpu_to_le16(icom_port->statStg->rcv[rcv_buff].flags); | 834 | status = cpu_to_le16(icom_port->statStg->rcv[rcv_buff].flags); |
836 | } | 835 | } |
837 | icom_port->next_rcv = rcv_buff; | 836 | icom_port->next_rcv = rcv_buff; |
838 | tty_flip_buffer_push(tty); | 837 | tty_flip_buffer_push(port); |
839 | } | 838 | } |
840 | 839 | ||
841 | static void process_interrupt(u16 port_int_reg, | 840 | static void process_interrupt(u16 port_int_reg, |
diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c index 4bc6e47890b4..6a6668bbb330 100644 --- a/drivers/tty/serial/ifx6x60.c +++ b/drivers/tty/serial/ifx6x60.c | |||
@@ -669,12 +669,8 @@ static const struct tty_operations ifx_spi_serial_ops = { | |||
669 | static void ifx_spi_insert_flip_string(struct ifx_spi_device *ifx_dev, | 669 | static void ifx_spi_insert_flip_string(struct ifx_spi_device *ifx_dev, |
670 | unsigned char *chars, size_t size) | 670 | unsigned char *chars, size_t size) |
671 | { | 671 | { |
672 | struct tty_struct *tty = tty_port_tty_get(&ifx_dev->tty_port); | ||
673 | if (!tty) | ||
674 | return; | ||
675 | tty_insert_flip_string(&ifx_dev->tty_port, chars, size); | 672 | tty_insert_flip_string(&ifx_dev->tty_port, chars, size); |
676 | tty_flip_buffer_push(tty); | 673 | tty_flip_buffer_push(&ifx_dev->tty_port); |
677 | tty_kref_put(tty); | ||
678 | } | 674 | } |
679 | 675 | ||
680 | /** | 676 | /** |
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index f60c4028b6e1..be26345bf6a4 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c | |||
@@ -518,7 +518,6 @@ static irqreturn_t imx_rxint(int irq, void *dev_id) | |||
518 | unsigned int rx, flg, ignored = 0; | 518 | unsigned int rx, flg, ignored = 0; |
519 | struct tty_struct *tty = sport->port.state->port.tty; | 519 | struct tty_struct *tty = sport->port.state->port.tty; |
520 | struct tty_port *port = &sport->port.state->port; | 520 | struct tty_port *port = &sport->port.state->port; |
521 | struct tty_struct *tty = port->tty; | ||
522 | unsigned long flags, temp; | 521 | unsigned long flags, temp; |
523 | 522 | ||
524 | spin_lock_irqsave(&sport->port.lock, flags); | 523 | spin_lock_irqsave(&sport->port.lock, flags); |
@@ -576,7 +575,7 @@ static irqreturn_t imx_rxint(int irq, void *dev_id) | |||
576 | 575 | ||
577 | out: | 576 | out: |
578 | spin_unlock_irqrestore(&sport->port.lock, flags); | 577 | spin_unlock_irqrestore(&sport->port.lock, flags); |
579 | tty_flip_buffer_push(tty); | 578 | tty_flip_buffer_push(port); |
580 | return IRQ_HANDLED; | 579 | return IRQ_HANDLED; |
581 | } | 580 | } |
582 | 581 | ||
diff --git a/drivers/tty/serial/ioc3_serial.c b/drivers/tty/serial/ioc3_serial.c index edbdc4e45075..6e4c715c5d26 100644 --- a/drivers/tty/serial/ioc3_serial.c +++ b/drivers/tty/serial/ioc3_serial.c | |||
@@ -1393,7 +1393,6 @@ static inline int do_read(struct uart_port *the_port, char *buf, int len) | |||
1393 | */ | 1393 | */ |
1394 | static int receive_chars(struct uart_port *the_port) | 1394 | static int receive_chars(struct uart_port *the_port) |
1395 | { | 1395 | { |
1396 | struct tty_struct *tty; | ||
1397 | unsigned char ch[MAX_CHARS]; | 1396 | unsigned char ch[MAX_CHARS]; |
1398 | int read_count = 0, read_room, flip = 0; | 1397 | int read_count = 0, read_room, flip = 0; |
1399 | struct uart_state *state = the_port->state; | 1398 | struct uart_state *state = the_port->state; |
@@ -1403,14 +1402,11 @@ static int receive_chars(struct uart_port *the_port) | |||
1403 | /* Make sure all the pointers are "good" ones */ | 1402 | /* Make sure all the pointers are "good" ones */ |
1404 | if (!state) | 1403 | if (!state) |
1405 | return 0; | 1404 | return 0; |
1406 | if (!state->port.tty) | ||
1407 | return 0; | ||
1408 | 1405 | ||
1409 | if (!(port->ip_flags & INPUT_ENABLE)) | 1406 | if (!(port->ip_flags & INPUT_ENABLE)) |
1410 | return 0; | 1407 | return 0; |
1411 | 1408 | ||
1412 | spin_lock_irqsave(&the_port->lock, pflags); | 1409 | spin_lock_irqsave(&the_port->lock, pflags); |
1413 | tty = state->port.tty; | ||
1414 | 1410 | ||
1415 | read_count = do_read(the_port, ch, MAX_CHARS); | 1411 | read_count = do_read(the_port, ch, MAX_CHARS); |
1416 | if (read_count > 0) { | 1412 | if (read_count > 0) { |
@@ -1422,7 +1418,7 @@ static int receive_chars(struct uart_port *the_port) | |||
1422 | spin_unlock_irqrestore(&the_port->lock, pflags); | 1418 | spin_unlock_irqrestore(&the_port->lock, pflags); |
1423 | 1419 | ||
1424 | if (flip) | 1420 | if (flip) |
1425 | tty_flip_buffer_push(tty); | 1421 | tty_flip_buffer_push(&state->port); |
1426 | 1422 | ||
1427 | return read_count; | 1423 | return read_count; |
1428 | } | 1424 | } |
diff --git a/drivers/tty/serial/ioc4_serial.c b/drivers/tty/serial/ioc4_serial.c index 86f64ed89b45..e2520abcb1c4 100644 --- a/drivers/tty/serial/ioc4_serial.c +++ b/drivers/tty/serial/ioc4_serial.c | |||
@@ -2340,7 +2340,6 @@ static inline int do_read(struct uart_port *the_port, unsigned char *buf, | |||
2340 | */ | 2340 | */ |
2341 | static void receive_chars(struct uart_port *the_port) | 2341 | static void receive_chars(struct uart_port *the_port) |
2342 | { | 2342 | { |
2343 | struct tty_struct *tty; | ||
2344 | unsigned char ch[IOC4_MAX_CHARS]; | 2343 | unsigned char ch[IOC4_MAX_CHARS]; |
2345 | int read_count, request_count = IOC4_MAX_CHARS; | 2344 | int read_count, request_count = IOC4_MAX_CHARS; |
2346 | struct uart_icount *icount; | 2345 | struct uart_icount *icount; |
@@ -2350,11 +2349,8 @@ static void receive_chars(struct uart_port *the_port) | |||
2350 | /* Make sure all the pointers are "good" ones */ | 2349 | /* Make sure all the pointers are "good" ones */ |
2351 | if (!state) | 2350 | if (!state) |
2352 | return; | 2351 | return; |
2353 | if (!state->port.tty) | ||
2354 | return; | ||
2355 | 2352 | ||
2356 | spin_lock_irqsave(&the_port->lock, pflags); | 2353 | spin_lock_irqsave(&the_port->lock, pflags); |
2357 | tty = state->port.tty; | ||
2358 | 2354 | ||
2359 | request_count = tty_buffer_request_room(&state->port, IOC4_MAX_CHARS); | 2355 | request_count = tty_buffer_request_room(&state->port, IOC4_MAX_CHARS); |
2360 | 2356 | ||
@@ -2369,7 +2365,7 @@ static void receive_chars(struct uart_port *the_port) | |||
2369 | 2365 | ||
2370 | spin_unlock_irqrestore(&the_port->lock, pflags); | 2366 | spin_unlock_irqrestore(&the_port->lock, pflags); |
2371 | 2367 | ||
2372 | tty_flip_buffer_push(tty); | 2368 | tty_flip_buffer_push(&state->port); |
2373 | } | 2369 | } |
2374 | 2370 | ||
2375 | /** | 2371 | /** |
diff --git a/drivers/tty/serial/jsm/jsm_tty.c b/drivers/tty/serial/jsm/jsm_tty.c index c9ce00dd1f8a..00f250ae14c5 100644 --- a/drivers/tty/serial/jsm/jsm_tty.c +++ b/drivers/tty/serial/jsm/jsm_tty.c | |||
@@ -654,7 +654,7 @@ void jsm_input(struct jsm_channel *ch) | |||
654 | spin_unlock_irqrestore(&ch->ch_lock, lock_flags); | 654 | spin_unlock_irqrestore(&ch->ch_lock, lock_flags); |
655 | 655 | ||
656 | /* Tell the tty layer its okay to "eat" the data now */ | 656 | /* Tell the tty layer its okay to "eat" the data now */ |
657 | tty_flip_buffer_push(tp); | 657 | tty_flip_buffer_push(port); |
658 | 658 | ||
659 | jsm_dbg(IOCTL, &ch->ch_bd->pci_dev, "finish\n"); | 659 | jsm_dbg(IOCTL, &ch->ch_bd->pci_dev, "finish\n"); |
660 | } | 660 | } |
diff --git a/drivers/tty/serial/kgdb_nmi.c b/drivers/tty/serial/kgdb_nmi.c index ba2ef627d9c6..26a50b0c868b 100644 --- a/drivers/tty/serial/kgdb_nmi.c +++ b/drivers/tty/serial/kgdb_nmi.c | |||
@@ -202,7 +202,6 @@ bool kgdb_nmi_poll_knock(void) | |||
202 | static void kgdb_nmi_tty_receiver(unsigned long data) | 202 | static void kgdb_nmi_tty_receiver(unsigned long data) |
203 | { | 203 | { |
204 | struct kgdb_nmi_tty_priv *priv = (void *)data; | 204 | struct kgdb_nmi_tty_priv *priv = (void *)data; |
205 | struct tty_struct *tty; | ||
206 | char ch; | 205 | char ch; |
207 | 206 | ||
208 | tasklet_schedule(&priv->tlet); | 207 | tasklet_schedule(&priv->tlet); |
@@ -210,16 +209,9 @@ static void kgdb_nmi_tty_receiver(unsigned long data) | |||
210 | if (likely(!kgdb_nmi_tty_enabled || !kfifo_len(&priv->fifo))) | 209 | if (likely(!kgdb_nmi_tty_enabled || !kfifo_len(&priv->fifo))) |
211 | return; | 210 | return; |
212 | 211 | ||
213 | /* Port is there, but tty might be hung up, check. */ | ||
214 | tty = tty_port_tty_get(kgdb_nmi_port); | ||
215 | if (!tty) | ||
216 | return; | ||
217 | |||
218 | while (kfifo_out(&priv->fifo, &ch, 1)) | 212 | while (kfifo_out(&priv->fifo, &ch, 1)) |
219 | tty_insert_flip_char(&priv->port, ch, TTY_NORMAL); | 213 | tty_insert_flip_char(&priv->port, ch, TTY_NORMAL); |
220 | tty_flip_buffer_push(priv->port.tty); | 214 | tty_flip_buffer_push(&priv->port); |
221 | |||
222 | tty_kref_put(tty); | ||
223 | } | 215 | } |
224 | 216 | ||
225 | static int kgdb_nmi_tty_activate(struct tty_port *port, struct tty_struct *tty) | 217 | static int kgdb_nmi_tty_activate(struct tty_port *port, struct tty_struct *tty) |
diff --git a/drivers/tty/serial/lantiq.c b/drivers/tty/serial/lantiq.c index 1933fe3c98dd..15733da757c6 100644 --- a/drivers/tty/serial/lantiq.c +++ b/drivers/tty/serial/lantiq.c | |||
@@ -163,21 +163,15 @@ static int | |||
163 | lqasc_rx_chars(struct uart_port *port) | 163 | lqasc_rx_chars(struct uart_port *port) |
164 | { | 164 | { |
165 | struct tty_port *tport = &port->state->port; | 165 | struct tty_port *tport = &port->state->port; |
166 | struct tty_struct *tty = tty_port_tty_get(tport); | ||
167 | unsigned int ch = 0, rsr = 0, fifocnt; | 166 | unsigned int ch = 0, rsr = 0, fifocnt; |
168 | 167 | ||
169 | if (!tty) { | 168 | fifocnt = ltq_r32(port->membase + LTQ_ASC_FSTAT) & ASCFSTAT_RXFFLMASK; |
170 | dev_dbg(port->dev, "%s:tty is busy now", __func__); | ||
171 | return -EBUSY; | ||
172 | } | ||
173 | fifocnt = | ||
174 | ltq_r32(port->membase + LTQ_ASC_FSTAT) & ASCFSTAT_RXFFLMASK; | ||
175 | while (fifocnt--) { | 169 | while (fifocnt--) { |
176 | u8 flag = TTY_NORMAL; | 170 | u8 flag = TTY_NORMAL; |
177 | ch = ltq_r8(port->membase + LTQ_ASC_RBUF); | 171 | ch = ltq_r8(port->membase + LTQ_ASC_RBUF); |
178 | rsr = (ltq_r32(port->membase + LTQ_ASC_STATE) | 172 | rsr = (ltq_r32(port->membase + LTQ_ASC_STATE) |
179 | & ASCSTATE_ANY) | UART_DUMMY_UER_RX; | 173 | & ASCSTATE_ANY) | UART_DUMMY_UER_RX; |
180 | tty_flip_buffer_push(tty); | 174 | tty_flip_buffer_push(tport); |
181 | port->icount.rx++; | 175 | port->icount.rx++; |
182 | 176 | ||
183 | /* | 177 | /* |
@@ -219,9 +213,10 @@ lqasc_rx_chars(struct uart_port *port) | |||
219 | */ | 213 | */ |
220 | tty_insert_flip_char(tport, 0, TTY_OVERRUN); | 214 | tty_insert_flip_char(tport, 0, TTY_OVERRUN); |
221 | } | 215 | } |
216 | |||
222 | if (ch != 0) | 217 | if (ch != 0) |
223 | tty_flip_buffer_push(tty); | 218 | tty_flip_buffer_push(tport); |
224 | tty_kref_put(tty); | 219 | |
225 | return 0; | 220 | return 0; |
226 | } | 221 | } |
227 | 222 | ||
diff --git a/drivers/tty/serial/lpc32xx_hs.c b/drivers/tty/serial/lpc32xx_hs.c index 5cd180564c03..c8448e6f52e5 100644 --- a/drivers/tty/serial/lpc32xx_hs.c +++ b/drivers/tty/serial/lpc32xx_hs.c | |||
@@ -259,16 +259,6 @@ static void __serial_lpc32xx_rx(struct uart_port *port) | |||
259 | { | 259 | { |
260 | struct tty_port *tport = &port->state->port; | 260 | struct tty_port *tport = &port->state->port; |
261 | unsigned int tmp, flag; | 261 | unsigned int tmp, flag; |
262 | struct tty_struct *tty = tty_port_tty_get(tport); | ||
263 | |||
264 | if (!tty) { | ||
265 | /* Discard data: no tty available */ | ||
266 | while (!(readl(LPC32XX_HSUART_FIFO(port->membase)) & | ||
267 | LPC32XX_HSU_RX_EMPTY)) | ||
268 | ; | ||
269 | |||
270 | return; | ||
271 | } | ||
272 | 262 | ||
273 | /* Read data from FIFO and push into terminal */ | 263 | /* Read data from FIFO and push into terminal */ |
274 | tmp = readl(LPC32XX_HSUART_FIFO(port->membase)); | 264 | tmp = readl(LPC32XX_HSUART_FIFO(port->membase)); |
@@ -289,8 +279,7 @@ static void __serial_lpc32xx_rx(struct uart_port *port) | |||
289 | 279 | ||
290 | tmp = readl(LPC32XX_HSUART_FIFO(port->membase)); | 280 | tmp = readl(LPC32XX_HSUART_FIFO(port->membase)); |
291 | } | 281 | } |
292 | tty_flip_buffer_push(tty); | 282 | tty_flip_buffer_push(tport); |
293 | tty_kref_put(tty); | ||
294 | } | 283 | } |
295 | 284 | ||
296 | static void __serial_lpc32xx_tx(struct uart_port *port) | 285 | static void __serial_lpc32xx_tx(struct uart_port *port) |
@@ -367,8 +356,7 @@ static irqreturn_t serial_lpc32xx_interrupt(int irq, void *dev_id) | |||
367 | /* Data received? */ | 356 | /* Data received? */ |
368 | if (status & (LPC32XX_HSU_RX_TIMEOUT_INT | LPC32XX_HSU_RX_TRIG_INT)) { | 357 | if (status & (LPC32XX_HSU_RX_TIMEOUT_INT | LPC32XX_HSU_RX_TRIG_INT)) { |
369 | __serial_lpc32xx_rx(port); | 358 | __serial_lpc32xx_rx(port); |
370 | if (tty) | 359 | tty_flip_buffer_push(tport); |
371 | tty_flip_buffer_push(tty); | ||
372 | } | 360 | } |
373 | 361 | ||
374 | /* Transmit data request? */ | 362 | /* Transmit data request? */ |
diff --git a/drivers/tty/serial/m32r_sio.c b/drivers/tty/serial/m32r_sio.c index 2e9a390f2ac4..bb1afa0922e1 100644 --- a/drivers/tty/serial/m32r_sio.c +++ b/drivers/tty/serial/m32r_sio.c | |||
@@ -301,7 +301,6 @@ static void m32r_sio_enable_ms(struct uart_port *port) | |||
301 | static void receive_chars(struct uart_sio_port *up, int *status) | 301 | static void receive_chars(struct uart_sio_port *up, int *status) |
302 | { | 302 | { |
303 | struct tty_port *port = &up->port.state->port; | 303 | struct tty_port *port = &up->port.state->port; |
304 | struct tty_struct *tty = tport->tty; | ||
305 | unsigned char ch; | 304 | unsigned char ch; |
306 | unsigned char flag; | 305 | unsigned char flag; |
307 | int max_count = 256; | 306 | int max_count = 256; |
@@ -369,7 +368,7 @@ static void receive_chars(struct uart_sio_port *up, int *status) | |||
369 | ignore_char: | 368 | ignore_char: |
370 | *status = serial_in(up, UART_LSR); | 369 | *status = serial_in(up, UART_LSR); |
371 | } while ((*status & UART_LSR_DR) && (max_count-- > 0)); | 370 | } while ((*status & UART_LSR_DR) && (max_count-- > 0)); |
372 | tty_flip_buffer_push(tty); | 371 | tty_flip_buffer_push(port); |
373 | } | 372 | } |
374 | 373 | ||
375 | static void transmit_chars(struct uart_sio_port *up) | 374 | static void transmit_chars(struct uart_sio_port *up) |
diff --git a/drivers/tty/serial/max3100.c b/drivers/tty/serial/max3100.c index e238e80cd981..791e1dfb8b11 100644 --- a/drivers/tty/serial/max3100.c +++ b/drivers/tty/serial/max3100.c | |||
@@ -311,8 +311,8 @@ static void max3100_work(struct work_struct *w) | |||
311 | } | 311 | } |
312 | } | 312 | } |
313 | 313 | ||
314 | if (rxchars > 16 && s->port.state->port.tty != NULL) { | 314 | if (rxchars > 16) { |
315 | tty_flip_buffer_push(s->port.state->port.tty); | 315 | tty_flip_buffer_push(&s->port.state->port); |
316 | rxchars = 0; | 316 | rxchars = 0; |
317 | } | 317 | } |
318 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) | 318 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) |
@@ -324,8 +324,8 @@ static void max3100_work(struct work_struct *w) | |||
324 | (!uart_circ_empty(xmit) && | 324 | (!uart_circ_empty(xmit) && |
325 | !uart_tx_stopped(&s->port)))); | 325 | !uart_tx_stopped(&s->port)))); |
326 | 326 | ||
327 | if (rxchars > 0 && s->port.state->port.tty != NULL) | 327 | if (rxchars > 0) |
328 | tty_flip_buffer_push(s->port.state->port.tty); | 328 | tty_flip_buffer_push(&s->port.state->port); |
329 | } | 329 | } |
330 | 330 | ||
331 | static irqreturn_t max3100_irq(int irqno, void *dev_id) | 331 | static irqreturn_t max3100_irq(int irqno, void *dev_id) |
diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c index a801f6872cad..0c2422cb04ea 100644 --- a/drivers/tty/serial/max310x.c +++ b/drivers/tty/serial/max310x.c | |||
@@ -460,10 +460,6 @@ static int max310x_set_ref_clk(struct max310x_port *s) | |||
460 | static void max310x_handle_rx(struct max310x_port *s, unsigned int rxlen) | 460 | static void max310x_handle_rx(struct max310x_port *s, unsigned int rxlen) |
461 | { | 461 | { |
462 | unsigned int sts = 0, ch = 0, flag; | 462 | unsigned int sts = 0, ch = 0, flag; |
463 | struct tty_struct *tty = tty_port_tty_get(&s->port.state->port); | ||
464 | |||
465 | if (!tty) | ||
466 | return; | ||
467 | 463 | ||
468 | if (unlikely(rxlen >= MAX310X_FIFO_SIZE)) { | 464 | if (unlikely(rxlen >= MAX310X_FIFO_SIZE)) { |
469 | dev_warn(s->port.dev, "Possible RX FIFO overrun %d\n", rxlen); | 465 | dev_warn(s->port.dev, "Possible RX FIFO overrun %d\n", rxlen); |
@@ -516,9 +512,7 @@ static void max310x_handle_rx(struct max310x_port *s, unsigned int rxlen) | |||
516 | ch, flag); | 512 | ch, flag); |
517 | } | 513 | } |
518 | 514 | ||
519 | tty_flip_buffer_push(tty); | 515 | tty_flip_buffer_push(&s->port.state->port); |
520 | |||
521 | tty_kref_put(tty); | ||
522 | } | 516 | } |
523 | 517 | ||
524 | static void max310x_handle_tx(struct max310x_port *s) | 518 | static void max310x_handle_tx(struct max310x_port *s) |
diff --git a/drivers/tty/serial/mcf.c b/drivers/tty/serial/mcf.c index fcd56ab6053f..7ed99274572f 100644 --- a/drivers/tty/serial/mcf.c +++ b/drivers/tty/serial/mcf.c | |||
@@ -310,7 +310,7 @@ static void mcf_rx_chars(struct mcf_uart *pp) | |||
310 | uart_insert_char(port, status, MCFUART_USR_RXOVERRUN, ch, flag); | 310 | uart_insert_char(port, status, MCFUART_USR_RXOVERRUN, ch, flag); |
311 | } | 311 | } |
312 | 312 | ||
313 | tty_flip_buffer_push(port->state->port.tty); | 313 | tty_flip_buffer_push(&port->state->port); |
314 | } | 314 | } |
315 | 315 | ||
316 | /****************************************************************************/ | 316 | /****************************************************************************/ |
diff --git a/drivers/tty/serial/mfd.c b/drivers/tty/serial/mfd.c index 60d585ab4870..5f4765a7a5c5 100644 --- a/drivers/tty/serial/mfd.c +++ b/drivers/tty/serial/mfd.c | |||
@@ -388,12 +388,8 @@ void hsu_dma_rx(struct uart_hsu_port *up, u32 int_sts) | |||
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_port *tport = &port->state->port; | 390 | struct tty_port *tport = &port->state->port; |
391 | struct tty_struct *tty = tport->tty; | ||
392 | int count; | 391 | int count; |
393 | 392 | ||
394 | if (!tty) | ||
395 | return; | ||
396 | |||
397 | /* | 393 | /* |
398 | * First need to know how many is already transferred, | 394 | * First need to know how many is already transferred, |
399 | * then check if its a timeout DMA irq, and return | 395 | * then check if its a timeout DMA irq, and return |
@@ -438,7 +434,7 @@ void hsu_dma_rx(struct uart_hsu_port *up, u32 int_sts) | |||
438 | | (0x1 << 16) | 434 | | (0x1 << 16) |
439 | | (0x1 << 24) /* timeout bit, see HSU Errata 1 */ | 435 | | (0x1 << 24) /* timeout bit, see HSU Errata 1 */ |
440 | ); | 436 | ); |
441 | tty_flip_buffer_push(tty); | 437 | tty_flip_buffer_push(tport); |
442 | 438 | ||
443 | chan_writel(chan, HSU_CH_CR, 0x3); | 439 | chan_writel(chan, HSU_CH_CR, 0x3); |
444 | 440 | ||
@@ -461,13 +457,9 @@ static void serial_hsu_stop_rx(struct uart_port *port) | |||
461 | 457 | ||
462 | static inline void receive_chars(struct uart_hsu_port *up, int *status) | 458 | static inline void receive_chars(struct uart_hsu_port *up, int *status) |
463 | { | 459 | { |
464 | struct tty_struct *tty = up->port.state->port.tty; | ||
465 | unsigned int ch, flag; | 460 | unsigned int ch, flag; |
466 | unsigned int max_count = 256; | 461 | unsigned int max_count = 256; |
467 | 462 | ||
468 | if (!tty) | ||
469 | return; | ||
470 | |||
471 | do { | 463 | do { |
472 | ch = serial_in(up, UART_RX); | 464 | ch = serial_in(up, UART_RX); |
473 | flag = TTY_NORMAL; | 465 | flag = TTY_NORMAL; |
@@ -523,7 +515,7 @@ static inline void receive_chars(struct uart_hsu_port *up, int *status) | |||
523 | ignore_char: | 515 | ignore_char: |
524 | *status = serial_in(up, UART_LSR); | 516 | *status = serial_in(up, UART_LSR); |
525 | } while ((*status & UART_LSR_DR) && max_count--); | 517 | } while ((*status & UART_LSR_DR) && max_count--); |
526 | tty_flip_buffer_push(tty); | 518 | tty_flip_buffer_push(&up->port.state->port); |
527 | } | 519 | } |
528 | 520 | ||
529 | static void transmit_chars(struct uart_hsu_port *up) | 521 | static void transmit_chars(struct uart_hsu_port *up) |
diff --git a/drivers/tty/serial/mpc52xx_uart.c b/drivers/tty/serial/mpc52xx_uart.c index 0145aeb7721c..c0e1fad51be7 100644 --- a/drivers/tty/serial/mpc52xx_uart.c +++ b/drivers/tty/serial/mpc52xx_uart.c | |||
@@ -942,7 +942,6 @@ static inline int | |||
942 | mpc52xx_uart_int_rx_chars(struct uart_port *port) | 942 | mpc52xx_uart_int_rx_chars(struct uart_port *port) |
943 | { | 943 | { |
944 | struct tty_port *tport = &port->state->port; | 944 | struct tty_port *tport = &port->state->port; |
945 | struct tty_struct *tty = tport->tty; | ||
946 | unsigned char ch, flag; | 945 | unsigned char ch, flag; |
947 | unsigned short status; | 946 | unsigned short status; |
948 | 947 | ||
@@ -1000,7 +999,7 @@ mpc52xx_uart_int_rx_chars(struct uart_port *port) | |||
1000 | } | 999 | } |
1001 | 1000 | ||
1002 | spin_unlock(&port->lock); | 1001 | spin_unlock(&port->lock); |
1003 | tty_flip_buffer_push(tty); | 1002 | tty_flip_buffer_push(tport); |
1004 | spin_lock(&port->lock); | 1003 | spin_lock(&port->lock); |
1005 | 1004 | ||
1006 | return psc_ops->raw_rx_rdy(port); | 1005 | return psc_ops->raw_rx_rdy(port); |
diff --git a/drivers/tty/serial/mpsc.c b/drivers/tty/serial/mpsc.c index 6f2d2ceb326a..bc24f4931670 100644 --- a/drivers/tty/serial/mpsc.c +++ b/drivers/tty/serial/mpsc.c | |||
@@ -938,7 +938,6 @@ static int mpsc_rx_intr(struct mpsc_port_info *pi) | |||
938 | { | 938 | { |
939 | struct mpsc_rx_desc *rxre; | 939 | struct mpsc_rx_desc *rxre; |
940 | struct tty_port *port = &pi->port.state->port; | 940 | struct tty_port *port = &pi->port.state->port; |
941 | struct tty_struct *tty = port->tty; | ||
942 | u32 cmdstat, bytes_in, i; | 941 | u32 cmdstat, bytes_in, i; |
943 | int rc = 0; | 942 | int rc = 0; |
944 | u8 *bp; | 943 | u8 *bp; |
@@ -971,7 +970,7 @@ static int mpsc_rx_intr(struct mpsc_port_info *pi) | |||
971 | /* Following use of tty struct directly is deprecated */ | 970 | /* Following use of tty struct directly is deprecated */ |
972 | if (tty_buffer_request_room(port, bytes_in) < bytes_in) { | 971 | if (tty_buffer_request_room(port, bytes_in) < bytes_in) { |
973 | if (port->low_latency) | 972 | if (port->low_latency) |
974 | tty_flip_buffer_push(tty); | 973 | tty_flip_buffer_push(port); |
975 | /* | 974 | /* |
976 | * If this failed then we will throw away the bytes | 975 | * If this failed then we will throw away the bytes |
977 | * but must do so to clear interrupts. | 976 | * but must do so to clear interrupts. |
@@ -1081,7 +1080,7 @@ next_frame: | |||
1081 | if ((readl(pi->sdma_base + SDMA_SDCM) & SDMA_SDCM_ERD) == 0) | 1080 | if ((readl(pi->sdma_base + SDMA_SDCM) & SDMA_SDCM_ERD) == 0) |
1082 | mpsc_start_rx(pi); | 1081 | mpsc_start_rx(pi); |
1083 | 1082 | ||
1084 | tty_flip_buffer_push(tty); | 1083 | tty_flip_buffer_push(port); |
1085 | return rc; | 1084 | return rc; |
1086 | } | 1085 | } |
1087 | 1086 | ||
diff --git a/drivers/tty/serial/mrst_max3110.c b/drivers/tty/serial/mrst_max3110.c index 4632db7a24b7..f641c232beca 100644 --- a/drivers/tty/serial/mrst_max3110.c +++ b/drivers/tty/serial/mrst_max3110.c | |||
@@ -340,7 +340,6 @@ receive_chars(struct uart_max3110 *max, unsigned short *str, int len) | |||
340 | { | 340 | { |
341 | struct uart_port *port = &max->port; | 341 | struct uart_port *port = &max->port; |
342 | struct tty_port *tport; | 342 | struct tty_port *tport; |
343 | struct tty_struct *tty; | ||
344 | char buf[M3110_RX_FIFO_DEPTH]; | 343 | char buf[M3110_RX_FIFO_DEPTH]; |
345 | int r, w, usable; | 344 | int r, w, usable; |
346 | 345 | ||
@@ -349,9 +348,6 @@ receive_chars(struct uart_max3110 *max, unsigned short *str, int len) | |||
349 | return 0; | 348 | return 0; |
350 | 349 | ||
351 | tport = &port->state->port; | 350 | tport = &port->state->port; |
352 | tty = tty_port_tty_get(tport); | ||
353 | if (!tty) | ||
354 | return 0; | ||
355 | 351 | ||
356 | for (r = 0, w = 0; r < len; r++) { | 352 | for (r = 0, w = 0; r < len; r++) { |
357 | if (str[r] & MAX3110_BREAK && | 353 | if (str[r] & MAX3110_BREAK && |
@@ -366,10 +362,8 @@ receive_chars(struct uart_max3110 *max, unsigned short *str, int len) | |||
366 | } | 362 | } |
367 | } | 363 | } |
368 | 364 | ||
369 | if (!w) { | 365 | if (!w) |
370 | tty_kref_put(tty); | ||
371 | return 0; | 366 | return 0; |
372 | } | ||
373 | 367 | ||
374 | for (r = 0; w; r += usable, w -= usable) { | 368 | for (r = 0; w; r += usable, w -= usable) { |
375 | usable = tty_buffer_request_room(tport, w); | 369 | usable = tty_buffer_request_room(tport, w); |
@@ -378,8 +372,7 @@ receive_chars(struct uart_max3110 *max, unsigned short *str, int len) | |||
378 | port->icount.rx += usable; | 372 | port->icount.rx += usable; |
379 | } | 373 | } |
380 | } | 374 | } |
381 | tty_flip_buffer_push(tty); | 375 | tty_flip_buffer_push(tport); |
382 | tty_kref_put(tty); | ||
383 | 376 | ||
384 | return r; | 377 | return r; |
385 | } | 378 | } |
diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c index cb787c0e279a..b11e99797fd8 100644 --- a/drivers/tty/serial/msm_serial.c +++ b/drivers/tty/serial/msm_serial.c | |||
@@ -92,7 +92,6 @@ static void msm_enable_ms(struct uart_port *port) | |||
92 | static void handle_rx_dm(struct uart_port *port, unsigned int misr) | 92 | static void handle_rx_dm(struct uart_port *port, unsigned int misr) |
93 | { | 93 | { |
94 | struct tty_port *tport = &port->state->port; | 94 | struct tty_port *tport = &port->state->port; |
95 | struct tty_struct *tty = tport->tty; | ||
96 | unsigned int sr; | 95 | unsigned int sr; |
97 | int count = 0; | 96 | int count = 0; |
98 | struct msm_port *msm_port = UART_TO_MSM(port); | 97 | struct msm_port *msm_port = UART_TO_MSM(port); |
@@ -138,7 +137,7 @@ static void handle_rx_dm(struct uart_port *port, unsigned int misr) | |||
138 | count -= 4; | 137 | count -= 4; |
139 | } | 138 | } |
140 | 139 | ||
141 | tty_flip_buffer_push(tty); | 140 | tty_flip_buffer_push(tport); |
142 | if (misr & (UART_IMR_RXSTALE)) | 141 | if (misr & (UART_IMR_RXSTALE)) |
143 | msm_write(port, UART_CR_CMD_RESET_STALE_INT, UART_CR); | 142 | msm_write(port, UART_CR_CMD_RESET_STALE_INT, UART_CR); |
144 | msm_write(port, 0xFFFFFF, UARTDM_DMRX); | 143 | msm_write(port, 0xFFFFFF, UARTDM_DMRX); |
@@ -148,7 +147,6 @@ static void handle_rx_dm(struct uart_port *port, unsigned int misr) | |||
148 | static void handle_rx(struct uart_port *port) | 147 | static void handle_rx(struct uart_port *port) |
149 | { | 148 | { |
150 | struct tty_port *tport = &port->state->port; | 149 | struct tty_port *tport = &port->state->port; |
151 | struct tty_struct *tty = tport->tty; | ||
152 | unsigned int sr; | 150 | unsigned int sr; |
153 | 151 | ||
154 | /* | 152 | /* |
@@ -191,7 +189,7 @@ static void handle_rx(struct uart_port *port) | |||
191 | tty_insert_flip_char(tport, c, flag); | 189 | tty_insert_flip_char(tport, c, flag); |
192 | } | 190 | } |
193 | 191 | ||
194 | tty_flip_buffer_push(tty); | 192 | tty_flip_buffer_push(tport); |
195 | } | 193 | } |
196 | 194 | ||
197 | static void reset_dm_count(struct uart_port *port) | 195 | static void reset_dm_count(struct uart_port *port) |
diff --git a/drivers/tty/serial/msm_serial_hs.c b/drivers/tty/serial/msm_serial_hs.c index c356ffff3c71..4a942c78347e 100644 --- a/drivers/tty/serial/msm_serial_hs.c +++ b/drivers/tty/serial/msm_serial_hs.c | |||
@@ -981,9 +981,8 @@ static void msm_hs_tty_flip_buffer_work(struct work_struct *work) | |||
981 | { | 981 | { |
982 | struct msm_hs_port *msm_uport = | 982 | struct msm_hs_port *msm_uport = |
983 | container_of(work, struct msm_hs_port, rx.tty_work); | 983 | container_of(work, struct msm_hs_port, rx.tty_work); |
984 | struct tty_struct *tty = msm_uport->uport.state->port.tty; | ||
985 | 984 | ||
986 | tty_flip_buffer_push(tty); | 985 | tty_flip_buffer_push(&msm_uport->uport.state->port); |
987 | } | 986 | } |
988 | 987 | ||
989 | /* | 988 | /* |
diff --git a/drivers/tty/serial/msm_smd_tty.c b/drivers/tty/serial/msm_smd_tty.c index b43b4ec39269..e722ff163d91 100644 --- a/drivers/tty/serial/msm_smd_tty.c +++ b/drivers/tty/serial/msm_smd_tty.c | |||
@@ -80,7 +80,7 @@ static void smd_tty_notify(void *priv, unsigned event) | |||
80 | pr_err("OOPS - smd_tty_buffer mismatch?!"); | 80 | pr_err("OOPS - smd_tty_buffer mismatch?!"); |
81 | } | 81 | } |
82 | 82 | ||
83 | tty_flip_buffer_push(tty); | 83 | tty_flip_buffer_push(&info->port); |
84 | } | 84 | } |
85 | 85 | ||
86 | /* XXX only when writable and necessary */ | 86 | /* XXX only when writable and necessary */ |
diff --git a/drivers/tty/serial/mux.c b/drivers/tty/serial/mux.c index 83b21686020e..7fd6aaaacd8e 100644 --- a/drivers/tty/serial/mux.c +++ b/drivers/tty/serial/mux.c | |||
@@ -244,7 +244,6 @@ static void mux_read(struct uart_port *port) | |||
244 | { | 244 | { |
245 | struct tty_port *tport = &port->state->port; | 245 | struct tty_port *tport = &port->state->port; |
246 | int data; | 246 | int data; |
247 | struct tty_struct *tty = tport->tty; | ||
248 | __u32 start_count = port->icount.rx; | 247 | __u32 start_count = port->icount.rx; |
249 | 248 | ||
250 | while(1) { | 249 | while(1) { |
@@ -270,9 +269,8 @@ static void mux_read(struct uart_port *port) | |||
270 | tty_insert_flip_char(tport, data & 0xFF, TTY_NORMAL); | 269 | tty_insert_flip_char(tport, data & 0xFF, TTY_NORMAL); |
271 | } | 270 | } |
272 | 271 | ||
273 | if (start_count != port->icount.rx) { | 272 | if (start_count != port->icount.rx) |
274 | tty_flip_buffer_push(tty); | 273 | tty_flip_buffer_push(tport); |
275 | } | ||
276 | } | 274 | } |
277 | 275 | ||
278 | /** | 276 | /** |
diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c index 37a0046ef531..df0ba32f88ad 100644 --- a/drivers/tty/serial/mxs-auart.c +++ b/drivers/tty/serial/mxs-auart.c | |||
@@ -364,7 +364,6 @@ out: | |||
364 | 364 | ||
365 | static void mxs_auart_rx_chars(struct mxs_auart_port *s) | 365 | static void mxs_auart_rx_chars(struct mxs_auart_port *s) |
366 | { | 366 | { |
367 | struct tty_struct *tty = s->port.state->port.tty; | ||
368 | u32 stat = 0; | 367 | u32 stat = 0; |
369 | 368 | ||
370 | for (;;) { | 369 | for (;;) { |
@@ -375,7 +374,7 @@ static void mxs_auart_rx_chars(struct mxs_auart_port *s) | |||
375 | } | 374 | } |
376 | 375 | ||
377 | writel(stat, s->port.membase + AUART_STAT); | 376 | writel(stat, s->port.membase + AUART_STAT); |
378 | tty_flip_buffer_push(tty); | 377 | tty_flip_buffer_push(&s->port.state->port); |
379 | } | 378 | } |
380 | 379 | ||
381 | static int mxs_auart_request_port(struct uart_port *u) | 380 | static int mxs_auart_request_port(struct uart_port *u) |
@@ -458,7 +457,6 @@ static void dma_rx_callback(void *arg) | |||
458 | { | 457 | { |
459 | struct mxs_auart_port *s = (struct mxs_auart_port *) arg; | 458 | struct mxs_auart_port *s = (struct mxs_auart_port *) arg; |
460 | struct tty_port *port = &s->port.state->port; | 459 | struct tty_port *port = &s->port.state->port; |
461 | struct tty_struct *tty = port->tty; | ||
462 | int count; | 460 | int count; |
463 | u32 stat; | 461 | u32 stat; |
464 | 462 | ||
@@ -472,7 +470,7 @@ static void dma_rx_callback(void *arg) | |||
472 | tty_insert_flip_string(port, s->rx_dma_buf, count); | 470 | tty_insert_flip_string(port, s->rx_dma_buf, count); |
473 | 471 | ||
474 | writel(stat, s->port.membase + AUART_STAT); | 472 | writel(stat, s->port.membase + AUART_STAT); |
475 | tty_flip_buffer_push(tty); | 473 | tty_flip_buffer_push(port); |
476 | 474 | ||
477 | /* start the next DMA for RX. */ | 475 | /* start the next DMA for RX. */ |
478 | mxs_auart_dma_prep_rx(s); | 476 | mxs_auart_dma_prep_rx(s); |
diff --git a/drivers/tty/serial/netx-serial.c b/drivers/tty/serial/netx-serial.c index d40da78e7c85..b9a40ed70be2 100644 --- a/drivers/tty/serial/netx-serial.c +++ b/drivers/tty/serial/netx-serial.c | |||
@@ -199,7 +199,6 @@ static void netx_txint(struct uart_port *port) | |||
199 | static void netx_rxint(struct uart_port *port) | 199 | static void netx_rxint(struct uart_port *port) |
200 | { | 200 | { |
201 | unsigned char rx, flg, status; | 201 | unsigned char rx, flg, status; |
202 | struct tty_struct *tty = port->state->port.tty; | ||
203 | 202 | ||
204 | while (!(readl(port->membase + UART_FR) & FR_RXFE)) { | 203 | while (!(readl(port->membase + UART_FR) & FR_RXFE)) { |
205 | rx = readl(port->membase + UART_DR); | 204 | rx = readl(port->membase + UART_DR); |
@@ -237,8 +236,7 @@ static void netx_rxint(struct uart_port *port) | |||
237 | uart_insert_char(port, status, SR_OE, rx, flg); | 236 | uart_insert_char(port, status, SR_OE, rx, flg); |
238 | } | 237 | } |
239 | 238 | ||
240 | tty_flip_buffer_push(tty); | 239 | tty_flip_buffer_push(&port->state->port); |
241 | return; | ||
242 | } | 240 | } |
243 | 241 | ||
244 | static irqreturn_t netx_int(int irq, void *dev_id) | 242 | static irqreturn_t netx_int(int irq, void *dev_id) |
diff --git a/drivers/tty/serial/nwpserial.c b/drivers/tty/serial/nwpserial.c index 10d64a3697fb..77287c54f331 100644 --- a/drivers/tty/serial/nwpserial.c +++ b/drivers/tty/serial/nwpserial.c | |||
@@ -129,7 +129,6 @@ static irqreturn_t nwpserial_interrupt(int irq, void *dev_id) | |||
129 | { | 129 | { |
130 | struct nwpserial_port *up = dev_id; | 130 | struct nwpserial_port *up = dev_id; |
131 | struct tty_port *port = &up->port.state->port; | 131 | struct tty_port *port = &up->port.state->port; |
132 | struct tty_struct *tty = port->tty; | ||
133 | irqreturn_t ret; | 132 | irqreturn_t ret; |
134 | unsigned int iir; | 133 | unsigned int iir; |
135 | unsigned char ch; | 134 | unsigned char ch; |
@@ -150,7 +149,7 @@ static irqreturn_t nwpserial_interrupt(int irq, void *dev_id) | |||
150 | tty_insert_flip_char(port, ch, TTY_NORMAL); | 149 | tty_insert_flip_char(port, ch, TTY_NORMAL); |
151 | } while (dcr_read(up->dcr_host, UART_LSR) & UART_LSR_DR); | 150 | } while (dcr_read(up->dcr_host, UART_LSR) & UART_LSR_DR); |
152 | 151 | ||
153 | tty_flip_buffer_push(tty); | 152 | tty_flip_buffer_push(port); |
154 | ret = IRQ_HANDLED; | 153 | ret = IRQ_HANDLED; |
155 | 154 | ||
156 | /* clear interrupt */ | 155 | /* clear interrupt */ |
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index ec90651d661a..6f3dbf740f05 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c | |||
@@ -483,7 +483,6 @@ static void serial_omap_rdi(struct uart_omap_port *up, unsigned int lsr) | |||
483 | static irqreturn_t serial_omap_irq(int irq, void *dev_id) | 483 | static irqreturn_t serial_omap_irq(int irq, void *dev_id) |
484 | { | 484 | { |
485 | struct uart_omap_port *up = dev_id; | 485 | struct uart_omap_port *up = dev_id; |
486 | struct tty_struct *tty = up->port.state->port.tty; | ||
487 | unsigned int iir, lsr; | 486 | unsigned int iir, lsr; |
488 | unsigned int type; | 487 | unsigned int type; |
489 | irqreturn_t ret = IRQ_NONE; | 488 | irqreturn_t ret = IRQ_NONE; |
@@ -530,7 +529,7 @@ static irqreturn_t serial_omap_irq(int irq, void *dev_id) | |||
530 | 529 | ||
531 | spin_unlock(&up->port.lock); | 530 | spin_unlock(&up->port.lock); |
532 | 531 | ||
533 | tty_flip_buffer_push(tty); | 532 | tty_flip_buffer_push(&up->port.state->port); |
534 | 533 | ||
535 | pm_runtime_mark_last_busy(up->dev); | 534 | pm_runtime_mark_last_busy(up->dev); |
536 | pm_runtime_put_autosuspend(up->dev); | 535 | pm_runtime_put_autosuspend(up->dev); |
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c index 967f1cb311f3..8b40a1fc9681 100644 --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c | |||
@@ -593,17 +593,9 @@ static int push_rx(struct eg20t_port *priv, const unsigned char *buf, | |||
593 | { | 593 | { |
594 | struct uart_port *port = &priv->port; | 594 | struct uart_port *port = &priv->port; |
595 | struct tty_port *tport = &port->state->port; | 595 | struct tty_port *tport = &port->state->port; |
596 | struct tty_struct *tty; | ||
597 | |||
598 | tty = tty_port_tty_get(tport); | ||
599 | if (!tty) { | ||
600 | dev_dbg(priv->port.dev, "%s:tty is busy now", __func__); | ||
601 | return -EBUSY; | ||
602 | } | ||
603 | 596 | ||
604 | tty_insert_flip_string(tport, buf, size); | 597 | tty_insert_flip_string(tport, buf, size); |
605 | tty_flip_buffer_push(tty); | 598 | tty_flip_buffer_push(tport); |
606 | tty_kref_put(tty); | ||
607 | 599 | ||
608 | return 0; | 600 | return 0; |
609 | } | 601 | } |
@@ -744,19 +736,12 @@ static void pch_dma_rx_complete(void *arg) | |||
744 | { | 736 | { |
745 | struct eg20t_port *priv = arg; | 737 | struct eg20t_port *priv = arg; |
746 | struct uart_port *port = &priv->port; | 738 | struct uart_port *port = &priv->port; |
747 | struct tty_struct *tty = tty_port_tty_get(&port->state->port); | ||
748 | int count; | 739 | int count; |
749 | 740 | ||
750 | if (!tty) { | ||
751 | dev_dbg(priv->port.dev, "%s:tty is busy now", __func__); | ||
752 | return; | ||
753 | } | ||
754 | |||
755 | dma_sync_sg_for_cpu(port->dev, &priv->sg_rx, 1, DMA_FROM_DEVICE); | 741 | dma_sync_sg_for_cpu(port->dev, &priv->sg_rx, 1, DMA_FROM_DEVICE); |
756 | count = dma_push_rx(priv, priv->trigger_level); | 742 | count = dma_push_rx(priv, priv->trigger_level); |
757 | if (count) | 743 | if (count) |
758 | tty_flip_buffer_push(tty); | 744 | tty_flip_buffer_push(&port->state->port); |
759 | tty_kref_put(tty); | ||
760 | async_tx_ack(priv->desc_rx); | 745 | async_tx_ack(priv->desc_rx); |
761 | pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_RX_INT | | 746 | pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_RX_INT | |
762 | PCH_UART_HAL_RX_ERR_INT); | 747 | PCH_UART_HAL_RX_ERR_INT); |
diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c index 73a3f295e7c4..b1785f58b6e3 100644 --- a/drivers/tty/serial/pmac_zilog.c +++ b/drivers/tty/serial/pmac_zilog.c | |||
@@ -227,21 +227,19 @@ static void pmz_interrupt_control(struct uart_pmac_port *uap, int enable) | |||
227 | write_zsreg(uap, R1, uap->curregs[1]); | 227 | write_zsreg(uap, R1, uap->curregs[1]); |
228 | } | 228 | } |
229 | 229 | ||
230 | static struct tty_struct *pmz_receive_chars(struct uart_pmac_port *uap) | 230 | static bool pmz_receive_chars(struct uart_pmac_port *uap) |
231 | { | 231 | { |
232 | struct tty_port *port; | 232 | struct tty_port *port; |
233 | struct tty_struct *tty = NULL; | ||
234 | unsigned char ch, r1, drop, error, flag; | 233 | unsigned char ch, r1, drop, error, flag; |
235 | int loops = 0; | 234 | int loops = 0; |
236 | 235 | ||
237 | /* Sanity check, make sure the old bug is no longer happening */ | 236 | /* Sanity check, make sure the old bug is no longer happening */ |
238 | if (uap->port.state == NULL || uap->port.state->port.tty == NULL) { | 237 | if (uap->port.state == NULL) { |
239 | WARN_ON(1); | 238 | WARN_ON(1); |
240 | (void)read_zsdata(uap); | 239 | (void)read_zsdata(uap); |
241 | return NULL; | 240 | return false; |
242 | } | 241 | } |
243 | port = &uap->port.state->port; | 242 | port = &uap->port.state->port; |
244 | tty = port->tty; /* TOCTOU above */ | ||
245 | 243 | ||
246 | while (1) { | 244 | while (1) { |
247 | error = 0; | 245 | error = 0; |
@@ -330,11 +328,11 @@ static struct tty_struct *pmz_receive_chars(struct uart_pmac_port *uap) | |||
330 | break; | 328 | break; |
331 | } | 329 | } |
332 | 330 | ||
333 | return tty; | 331 | return true; |
334 | flood: | 332 | flood: |
335 | pmz_interrupt_control(uap, 0); | 333 | pmz_interrupt_control(uap, 0); |
336 | pmz_error("pmz: rx irq flood !\n"); | 334 | pmz_error("pmz: rx irq flood !\n"); |
337 | return tty; | 335 | return true; |
338 | } | 336 | } |
339 | 337 | ||
340 | static void pmz_status_handle(struct uart_pmac_port *uap) | 338 | static void pmz_status_handle(struct uart_pmac_port *uap) |
@@ -455,7 +453,7 @@ static irqreturn_t pmz_interrupt(int irq, void *dev_id) | |||
455 | struct uart_pmac_port *uap_a; | 453 | struct uart_pmac_port *uap_a; |
456 | struct uart_pmac_port *uap_b; | 454 | struct uart_pmac_port *uap_b; |
457 | int rc = IRQ_NONE; | 455 | int rc = IRQ_NONE; |
458 | struct tty_struct *tty; | 456 | bool push; |
459 | u8 r3; | 457 | u8 r3; |
460 | 458 | ||
461 | uap_a = pmz_get_port_A(uap); | 459 | uap_a = pmz_get_port_A(uap); |
@@ -468,7 +466,7 @@ static irqreturn_t pmz_interrupt(int irq, void *dev_id) | |||
468 | pmz_debug("irq, r3: %x\n", r3); | 466 | pmz_debug("irq, r3: %x\n", r3); |
469 | #endif | 467 | #endif |
470 | /* Channel A */ | 468 | /* Channel A */ |
471 | tty = NULL; | 469 | push = false; |
472 | if (r3 & (CHAEXT | CHATxIP | CHARxIP)) { | 470 | if (r3 & (CHAEXT | CHATxIP | CHARxIP)) { |
473 | if (!ZS_IS_OPEN(uap_a)) { | 471 | if (!ZS_IS_OPEN(uap_a)) { |
474 | pmz_debug("ChanA interrupt while not open !\n"); | 472 | pmz_debug("ChanA interrupt while not open !\n"); |
@@ -479,21 +477,21 @@ static irqreturn_t pmz_interrupt(int irq, void *dev_id) | |||
479 | if (r3 & CHAEXT) | 477 | if (r3 & CHAEXT) |
480 | pmz_status_handle(uap_a); | 478 | pmz_status_handle(uap_a); |
481 | if (r3 & CHARxIP) | 479 | if (r3 & CHARxIP) |
482 | tty = pmz_receive_chars(uap_a); | 480 | push = pmz_receive_chars(uap_a); |
483 | if (r3 & CHATxIP) | 481 | if (r3 & CHATxIP) |
484 | pmz_transmit_chars(uap_a); | 482 | pmz_transmit_chars(uap_a); |
485 | rc = IRQ_HANDLED; | 483 | rc = IRQ_HANDLED; |
486 | } | 484 | } |
487 | skip_a: | 485 | skip_a: |
488 | spin_unlock(&uap_a->port.lock); | 486 | spin_unlock(&uap_a->port.lock); |
489 | if (tty != NULL) | 487 | if (push) |
490 | tty_flip_buffer_push(tty); | 488 | tty_flip_buffer_push(&uap->port.state->port); |
491 | 489 | ||
492 | if (!uap_b) | 490 | if (!uap_b) |
493 | goto out; | 491 | goto out; |
494 | 492 | ||
495 | spin_lock(&uap_b->port.lock); | 493 | spin_lock(&uap_b->port.lock); |
496 | tty = NULL; | 494 | push = false; |
497 | if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) { | 495 | if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) { |
498 | if (!ZS_IS_OPEN(uap_b)) { | 496 | if (!ZS_IS_OPEN(uap_b)) { |
499 | pmz_debug("ChanB interrupt while not open !\n"); | 497 | pmz_debug("ChanB interrupt while not open !\n"); |
@@ -504,15 +502,15 @@ static irqreturn_t pmz_interrupt(int irq, void *dev_id) | |||
504 | if (r3 & CHBEXT) | 502 | if (r3 & CHBEXT) |
505 | pmz_status_handle(uap_b); | 503 | pmz_status_handle(uap_b); |
506 | if (r3 & CHBRxIP) | 504 | if (r3 & CHBRxIP) |
507 | tty = pmz_receive_chars(uap_b); | 505 | push = pmz_receive_chars(uap_b); |
508 | if (r3 & CHBTxIP) | 506 | if (r3 & CHBTxIP) |
509 | pmz_transmit_chars(uap_b); | 507 | pmz_transmit_chars(uap_b); |
510 | rc = IRQ_HANDLED; | 508 | rc = IRQ_HANDLED; |
511 | } | 509 | } |
512 | skip_b: | 510 | skip_b: |
513 | spin_unlock(&uap_b->port.lock); | 511 | spin_unlock(&uap_b->port.lock); |
514 | if (tty != NULL) | 512 | if (push) |
515 | tty_flip_buffer_push(tty); | 513 | tty_flip_buffer_push(&uap->port.state->port); |
516 | 514 | ||
517 | out: | 515 | out: |
518 | return rc; | 516 | return rc; |
diff --git a/drivers/tty/serial/pnx8xxx_uart.c b/drivers/tty/serial/pnx8xxx_uart.c index 0aa75a97531c..7e277a5384a7 100644 --- a/drivers/tty/serial/pnx8xxx_uart.c +++ b/drivers/tty/serial/pnx8xxx_uart.c | |||
@@ -181,7 +181,6 @@ static void pnx8xxx_enable_ms(struct uart_port *port) | |||
181 | 181 | ||
182 | static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport) | 182 | static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport) |
183 | { | 183 | { |
184 | struct tty_struct *tty = sport->port.state->port.tty; | ||
185 | unsigned int status, ch, flg; | 184 | unsigned int status, ch, flg; |
186 | 185 | ||
187 | status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) | | 186 | status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) | |
@@ -238,7 +237,7 @@ static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport) | |||
238 | status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) | | 237 | status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) | |
239 | ISTAT_TO_SM(serial_in(sport, PNX8XXX_ISTAT)); | 238 | ISTAT_TO_SM(serial_in(sport, PNX8XXX_ISTAT)); |
240 | } | 239 | } |
241 | tty_flip_buffer_push(tty); | 240 | tty_flip_buffer_push(&sport->port.state->port); |
242 | } | 241 | } |
243 | 242 | ||
244 | static void pnx8xxx_tx_chars(struct pnx8xxx_port *sport) | 243 | static void pnx8xxx_tx_chars(struct pnx8xxx_port *sport) |
diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c index 2764828251f5..3b671bc3f966 100644 --- a/drivers/tty/serial/pxa.c +++ b/drivers/tty/serial/pxa.c | |||
@@ -98,7 +98,6 @@ static void serial_pxa_stop_rx(struct uart_port *port) | |||
98 | 98 | ||
99 | static inline void receive_chars(struct uart_pxa_port *up, int *status) | 99 | static inline void receive_chars(struct uart_pxa_port *up, int *status) |
100 | { | 100 | { |
101 | struct tty_struct *tty = up->port.state->port.tty; | ||
102 | unsigned int ch, flag; | 101 | unsigned int ch, flag; |
103 | int max_count = 256; | 102 | int max_count = 256; |
104 | 103 | ||
@@ -168,7 +167,7 @@ static inline void receive_chars(struct uart_pxa_port *up, int *status) | |||
168 | ignore_char: | 167 | ignore_char: |
169 | *status = serial_in(up, UART_LSR); | 168 | *status = serial_in(up, UART_LSR); |
170 | } while ((*status & UART_LSR_DR) && (max_count-- > 0)); | 169 | } while ((*status & UART_LSR_DR) && (max_count-- > 0)); |
171 | tty_flip_buffer_push(tty); | 170 | tty_flip_buffer_push(&up->port.state->port); |
172 | 171 | ||
173 | /* work around Errata #20 according to | 172 | /* work around Errata #20 according to |
174 | * Intel(R) PXA27x Processor Family | 173 | * Intel(R) PXA27x Processor Family |
diff --git a/drivers/tty/serial/sa1100.c b/drivers/tty/serial/sa1100.c index 5d4b9b449b4a..af6b3e3ad24d 100644 --- a/drivers/tty/serial/sa1100.c +++ b/drivers/tty/serial/sa1100.c | |||
@@ -188,7 +188,6 @@ static void sa1100_enable_ms(struct uart_port *port) | |||
188 | static void | 188 | static void |
189 | sa1100_rx_chars(struct sa1100_port *sport) | 189 | sa1100_rx_chars(struct sa1100_port *sport) |
190 | { | 190 | { |
191 | struct tty_struct *tty = sport->port.state->port.tty; | ||
192 | unsigned int status, ch, flg; | 191 | unsigned int status, ch, flg; |
193 | 192 | ||
194 | status = UTSR1_TO_SM(UART_GET_UTSR1(sport)) | | 193 | status = UTSR1_TO_SM(UART_GET_UTSR1(sport)) | |
@@ -233,7 +232,7 @@ sa1100_rx_chars(struct sa1100_port *sport) | |||
233 | status = UTSR1_TO_SM(UART_GET_UTSR1(sport)) | | 232 | status = UTSR1_TO_SM(UART_GET_UTSR1(sport)) | |
234 | UTSR0_TO_SM(UART_GET_UTSR0(sport)); | 233 | UTSR0_TO_SM(UART_GET_UTSR0(sport)); |
235 | } | 234 | } |
236 | tty_flip_buffer_push(tty); | 235 | tty_flip_buffer_push(&sport->port.state->port); |
237 | } | 236 | } |
238 | 237 | ||
239 | static void sa1100_tx_chars(struct sa1100_port *sport) | 238 | static void sa1100_tx_chars(struct sa1100_port *sport) |
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c index 0684529eb2ad..3aa3c4c83f8b 100644 --- a/drivers/tty/serial/samsung.c +++ b/drivers/tty/serial/samsung.c | |||
@@ -220,7 +220,6 @@ s3c24xx_serial_rx_chars(int irq, void *dev_id) | |||
220 | { | 220 | { |
221 | struct s3c24xx_uart_port *ourport = dev_id; | 221 | struct s3c24xx_uart_port *ourport = dev_id; |
222 | struct uart_port *port = &ourport->port; | 222 | struct uart_port *port = &ourport->port; |
223 | struct tty_struct *tty = port->state->port.tty; | ||
224 | unsigned int ufcon, ch, flag, ufstat, uerstat; | 223 | unsigned int ufcon, ch, flag, ufstat, uerstat; |
225 | unsigned long flags; | 224 | unsigned long flags; |
226 | int max_count = 64; | 225 | int max_count = 64; |
@@ -298,7 +297,7 @@ s3c24xx_serial_rx_chars(int irq, void *dev_id) | |||
298 | ignore_char: | 297 | ignore_char: |
299 | continue; | 298 | continue; |
300 | } | 299 | } |
301 | tty_flip_buffer_push(tty); | 300 | tty_flip_buffer_push(&port->state->port); |
302 | 301 | ||
303 | out: | 302 | out: |
304 | spin_unlock_irqrestore(&port->lock, flags); | 303 | spin_unlock_irqrestore(&port->lock, flags); |
diff --git a/drivers/tty/serial/sb1250-duart.c b/drivers/tty/serial/sb1250-duart.c index f76b1688c5c8..a7cdec2962dd 100644 --- a/drivers/tty/serial/sb1250-duart.c +++ b/drivers/tty/serial/sb1250-duart.c | |||
@@ -384,7 +384,7 @@ static void sbd_receive_chars(struct sbd_port *sport) | |||
384 | uart_insert_char(uport, status, M_DUART_OVRUN_ERR, ch, flag); | 384 | uart_insert_char(uport, status, M_DUART_OVRUN_ERR, ch, flag); |
385 | } | 385 | } |
386 | 386 | ||
387 | tty_flip_buffer_push(uport->state->port.tty); | 387 | tty_flip_buffer_push(&uport->state->port); |
388 | } | 388 | } |
389 | 389 | ||
390 | static void sbd_transmit_chars(struct sbd_port *sport) | 390 | static void sbd_transmit_chars(struct sbd_port *sport) |
diff --git a/drivers/tty/serial/sc26xx.c b/drivers/tty/serial/sc26xx.c index 0cd0e4ac12a6..c9735680762d 100644 --- a/drivers/tty/serial/sc26xx.c +++ b/drivers/tty/serial/sc26xx.c | |||
@@ -136,20 +136,17 @@ static void sc26xx_disable_irq(struct uart_port *port, int mask) | |||
136 | WRITE_SC(port, IMR, up->imr); | 136 | WRITE_SC(port, IMR, up->imr); |
137 | } | 137 | } |
138 | 138 | ||
139 | static struct tty_struct *receive_chars(struct uart_port *port) | 139 | static bool receive_chars(struct uart_port *port) |
140 | { | 140 | { |
141 | struct tty_port *tport = NULL; | 141 | struct tty_port *tport = NULL; |
142 | struct tty_struct *tty = NULL; | ||
143 | int limit = 10000; | 142 | int limit = 10000; |
144 | unsigned char ch; | 143 | unsigned char ch; |
145 | char flag; | 144 | char flag; |
146 | u8 status; | 145 | u8 status; |
147 | 146 | ||
148 | /* FIXME what is this trying to achieve? */ | 147 | /* FIXME what is this trying to achieve? */ |
149 | if (port->state != NULL) { /* Unopened serial console */ | 148 | if (port->state != NULL) /* Unopened serial console */ |
150 | tport = &port->state->port; | 149 | tport = &port->state->port; |
151 | tty = tport->tty; | ||
152 | } | ||
153 | 150 | ||
154 | while (limit-- > 0) { | 151 | while (limit-- > 0) { |
155 | status = READ_SC_PORT(port, SR); | 152 | status = READ_SC_PORT(port, SR); |
@@ -191,7 +188,7 @@ static struct tty_struct *receive_chars(struct uart_port *port) | |||
191 | 188 | ||
192 | tty_insert_flip_char(tport, ch, flag); | 189 | tty_insert_flip_char(tport, ch, flag); |
193 | } | 190 | } |
194 | return tty; | 191 | return !!tport; |
195 | } | 192 | } |
196 | 193 | ||
197 | static void transmit_chars(struct uart_port *port) | 194 | static void transmit_chars(struct uart_port *port) |
@@ -221,36 +218,36 @@ static void transmit_chars(struct uart_port *port) | |||
221 | static irqreturn_t sc26xx_interrupt(int irq, void *dev_id) | 218 | static irqreturn_t sc26xx_interrupt(int irq, void *dev_id) |
222 | { | 219 | { |
223 | struct uart_sc26xx_port *up = dev_id; | 220 | struct uart_sc26xx_port *up = dev_id; |
224 | struct tty_struct *tty; | ||
225 | unsigned long flags; | 221 | unsigned long flags; |
222 | bool push; | ||
226 | u8 isr; | 223 | u8 isr; |
227 | 224 | ||
228 | spin_lock_irqsave(&up->port[0].lock, flags); | 225 | spin_lock_irqsave(&up->port[0].lock, flags); |
229 | 226 | ||
230 | tty = NULL; | 227 | push = false; |
231 | isr = READ_SC(&up->port[0], ISR); | 228 | isr = READ_SC(&up->port[0], ISR); |
232 | if (isr & ISR_TXRDYA) | 229 | if (isr & ISR_TXRDYA) |
233 | transmit_chars(&up->port[0]); | 230 | transmit_chars(&up->port[0]); |
234 | if (isr & ISR_RXRDYA) | 231 | if (isr & ISR_RXRDYA) |
235 | tty = receive_chars(&up->port[0]); | 232 | push = receive_chars(&up->port[0]); |
236 | 233 | ||
237 | spin_unlock(&up->port[0].lock); | 234 | spin_unlock(&up->port[0].lock); |
238 | 235 | ||
239 | if (tty) | 236 | if (push) |
240 | tty_flip_buffer_push(tty); | 237 | tty_flip_buffer_push(&up->port[0].state->port); |
241 | 238 | ||
242 | spin_lock(&up->port[1].lock); | 239 | spin_lock(&up->port[1].lock); |
243 | 240 | ||
244 | tty = NULL; | 241 | push = false; |
245 | if (isr & ISR_TXRDYB) | 242 | if (isr & ISR_TXRDYB) |
246 | transmit_chars(&up->port[1]); | 243 | transmit_chars(&up->port[1]); |
247 | if (isr & ISR_RXRDYB) | 244 | if (isr & ISR_RXRDYB) |
248 | tty = receive_chars(&up->port[1]); | 245 | push = receive_chars(&up->port[1]); |
249 | 246 | ||
250 | spin_unlock_irqrestore(&up->port[1].lock, flags); | 247 | spin_unlock_irqrestore(&up->port[1].lock, flags); |
251 | 248 | ||
252 | if (tty) | 249 | if (push) |
253 | tty_flip_buffer_push(tty); | 250 | tty_flip_buffer_push(&up->port[1].state->port); |
254 | 251 | ||
255 | return IRQ_HANDLED; | 252 | return IRQ_HANDLED; |
256 | } | 253 | } |
diff --git a/drivers/tty/serial/sccnxp.c b/drivers/tty/serial/sccnxp.c index 418b495e3233..2ced871becff 100644 --- a/drivers/tty/serial/sccnxp.c +++ b/drivers/tty/serial/sccnxp.c | |||
@@ -285,10 +285,6 @@ static void sccnxp_handle_rx(struct uart_port *port) | |||
285 | { | 285 | { |
286 | u8 sr; | 286 | u8 sr; |
287 | unsigned int ch, flag; | 287 | unsigned int ch, flag; |
288 | struct tty_struct *tty = tty_port_tty_get(&port->state->port); | ||
289 | |||
290 | if (!tty) | ||
291 | return; | ||
292 | 288 | ||
293 | for (;;) { | 289 | for (;;) { |
294 | sr = sccnxp_port_read(port, SCCNXP_SR_REG); | 290 | sr = sccnxp_port_read(port, SCCNXP_SR_REG); |
@@ -333,9 +329,7 @@ static void sccnxp_handle_rx(struct uart_port *port) | |||
333 | uart_insert_char(port, sr, SR_OVR, ch, flag); | 329 | uart_insert_char(port, sr, SR_OVR, ch, flag); |
334 | } | 330 | } |
335 | 331 | ||
336 | tty_flip_buffer_push(tty); | 332 | tty_flip_buffer_push(&port->state->port); |
337 | |||
338 | tty_kref_put(tty); | ||
339 | } | 333 | } |
340 | 334 | ||
341 | static void sccnxp_handle_tx(struct uart_port *port) | 335 | static void sccnxp_handle_tx(struct uart_port *port) |
diff --git a/drivers/tty/serial/serial_ks8695.c b/drivers/tty/serial/serial_ks8695.c index 9bd004f9da89..e1caa99e3d3b 100644 --- a/drivers/tty/serial/serial_ks8695.c +++ b/drivers/tty/serial/serial_ks8695.c | |||
@@ -153,7 +153,6 @@ static void ks8695uart_disable_ms(struct uart_port *port) | |||
153 | static irqreturn_t ks8695uart_rx_chars(int irq, void *dev_id) | 153 | static irqreturn_t ks8695uart_rx_chars(int irq, void *dev_id) |
154 | { | 154 | { |
155 | struct uart_port *port = dev_id; | 155 | struct uart_port *port = dev_id; |
156 | struct tty_struct *tty = port->state->port.tty; | ||
157 | unsigned int status, ch, lsr, flg, max_count = 256; | 156 | unsigned int status, ch, lsr, flg, max_count = 256; |
158 | 157 | ||
159 | status = UART_GET_LSR(port); /* clears pending LSR interrupts */ | 158 | status = UART_GET_LSR(port); /* clears pending LSR interrupts */ |
@@ -200,7 +199,7 @@ static irqreturn_t ks8695uart_rx_chars(int irq, void *dev_id) | |||
200 | ignore_char: | 199 | ignore_char: |
201 | status = UART_GET_LSR(port); | 200 | status = UART_GET_LSR(port); |
202 | } | 201 | } |
203 | tty_flip_buffer_push(tty); | 202 | tty_flip_buffer_push(&port->state->port); |
204 | 203 | ||
205 | return IRQ_HANDLED; | 204 | return IRQ_HANDLED; |
206 | } | 205 | } |
diff --git a/drivers/tty/serial/serial_txx9.c b/drivers/tty/serial/serial_txx9.c index b52b21aeb250..fe48a0c2b4ca 100644 --- a/drivers/tty/serial/serial_txx9.c +++ b/drivers/tty/serial/serial_txx9.c | |||
@@ -277,7 +277,6 @@ static void serial_txx9_initialize(struct uart_port *port) | |||
277 | static inline void | 277 | static inline void |
278 | receive_chars(struct uart_txx9_port *up, unsigned int *status) | 278 | receive_chars(struct uart_txx9_port *up, unsigned int *status) |
279 | { | 279 | { |
280 | struct tty_struct *tty = up->port.state->port.tty; | ||
281 | unsigned char ch; | 280 | unsigned char ch; |
282 | unsigned int disr = *status; | 281 | unsigned int disr = *status; |
283 | int max_count = 256; | 282 | int max_count = 256; |
@@ -346,7 +345,7 @@ receive_chars(struct uart_txx9_port *up, unsigned int *status) | |||
346 | disr = sio_in(up, TXX9_SIDISR); | 345 | disr = sio_in(up, TXX9_SIDISR); |
347 | } while (!(disr & TXX9_SIDISR_UVALID) && (max_count-- > 0)); | 346 | } while (!(disr & TXX9_SIDISR_UVALID) && (max_count-- > 0)); |
348 | spin_unlock(&up->port.lock); | 347 | spin_unlock(&up->port.lock); |
349 | tty_flip_buffer_push(tty); | 348 | tty_flip_buffer_push(&up->port.state->port); |
350 | spin_lock(&up->port.lock); | 349 | spin_lock(&up->port.lock); |
351 | *status = disr; | 350 | *status = disr; |
352 | } | 351 | } |
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index ecef748f5385..156418619949 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c | |||
@@ -597,7 +597,6 @@ static void sci_receive_chars(struct uart_port *port) | |||
597 | { | 597 | { |
598 | struct sci_port *sci_port = to_sci_port(port); | 598 | struct sci_port *sci_port = to_sci_port(port); |
599 | struct tty_port *tport = &port->state->port; | 599 | struct tty_port *tport = &port->state->port; |
600 | struct tty_struct *tty = tport->tty; | ||
601 | int i, count, copied = 0; | 600 | int i, count, copied = 0; |
602 | unsigned short status; | 601 | unsigned short status; |
603 | unsigned char flag; | 602 | unsigned char flag; |
@@ -675,7 +674,7 @@ static void sci_receive_chars(struct uart_port *port) | |||
675 | 674 | ||
676 | if (copied) { | 675 | if (copied) { |
677 | /* Tell the rest of the system the news. New characters! */ | 676 | /* Tell the rest of the system the news. New characters! */ |
678 | tty_flip_buffer_push(tty); | 677 | tty_flip_buffer_push(tport); |
679 | } else { | 678 | } else { |
680 | serial_port_in(port, SCxSR); /* dummy read */ | 679 | serial_port_in(port, SCxSR); /* dummy read */ |
681 | serial_port_out(port, SCxSR, SCxSR_RDxF_CLEAR(port)); | 680 | serial_port_out(port, SCxSR, SCxSR_RDxF_CLEAR(port)); |
@@ -722,7 +721,6 @@ static int sci_handle_errors(struct uart_port *port) | |||
722 | int copied = 0; | 721 | int copied = 0; |
723 | unsigned short status = serial_port_in(port, SCxSR); | 722 | unsigned short status = serial_port_in(port, SCxSR); |
724 | struct tty_port *tport = &port->state->port; | 723 | struct tty_port *tport = &port->state->port; |
725 | struct tty_struct *tty = tport->tty; | ||
726 | struct sci_port *s = to_sci_port(port); | 724 | struct sci_port *s = to_sci_port(port); |
727 | 725 | ||
728 | /* | 726 | /* |
@@ -783,7 +781,7 @@ static int sci_handle_errors(struct uart_port *port) | |||
783 | } | 781 | } |
784 | 782 | ||
785 | if (copied) | 783 | if (copied) |
786 | tty_flip_buffer_push(tty); | 784 | tty_flip_buffer_push(tport); |
787 | 785 | ||
788 | return copied; | 786 | return copied; |
789 | } | 787 | } |
@@ -791,7 +789,6 @@ static int sci_handle_errors(struct uart_port *port) | |||
791 | static int sci_handle_fifo_overrun(struct uart_port *port) | 789 | static int sci_handle_fifo_overrun(struct uart_port *port) |
792 | { | 790 | { |
793 | struct tty_port *tport = &port->state->port; | 791 | struct tty_port *tport = &port->state->port; |
794 | struct tty_struct *tty = tport->tty; | ||
795 | struct sci_port *s = to_sci_port(port); | 792 | struct sci_port *s = to_sci_port(port); |
796 | struct plat_sci_reg *reg; | 793 | struct plat_sci_reg *reg; |
797 | int copied = 0; | 794 | int copied = 0; |
@@ -806,7 +803,7 @@ static int sci_handle_fifo_overrun(struct uart_port *port) | |||
806 | port->icount.overrun++; | 803 | port->icount.overrun++; |
807 | 804 | ||
808 | tty_insert_flip_char(tport, 0, TTY_OVERRUN); | 805 | tty_insert_flip_char(tport, 0, TTY_OVERRUN); |
809 | tty_flip_buffer_push(tty); | 806 | tty_flip_buffer_push(tport); |
810 | 807 | ||
811 | dev_notice(port->dev, "overrun error\n"); | 808 | dev_notice(port->dev, "overrun error\n"); |
812 | copied++; | 809 | copied++; |
@@ -820,7 +817,6 @@ static int sci_handle_breaks(struct uart_port *port) | |||
820 | int copied = 0; | 817 | int copied = 0; |
821 | unsigned short status = serial_port_in(port, SCxSR); | 818 | unsigned short status = serial_port_in(port, SCxSR); |
822 | struct tty_port *tport = &port->state->port; | 819 | struct tty_port *tport = &port->state->port; |
823 | struct tty_struct *tty = tport->tty; | ||
824 | struct sci_port *s = to_sci_port(port); | 820 | struct sci_port *s = to_sci_port(port); |
825 | 821 | ||
826 | if (uart_handle_break(port)) | 822 | if (uart_handle_break(port)) |
@@ -842,7 +838,7 @@ static int sci_handle_breaks(struct uart_port *port) | |||
842 | } | 838 | } |
843 | 839 | ||
844 | if (copied) | 840 | if (copied) |
845 | tty_flip_buffer_push(tty); | 841 | tty_flip_buffer_push(tport); |
846 | 842 | ||
847 | copied += sci_handle_fifo_overrun(port); | 843 | copied += sci_handle_fifo_overrun(port); |
848 | 844 | ||
@@ -1299,7 +1295,6 @@ static void sci_dma_rx_complete(void *arg) | |||
1299 | { | 1295 | { |
1300 | struct sci_port *s = arg; | 1296 | struct sci_port *s = arg; |
1301 | struct uart_port *port = &s->port; | 1297 | struct uart_port *port = &s->port; |
1302 | struct tty_struct *tty = port->state->port.tty; | ||
1303 | unsigned long flags; | 1298 | unsigned long flags; |
1304 | int count; | 1299 | int count; |
1305 | 1300 | ||
@@ -1314,7 +1309,7 @@ static void sci_dma_rx_complete(void *arg) | |||
1314 | spin_unlock_irqrestore(&port->lock, flags); | 1309 | spin_unlock_irqrestore(&port->lock, flags); |
1315 | 1310 | ||
1316 | if (count) | 1311 | if (count) |
1317 | tty_flip_buffer_push(tty); | 1312 | tty_flip_buffer_push(&port->state->port); |
1318 | 1313 | ||
1319 | schedule_work(&s->work_rx); | 1314 | schedule_work(&s->work_rx); |
1320 | } | 1315 | } |
@@ -1408,7 +1403,6 @@ static void work_fn_rx(struct work_struct *work) | |||
1408 | if (dma_async_is_tx_complete(s->chan_rx, s->active_rx, NULL, NULL) != | 1403 | if (dma_async_is_tx_complete(s->chan_rx, s->active_rx, NULL, NULL) != |
1409 | DMA_SUCCESS) { | 1404 | DMA_SUCCESS) { |
1410 | /* Handle incomplete DMA receive */ | 1405 | /* Handle incomplete DMA receive */ |
1411 | struct tty_struct *tty = port->state->port.tty; | ||
1412 | struct dma_chan *chan = s->chan_rx; | 1406 | struct dma_chan *chan = s->chan_rx; |
1413 | struct shdma_desc *sh_desc = container_of(desc, | 1407 | struct shdma_desc *sh_desc = container_of(desc, |
1414 | struct shdma_desc, async_tx); | 1408 | struct shdma_desc, async_tx); |
@@ -1424,7 +1418,7 @@ static void work_fn_rx(struct work_struct *work) | |||
1424 | spin_unlock_irqrestore(&port->lock, flags); | 1418 | spin_unlock_irqrestore(&port->lock, flags); |
1425 | 1419 | ||
1426 | if (count) | 1420 | if (count) |
1427 | tty_flip_buffer_push(tty); | 1421 | tty_flip_buffer_push(&port->state->port); |
1428 | 1422 | ||
1429 | sci_submit_rx(s); | 1423 | sci_submit_rx(s); |
1430 | 1424 | ||
diff --git a/drivers/tty/serial/sirfsoc_uart.c b/drivers/tty/serial/sirfsoc_uart.c index 142217cd01f4..8f3d6c091acc 100644 --- a/drivers/tty/serial/sirfsoc_uart.c +++ b/drivers/tty/serial/sirfsoc_uart.c | |||
@@ -206,11 +206,6 @@ static unsigned int | |||
206 | sirfsoc_uart_pio_rx_chars(struct uart_port *port, unsigned int max_rx_count) | 206 | sirfsoc_uart_pio_rx_chars(struct uart_port *port, unsigned int max_rx_count) |
207 | { | 207 | { |
208 | unsigned int ch, rx_count = 0; | 208 | unsigned int ch, rx_count = 0; |
209 | struct tty_struct *tty; | ||
210 | |||
211 | tty = tty_port_tty_get(&port->state->port); | ||
212 | if (!tty) | ||
213 | return -ENODEV; | ||
214 | 209 | ||
215 | while (!(rd_regl(port, SIRFUART_RX_FIFO_STATUS) & | 210 | while (!(rd_regl(port, SIRFUART_RX_FIFO_STATUS) & |
216 | SIRFUART_FIFOEMPTY_MASK(port))) { | 211 | SIRFUART_FIFOEMPTY_MASK(port))) { |
@@ -224,8 +219,7 @@ sirfsoc_uart_pio_rx_chars(struct uart_port *port, unsigned int max_rx_count) | |||
224 | } | 219 | } |
225 | 220 | ||
226 | port->icount.rx += rx_count; | 221 | port->icount.rx += rx_count; |
227 | tty_flip_buffer_push(tty); | 222 | tty_flip_buffer_push(&port->state->port); |
228 | tty_kref_put(tty); | ||
229 | 223 | ||
230 | return rx_count; | 224 | return rx_count; |
231 | } | 225 | } |
diff --git a/drivers/tty/serial/sn_console.c b/drivers/tty/serial/sn_console.c index 283232c64656..f51ffdc696fd 100644 --- a/drivers/tty/serial/sn_console.c +++ b/drivers/tty/serial/sn_console.c | |||
@@ -459,7 +459,6 @@ sn_receive_chars(struct sn_cons_port *port, unsigned long flags) | |||
459 | { | 459 | { |
460 | struct tty_port *tport = NULL; | 460 | struct tty_port *tport = NULL; |
461 | int ch; | 461 | int ch; |
462 | struct tty_struct *tty; | ||
463 | 462 | ||
464 | if (!port) { | 463 | if (!port) { |
465 | printk(KERN_ERR "sn_receive_chars - port NULL so can't receive\n"); | 464 | printk(KERN_ERR "sn_receive_chars - port NULL so can't receive\n"); |
@@ -474,11 +473,6 @@ sn_receive_chars(struct sn_cons_port *port, unsigned long flags) | |||
474 | if (port->sc_port.state) { | 473 | if (port->sc_port.state) { |
475 | /* The serial_core stuffs are initialized, use them */ | 474 | /* The serial_core stuffs are initialized, use them */ |
476 | tport = &port->sc_port.state->port; | 475 | tport = &port->sc_port.state->port; |
477 | tty = tport->tty; | ||
478 | } | ||
479 | else { | ||
480 | /* Not registered yet - can't pass to tty layer. */ | ||
481 | tty = NULL; | ||
482 | } | 476 | } |
483 | 477 | ||
484 | while (port->sc_ops->sal_input_pending()) { | 478 | while (port->sc_ops->sal_input_pending()) { |
@@ -518,15 +512,15 @@ sn_receive_chars(struct sn_cons_port *port, unsigned long flags) | |||
518 | #endif /* CONFIG_MAGIC_SYSRQ */ | 512 | #endif /* CONFIG_MAGIC_SYSRQ */ |
519 | 513 | ||
520 | /* record the character to pass up to the tty layer */ | 514 | /* record the character to pass up to the tty layer */ |
521 | if (tty) { | 515 | if (tport) { |
522 | if (tty_insert_flip_char(tport, ch, TTY_NORMAL) == 0) | 516 | if (tty_insert_flip_char(tport, ch, TTY_NORMAL) == 0) |
523 | break; | 517 | break; |
524 | } | 518 | } |
525 | port->sc_port.icount.rx++; | 519 | port->sc_port.icount.rx++; |
526 | } | 520 | } |
527 | 521 | ||
528 | if (tty) | 522 | if (tport) |
529 | tty_flip_buffer_push(tty); | 523 | tty_flip_buffer_push(tport); |
530 | } | 524 | } |
531 | 525 | ||
532 | /** | 526 | /** |
diff --git a/drivers/tty/serial/sunhv.c b/drivers/tty/serial/sunhv.c index defe92b19e16..ba60708053e0 100644 --- a/drivers/tty/serial/sunhv.c +++ b/drivers/tty/serial/sunhv.c | |||
@@ -181,17 +181,17 @@ static struct sunhv_ops bywrite_ops = { | |||
181 | 181 | ||
182 | static struct sunhv_ops *sunhv_ops = &bychar_ops; | 182 | static struct sunhv_ops *sunhv_ops = &bychar_ops; |
183 | 183 | ||
184 | static struct tty_struct *receive_chars(struct uart_port *port) | 184 | static struct tty_port *receive_chars(struct uart_port *port) |
185 | { | 185 | { |
186 | struct tty_struct *tty = NULL; | 186 | struct tty_port *tport = NULL; |
187 | 187 | ||
188 | if (port->state != NULL) /* Unopened serial console */ | 188 | if (port->state != NULL) /* Unopened serial console */ |
189 | tty = port->state->port.tty; | 189 | tport = &port->state->port; |
190 | 190 | ||
191 | if (sunhv_ops->receive_chars(port)) | 191 | if (sunhv_ops->receive_chars(port)) |
192 | sun_do_break(); | 192 | sun_do_break(); |
193 | 193 | ||
194 | return tty; | 194 | return tport; |
195 | } | 195 | } |
196 | 196 | ||
197 | static void transmit_chars(struct uart_port *port) | 197 | static void transmit_chars(struct uart_port *port) |
@@ -214,16 +214,16 @@ static void transmit_chars(struct uart_port *port) | |||
214 | static irqreturn_t sunhv_interrupt(int irq, void *dev_id) | 214 | static irqreturn_t sunhv_interrupt(int irq, void *dev_id) |
215 | { | 215 | { |
216 | struct uart_port *port = dev_id; | 216 | struct uart_port *port = dev_id; |
217 | struct tty_struct *tty; | 217 | struct tty_port *tport; |
218 | unsigned long flags; | 218 | unsigned long flags; |
219 | 219 | ||
220 | spin_lock_irqsave(&port->lock, flags); | 220 | spin_lock_irqsave(&port->lock, flags); |
221 | tty = receive_chars(port); | 221 | tport = receive_chars(port); |
222 | transmit_chars(port); | 222 | transmit_chars(port); |
223 | spin_unlock_irqrestore(&port->lock, flags); | 223 | spin_unlock_irqrestore(&port->lock, flags); |
224 | 224 | ||
225 | if (tty) | 225 | if (tport) |
226 | tty_flip_buffer_push(tty); | 226 | tty_flip_buffer_push(tport); |
227 | 227 | ||
228 | return IRQ_HANDLED; | 228 | return IRQ_HANDLED; |
229 | } | 229 | } |
diff --git a/drivers/tty/serial/sunsab.c b/drivers/tty/serial/sunsab.c index 4abc4d43a8e8..8de2213664e0 100644 --- a/drivers/tty/serial/sunsab.c +++ b/drivers/tty/serial/sunsab.c | |||
@@ -107,22 +107,19 @@ static __inline__ void sunsab_cec_wait(struct uart_sunsab_port *up) | |||
107 | udelay(1); | 107 | udelay(1); |
108 | } | 108 | } |
109 | 109 | ||
110 | static struct tty_struct * | 110 | static struct tty_port * |
111 | receive_chars(struct uart_sunsab_port *up, | 111 | receive_chars(struct uart_sunsab_port *up, |
112 | union sab82532_irq_status *stat) | 112 | union sab82532_irq_status *stat) |
113 | { | 113 | { |
114 | struct tty_port *port = NULL; | 114 | struct tty_port *port = NULL; |
115 | struct tty_struct *tty = NULL; | ||
116 | unsigned char buf[32]; | 115 | unsigned char buf[32]; |
117 | int saw_console_brk = 0; | 116 | int saw_console_brk = 0; |
118 | int free_fifo = 0; | 117 | int free_fifo = 0; |
119 | int count = 0; | 118 | int count = 0; |
120 | int i; | 119 | int i; |
121 | 120 | ||
122 | if (up->port.state != NULL) { /* Unopened serial console */ | 121 | if (up->port.state != NULL) /* Unopened serial console */ |
123 | port = &up->port.state->port; | 122 | port = &up->port.state->port; |
124 | tty = port->tty; | ||
125 | } | ||
126 | 123 | ||
127 | /* Read number of BYTES (Character + Status) available. */ | 124 | /* Read number of BYTES (Character + Status) available. */ |
128 | if (stat->sreg.isr0 & SAB82532_ISR0_RPF) { | 125 | if (stat->sreg.isr0 & SAB82532_ISR0_RPF) { |
@@ -139,7 +136,7 @@ receive_chars(struct uart_sunsab_port *up, | |||
139 | if (stat->sreg.isr0 & SAB82532_ISR0_TIME) { | 136 | if (stat->sreg.isr0 & SAB82532_ISR0_TIME) { |
140 | sunsab_cec_wait(up); | 137 | sunsab_cec_wait(up); |
141 | writeb(SAB82532_CMDR_RFRD, &up->regs->w.cmdr); | 138 | writeb(SAB82532_CMDR_RFRD, &up->regs->w.cmdr); |
142 | return tty; | 139 | return port; |
143 | } | 140 | } |
144 | 141 | ||
145 | if (stat->sreg.isr0 & SAB82532_ISR0_RFO) | 142 | if (stat->sreg.isr0 & SAB82532_ISR0_RFO) |
@@ -219,7 +216,7 @@ receive_chars(struct uart_sunsab_port *up, | |||
219 | if (saw_console_brk) | 216 | if (saw_console_brk) |
220 | sun_do_break(); | 217 | sun_do_break(); |
221 | 218 | ||
222 | return tty; | 219 | return port; |
223 | } | 220 | } |
224 | 221 | ||
225 | static void sunsab_stop_tx(struct uart_port *); | 222 | static void sunsab_stop_tx(struct uart_port *); |
@@ -302,7 +299,7 @@ static void check_status(struct uart_sunsab_port *up, | |||
302 | static irqreturn_t sunsab_interrupt(int irq, void *dev_id) | 299 | static irqreturn_t sunsab_interrupt(int irq, void *dev_id) |
303 | { | 300 | { |
304 | struct uart_sunsab_port *up = dev_id; | 301 | struct uart_sunsab_port *up = dev_id; |
305 | struct tty_struct *tty; | 302 | struct tty_port *port = NULL; |
306 | union sab82532_irq_status status; | 303 | union sab82532_irq_status status; |
307 | unsigned long flags; | 304 | unsigned long flags; |
308 | unsigned char gis; | 305 | unsigned char gis; |
@@ -316,12 +313,11 @@ static irqreturn_t sunsab_interrupt(int irq, void *dev_id) | |||
316 | if (gis & 2) | 313 | if (gis & 2) |
317 | status.sreg.isr1 = readb(&up->regs->r.isr1); | 314 | status.sreg.isr1 = readb(&up->regs->r.isr1); |
318 | 315 | ||
319 | tty = NULL; | ||
320 | if (status.stat) { | 316 | if (status.stat) { |
321 | if ((status.sreg.isr0 & (SAB82532_ISR0_TCD | SAB82532_ISR0_TIME | | 317 | if ((status.sreg.isr0 & (SAB82532_ISR0_TCD | SAB82532_ISR0_TIME | |
322 | SAB82532_ISR0_RFO | SAB82532_ISR0_RPF)) || | 318 | SAB82532_ISR0_RFO | SAB82532_ISR0_RPF)) || |
323 | (status.sreg.isr1 & SAB82532_ISR1_BRK)) | 319 | (status.sreg.isr1 & SAB82532_ISR1_BRK)) |
324 | tty = receive_chars(up, &status); | 320 | port = receive_chars(up, &status); |
325 | if ((status.sreg.isr0 & SAB82532_ISR0_CDSC) || | 321 | if ((status.sreg.isr0 & SAB82532_ISR0_CDSC) || |
326 | (status.sreg.isr1 & SAB82532_ISR1_CSC)) | 322 | (status.sreg.isr1 & SAB82532_ISR1_CSC)) |
327 | check_status(up, &status); | 323 | check_status(up, &status); |
@@ -331,8 +327,8 @@ static irqreturn_t sunsab_interrupt(int irq, void *dev_id) | |||
331 | 327 | ||
332 | spin_unlock_irqrestore(&up->port.lock, flags); | 328 | spin_unlock_irqrestore(&up->port.lock, flags); |
333 | 329 | ||
334 | if (tty) | 330 | if (port) |
335 | tty_flip_buffer_push(tty); | 331 | tty_flip_buffer_push(port); |
336 | 332 | ||
337 | return IRQ_HANDLED; | 333 | return IRQ_HANDLED; |
338 | } | 334 | } |
diff --git a/drivers/tty/serial/sunsu.c b/drivers/tty/serial/sunsu.c index 52325968b06c..e343d6670854 100644 --- a/drivers/tty/serial/sunsu.c +++ b/drivers/tty/serial/sunsu.c | |||
@@ -315,11 +315,10 @@ static void sunsu_enable_ms(struct uart_port *port) | |||
315 | spin_unlock_irqrestore(&up->port.lock, flags); | 315 | spin_unlock_irqrestore(&up->port.lock, flags); |
316 | } | 316 | } |
317 | 317 | ||
318 | static struct tty_struct * | 318 | static void |
319 | receive_chars(struct uart_sunsu_port *up, unsigned char *status) | 319 | receive_chars(struct uart_sunsu_port *up, unsigned char *status) |
320 | { | 320 | { |
321 | struct tty_port *port = &up->port.state->port; | 321 | struct tty_port *port = &up->port.state->port; |
322 | struct tty_struct *tty = port->tty; | ||
323 | unsigned char ch, flag; | 322 | unsigned char ch, flag; |
324 | int max_count = 256; | 323 | int max_count = 256; |
325 | int saw_console_brk = 0; | 324 | int saw_console_brk = 0; |
@@ -391,8 +390,6 @@ receive_chars(struct uart_sunsu_port *up, unsigned char *status) | |||
391 | 390 | ||
392 | if (saw_console_brk) | 391 | if (saw_console_brk) |
393 | sun_do_break(); | 392 | sun_do_break(); |
394 | |||
395 | return tty; | ||
396 | } | 393 | } |
397 | 394 | ||
398 | static void transmit_chars(struct uart_sunsu_port *up) | 395 | static void transmit_chars(struct uart_sunsu_port *up) |
@@ -461,20 +458,16 @@ static irqreturn_t sunsu_serial_interrupt(int irq, void *dev_id) | |||
461 | spin_lock_irqsave(&up->port.lock, flags); | 458 | spin_lock_irqsave(&up->port.lock, flags); |
462 | 459 | ||
463 | do { | 460 | do { |
464 | struct tty_struct *tty; | ||
465 | |||
466 | status = serial_inp(up, UART_LSR); | 461 | status = serial_inp(up, UART_LSR); |
467 | tty = NULL; | ||
468 | if (status & UART_LSR_DR) | 462 | if (status & UART_LSR_DR) |
469 | tty = receive_chars(up, &status); | 463 | receive_chars(up, &status); |
470 | check_modem_status(up); | 464 | check_modem_status(up); |
471 | if (status & UART_LSR_THRE) | 465 | if (status & UART_LSR_THRE) |
472 | transmit_chars(up); | 466 | transmit_chars(up); |
473 | 467 | ||
474 | spin_unlock_irqrestore(&up->port.lock, flags); | 468 | spin_unlock_irqrestore(&up->port.lock, flags); |
475 | 469 | ||
476 | if (tty) | 470 | tty_flip_buffer_push(&up->port.state->port); |
477 | tty_flip_buffer_push(tty); | ||
478 | 471 | ||
479 | spin_lock_irqsave(&up->port.lock, flags); | 472 | spin_lock_irqsave(&up->port.lock, flags); |
480 | 473 | ||
diff --git a/drivers/tty/serial/sunzilog.c b/drivers/tty/serial/sunzilog.c index 4a11be3849f6..27669ff3d446 100644 --- a/drivers/tty/serial/sunzilog.c +++ b/drivers/tty/serial/sunzilog.c | |||
@@ -323,19 +323,15 @@ static void sunzilog_kbdms_receive_chars(struct uart_sunzilog_port *up, | |||
323 | } | 323 | } |
324 | } | 324 | } |
325 | 325 | ||
326 | static struct tty_struct * | 326 | static struct tty_port * |
327 | sunzilog_receive_chars(struct uart_sunzilog_port *up, | 327 | sunzilog_receive_chars(struct uart_sunzilog_port *up, |
328 | struct zilog_channel __iomem *channel) | 328 | struct zilog_channel __iomem *channel) |
329 | { | 329 | { |
330 | struct tty_port *port = NULL; | 330 | struct tty_port *port = NULL; |
331 | struct tty_struct *tty; | ||
332 | unsigned char ch, r1, flag; | 331 | unsigned char ch, r1, flag; |
333 | 332 | ||
334 | tty = NULL; | 333 | if (up->port.state != NULL) /* Unopened serial console */ |
335 | if (up->port.state != NULL) { /* Unopened serial console */ | ||
336 | port = &up->port.state->port; | 334 | port = &up->port.state->port; |
337 | tty = port->tty; /* mouse => tty is NULL */ | ||
338 | } | ||
339 | 335 | ||
340 | for (;;) { | 336 | for (;;) { |
341 | 337 | ||
@@ -403,7 +399,7 @@ sunzilog_receive_chars(struct uart_sunzilog_port *up, | |||
403 | tty_insert_flip_char(port, 0, TTY_OVERRUN); | 399 | tty_insert_flip_char(port, 0, TTY_OVERRUN); |
404 | } | 400 | } |
405 | 401 | ||
406 | return tty; | 402 | return port; |
407 | } | 403 | } |
408 | 404 | ||
409 | static void sunzilog_status_handle(struct uart_sunzilog_port *up, | 405 | static void sunzilog_status_handle(struct uart_sunzilog_port *up, |
@@ -536,21 +532,21 @@ static irqreturn_t sunzilog_interrupt(int irq, void *dev_id) | |||
536 | while (up) { | 532 | while (up) { |
537 | struct zilog_channel __iomem *channel | 533 | struct zilog_channel __iomem *channel |
538 | = ZILOG_CHANNEL_FROM_PORT(&up->port); | 534 | = ZILOG_CHANNEL_FROM_PORT(&up->port); |
539 | struct tty_struct *tty; | 535 | struct tty_port *port; |
540 | unsigned char r3; | 536 | unsigned char r3; |
541 | 537 | ||
542 | spin_lock(&up->port.lock); | 538 | spin_lock(&up->port.lock); |
543 | r3 = read_zsreg(channel, R3); | 539 | r3 = read_zsreg(channel, R3); |
544 | 540 | ||
545 | /* Channel A */ | 541 | /* Channel A */ |
546 | tty = NULL; | 542 | port = NULL; |
547 | if (r3 & (CHAEXT | CHATxIP | CHARxIP)) { | 543 | if (r3 & (CHAEXT | CHATxIP | CHARxIP)) { |
548 | writeb(RES_H_IUS, &channel->control); | 544 | writeb(RES_H_IUS, &channel->control); |
549 | ZSDELAY(); | 545 | ZSDELAY(); |
550 | ZS_WSYNC(channel); | 546 | ZS_WSYNC(channel); |
551 | 547 | ||
552 | if (r3 & CHARxIP) | 548 | if (r3 & CHARxIP) |
553 | tty = sunzilog_receive_chars(up, channel); | 549 | port = sunzilog_receive_chars(up, channel); |
554 | if (r3 & CHAEXT) | 550 | if (r3 & CHAEXT) |
555 | sunzilog_status_handle(up, channel); | 551 | sunzilog_status_handle(up, channel); |
556 | if (r3 & CHATxIP) | 552 | if (r3 & CHATxIP) |
@@ -558,22 +554,22 @@ static irqreturn_t sunzilog_interrupt(int irq, void *dev_id) | |||
558 | } | 554 | } |
559 | spin_unlock(&up->port.lock); | 555 | spin_unlock(&up->port.lock); |
560 | 556 | ||
561 | if (tty) | 557 | if (port) |
562 | tty_flip_buffer_push(tty); | 558 | tty_flip_buffer_push(port); |
563 | 559 | ||
564 | /* Channel B */ | 560 | /* Channel B */ |
565 | up = up->next; | 561 | up = up->next; |
566 | channel = ZILOG_CHANNEL_FROM_PORT(&up->port); | 562 | channel = ZILOG_CHANNEL_FROM_PORT(&up->port); |
567 | 563 | ||
568 | spin_lock(&up->port.lock); | 564 | spin_lock(&up->port.lock); |
569 | tty = NULL; | 565 | port = NULL; |
570 | if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) { | 566 | if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) { |
571 | writeb(RES_H_IUS, &channel->control); | 567 | writeb(RES_H_IUS, &channel->control); |
572 | ZSDELAY(); | 568 | ZSDELAY(); |
573 | ZS_WSYNC(channel); | 569 | ZS_WSYNC(channel); |
574 | 570 | ||
575 | if (r3 & CHBRxIP) | 571 | if (r3 & CHBRxIP) |
576 | tty = sunzilog_receive_chars(up, channel); | 572 | port = sunzilog_receive_chars(up, channel); |
577 | if (r3 & CHBEXT) | 573 | if (r3 & CHBEXT) |
578 | sunzilog_status_handle(up, channel); | 574 | sunzilog_status_handle(up, channel); |
579 | if (r3 & CHBTxIP) | 575 | if (r3 & CHBTxIP) |
@@ -581,8 +577,8 @@ static irqreturn_t sunzilog_interrupt(int irq, void *dev_id) | |||
581 | } | 577 | } |
582 | spin_unlock(&up->port.lock); | 578 | spin_unlock(&up->port.lock); |
583 | 579 | ||
584 | if (tty) | 580 | if (port) |
585 | tty_flip_buffer_push(tty); | 581 | tty_flip_buffer_push(port); |
586 | 582 | ||
587 | up = up->next; | 583 | up = up->next; |
588 | } | 584 | } |
diff --git a/drivers/tty/serial/timbuart.c b/drivers/tty/serial/timbuart.c index f40c634f7528..6818410a2bea 100644 --- a/drivers/tty/serial/timbuart.c +++ b/drivers/tty/serial/timbuart.c | |||
@@ -100,7 +100,7 @@ static void timbuart_rx_chars(struct uart_port *port) | |||
100 | } | 100 | } |
101 | 101 | ||
102 | spin_unlock(&port->lock); | 102 | spin_unlock(&port->lock); |
103 | tty_flip_buffer_push(port->state->port.tty); | 103 | tty_flip_buffer_push(tport); |
104 | spin_lock(&port->lock); | 104 | spin_lock(&port->lock); |
105 | 105 | ||
106 | dev_dbg(port->dev, "%s - total read %d bytes\n", | 106 | dev_dbg(port->dev, "%s - total read %d bytes\n", |
diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c index 5caf1f0ebc82..5486505e87c7 100644 --- a/drivers/tty/serial/uartlite.c +++ b/drivers/tty/serial/uartlite.c | |||
@@ -156,7 +156,7 @@ static irqreturn_t ulite_isr(int irq, void *dev_id) | |||
156 | 156 | ||
157 | /* work done? */ | 157 | /* work done? */ |
158 | if (n > 1) { | 158 | if (n > 1) { |
159 | tty_flip_buffer_push(port->state->port.tty); | 159 | tty_flip_buffer_push(&port->state->port); |
160 | return IRQ_HANDLED; | 160 | return IRQ_HANDLED; |
161 | } else { | 161 | } else { |
162 | return IRQ_NONE; | 162 | return IRQ_NONE; |
diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c index 7a2378627fa5..7355303dad99 100644 --- a/drivers/tty/serial/ucc_uart.c +++ b/drivers/tty/serial/ucc_uart.c | |||
@@ -470,7 +470,6 @@ static void qe_uart_int_rx(struct uart_qe_port *qe_port) | |||
470 | unsigned char ch, *cp; | 470 | unsigned char ch, *cp; |
471 | struct uart_port *port = &qe_port->port; | 471 | struct uart_port *port = &qe_port->port; |
472 | struct tty_port *tport = &port->state->port; | 472 | struct tty_port *tport = &port->state->port; |
473 | struct tty_struct *tty = tport->tty; | ||
474 | struct qe_bd *bdp; | 473 | struct qe_bd *bdp; |
475 | u16 status; | 474 | u16 status; |
476 | unsigned int flg; | 475 | unsigned int flg; |
@@ -531,7 +530,7 @@ error_return: | |||
531 | qe_port->rx_cur = bdp; | 530 | qe_port->rx_cur = bdp; |
532 | 531 | ||
533 | /* Activate BH processing */ | 532 | /* Activate BH processing */ |
534 | tty_flip_buffer_push(tty); | 533 | tty_flip_buffer_push(tport); |
535 | 534 | ||
536 | return; | 535 | return; |
537 | 536 | ||
diff --git a/drivers/tty/serial/vr41xx_siu.c b/drivers/tty/serial/vr41xx_siu.c index 62ee0166bc65..f655997f44af 100644 --- a/drivers/tty/serial/vr41xx_siu.c +++ b/drivers/tty/serial/vr41xx_siu.c | |||
@@ -313,12 +313,10 @@ static void siu_break_ctl(struct uart_port *port, int ctl) | |||
313 | 313 | ||
314 | static inline void receive_chars(struct uart_port *port, uint8_t *status) | 314 | static inline void receive_chars(struct uart_port *port, uint8_t *status) |
315 | { | 315 | { |
316 | struct tty_struct *tty; | ||
317 | uint8_t lsr, ch; | 316 | uint8_t lsr, ch; |
318 | char flag; | 317 | char flag; |
319 | int max_count = RX_MAX_COUNT; | 318 | int max_count = RX_MAX_COUNT; |
320 | 319 | ||
321 | tty = port->state->port.tty; | ||
322 | lsr = *status; | 320 | lsr = *status; |
323 | 321 | ||
324 | do { | 322 | do { |
@@ -365,7 +363,7 @@ static inline void receive_chars(struct uart_port *port, uint8_t *status) | |||
365 | lsr = siu_read(port, UART_LSR); | 363 | lsr = siu_read(port, UART_LSR); |
366 | } while ((lsr & UART_LSR_DR) && (max_count-- > 0)); | 364 | } while ((lsr & UART_LSR_DR) && (max_count-- > 0)); |
367 | 365 | ||
368 | tty_flip_buffer_push(tty); | 366 | tty_flip_buffer_push(&port->state->port); |
369 | 367 | ||
370 | *status = lsr; | 368 | *status = lsr; |
371 | } | 369 | } |
diff --git a/drivers/tty/serial/vt8500_serial.c b/drivers/tty/serial/vt8500_serial.c index 7f4112423f3d..f1a398c672fa 100644 --- a/drivers/tty/serial/vt8500_serial.c +++ b/drivers/tty/serial/vt8500_serial.c | |||
@@ -137,15 +137,6 @@ static void vt8500_enable_ms(struct uart_port *port) | |||
137 | static void handle_rx(struct uart_port *port) | 137 | static void handle_rx(struct uart_port *port) |
138 | { | 138 | { |
139 | struct tty_port *tport = &port->state->port; | 139 | struct tty_port *tport = &port->state->port; |
140 | struct tty_struct *tty = tty_port_tty_get(tport); | ||
141 | if (!tty) { | ||
142 | /* Discard data: no tty available */ | ||
143 | int count = (vt8500_read(port, VT8500_URFIDX) & 0x1f00) >> 8; | ||
144 | u16 ch; | ||
145 | while (count--) | ||
146 | ch = readw(port->membase + VT8500_RXFIFO); | ||
147 | return; | ||
148 | } | ||
149 | 140 | ||
150 | /* | 141 | /* |
151 | * Handle overrun | 142 | * Handle overrun |
@@ -178,8 +169,7 @@ static void handle_rx(struct uart_port *port) | |||
178 | tty_insert_flip_char(tport, c, flag); | 169 | tty_insert_flip_char(tport, c, flag); |
179 | } | 170 | } |
180 | 171 | ||
181 | tty_flip_buffer_push(tty); | 172 | tty_flip_buffer_push(tport); |
182 | tty_kref_put(tty); | ||
183 | } | 173 | } |
184 | 174 | ||
185 | static void handle_tx(struct uart_port *port) | 175 | static void handle_tx(struct uart_port *port) |
diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 9ab910370c56..82a3151e393c 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c | |||
@@ -147,15 +147,11 @@ | |||
147 | static irqreturn_t xuartps_isr(int irq, void *dev_id) | 147 | static irqreturn_t xuartps_isr(int irq, void *dev_id) |
148 | { | 148 | { |
149 | struct uart_port *port = (struct uart_port *)dev_id; | 149 | struct uart_port *port = (struct uart_port *)dev_id; |
150 | struct tty_struct *tty; | ||
151 | unsigned long flags; | 150 | unsigned long flags; |
152 | unsigned int isrstatus, numbytes; | 151 | unsigned int isrstatus, numbytes; |
153 | unsigned int data; | 152 | unsigned int data; |
154 | char status = TTY_NORMAL; | 153 | char status = TTY_NORMAL; |
155 | 154 | ||
156 | /* Get the tty which could be NULL so don't assume it's valid */ | ||
157 | tty = tty_port_tty_get(&port->state->port); | ||
158 | |||
159 | spin_lock_irqsave(&port->lock, flags); | 155 | spin_lock_irqsave(&port->lock, flags); |
160 | 156 | ||
161 | /* Read the interrupt status register to determine which | 157 | /* Read the interrupt status register to determine which |
@@ -187,14 +183,11 @@ static irqreturn_t xuartps_isr(int irq, void *dev_id) | |||
187 | } else if (isrstatus & XUARTPS_IXR_OVERRUN) | 183 | } else if (isrstatus & XUARTPS_IXR_OVERRUN) |
188 | port->icount.overrun++; | 184 | port->icount.overrun++; |
189 | 185 | ||
190 | if (tty) | 186 | uart_insert_char(port, isrstatus, XUARTPS_IXR_OVERRUN, |
191 | uart_insert_char(port, isrstatus, | 187 | data, status); |
192 | XUARTPS_IXR_OVERRUN, data, | ||
193 | status); | ||
194 | } | 188 | } |
195 | spin_unlock(&port->lock); | 189 | spin_unlock(&port->lock); |
196 | if (tty) | 190 | tty_flip_buffer_push(&port->state->port); |
197 | tty_flip_buffer_push(tty); | ||
198 | spin_lock(&port->lock); | 191 | spin_lock(&port->lock); |
199 | } | 192 | } |
200 | 193 | ||
@@ -237,7 +230,6 @@ static irqreturn_t xuartps_isr(int irq, void *dev_id) | |||
237 | 230 | ||
238 | /* be sure to release the lock and tty before leaving */ | 231 | /* be sure to release the lock and tty before leaving */ |
239 | spin_unlock_irqrestore(&port->lock, flags); | 232 | spin_unlock_irqrestore(&port->lock, flags); |
240 | tty_kref_put(tty); | ||
241 | 233 | ||
242 | return IRQ_HANDLED; | 234 | return IRQ_HANDLED; |
243 | } | 235 | } |
diff --git a/drivers/tty/serial/zs.c b/drivers/tty/serial/zs.c index 92c00b24d0df..6a169877109b 100644 --- a/drivers/tty/serial/zs.c +++ b/drivers/tty/serial/zs.c | |||
@@ -603,7 +603,7 @@ static void zs_receive_chars(struct zs_port *zport) | |||
603 | uart_insert_char(uport, status, Rx_OVR, ch, flag); | 603 | uart_insert_char(uport, status, Rx_OVR, ch, flag); |
604 | } | 604 | } |
605 | 605 | ||
606 | tty_flip_buffer_push(uport->state->port.tty); | 606 | tty_flip_buffer_push(&uport->state->port); |
607 | } | 607 | } |
608 | 608 | ||
609 | static void zs_raw_transmit_chars(struct zs_port *zport) | 609 | static void zs_raw_transmit_chars(struct zs_port *zport) |
diff --git a/drivers/tty/synclink.c b/drivers/tty/synclink.c index 2f6967d61a80..555fdc0ed0f1 100644 --- a/drivers/tty/synclink.c +++ b/drivers/tty/synclink.c | |||
@@ -1439,7 +1439,6 @@ static void mgsl_isr_receive_data( struct mgsl_struct *info ) | |||
1439 | u16 status; | 1439 | u16 status; |
1440 | int work = 0; | 1440 | int work = 0; |
1441 | unsigned char DataByte; | 1441 | unsigned char DataByte; |
1442 | struct tty_struct *tty = info->port.tty; | ||
1443 | struct mgsl_icount *icount = &info->icount; | 1442 | struct mgsl_icount *icount = &info->icount; |
1444 | 1443 | ||
1445 | if ( debug_level >= DEBUG_LEVEL_ISR ) | 1444 | if ( debug_level >= DEBUG_LEVEL_ISR ) |
@@ -1501,7 +1500,7 @@ static void mgsl_isr_receive_data( struct mgsl_struct *info ) | |||
1501 | if (status & RXSTATUS_BREAK_RECEIVED) { | 1500 | if (status & RXSTATUS_BREAK_RECEIVED) { |
1502 | flag = TTY_BREAK; | 1501 | flag = TTY_BREAK; |
1503 | if (info->port.flags & ASYNC_SAK) | 1502 | if (info->port.flags & ASYNC_SAK) |
1504 | do_SAK(tty); | 1503 | do_SAK(info->port.tty); |
1505 | } else if (status & RXSTATUS_PARITY_ERROR) | 1504 | } else if (status & RXSTATUS_PARITY_ERROR) |
1506 | flag = TTY_PARITY; | 1505 | flag = TTY_PARITY; |
1507 | else if (status & RXSTATUS_FRAMING_ERROR) | 1506 | else if (status & RXSTATUS_FRAMING_ERROR) |
@@ -1524,7 +1523,7 @@ static void mgsl_isr_receive_data( struct mgsl_struct *info ) | |||
1524 | } | 1523 | } |
1525 | 1524 | ||
1526 | if(work) | 1525 | if(work) |
1527 | tty_flip_buffer_push(tty); | 1526 | tty_flip_buffer_push(&info->port); |
1528 | } | 1527 | } |
1529 | 1528 | ||
1530 | /* mgsl_isr_misc() | 1529 | /* mgsl_isr_misc() |
diff --git a/drivers/tty/synclink_gt.c b/drivers/tty/synclink_gt.c index 9a0358a1e0dd..fced6acc74ee 100644 --- a/drivers/tty/synclink_gt.c +++ b/drivers/tty/synclink_gt.c | |||
@@ -1854,7 +1854,6 @@ static void hdlcdev_exit(struct slgt_info *info) | |||
1854 | */ | 1854 | */ |
1855 | static void rx_async(struct slgt_info *info) | 1855 | static void rx_async(struct slgt_info *info) |
1856 | { | 1856 | { |
1857 | struct tty_struct *tty = info->port.tty; | ||
1858 | struct mgsl_icount *icount = &info->icount; | 1857 | struct mgsl_icount *icount = &info->icount; |
1859 | unsigned int start, end; | 1858 | unsigned int start, end; |
1860 | unsigned char *p; | 1859 | unsigned char *p; |
@@ -1915,8 +1914,8 @@ static void rx_async(struct slgt_info *info) | |||
1915 | break; | 1914 | break; |
1916 | } | 1915 | } |
1917 | 1916 | ||
1918 | if (tty && chars) | 1917 | if (chars) |
1919 | tty_flip_buffer_push(tty); | 1918 | tty_flip_buffer_push(&info->port); |
1920 | } | 1919 | } |
1921 | 1920 | ||
1922 | /* | 1921 | /* |
diff --git a/drivers/tty/synclinkmp.c b/drivers/tty/synclinkmp.c index 419f58ff4a13..e4a2904af565 100644 --- a/drivers/tty/synclinkmp.c +++ b/drivers/tty/synclinkmp.c | |||
@@ -2167,7 +2167,6 @@ static void isr_rxrdy(SLMP_INFO * info) | |||
2167 | { | 2167 | { |
2168 | u16 status; | 2168 | u16 status; |
2169 | unsigned char DataByte; | 2169 | unsigned char DataByte; |
2170 | struct tty_struct *tty = info->port.tty; | ||
2171 | struct mgsl_icount *icount = &info->icount; | 2170 | struct mgsl_icount *icount = &info->icount; |
2172 | 2171 | ||
2173 | if ( debug_level >= DEBUG_LEVEL_ISR ) | 2172 | if ( debug_level >= DEBUG_LEVEL_ISR ) |
@@ -2225,8 +2224,7 @@ static void isr_rxrdy(SLMP_INFO * info) | |||
2225 | icount->frame,icount->overrun); | 2224 | icount->frame,icount->overrun); |
2226 | } | 2225 | } |
2227 | 2226 | ||
2228 | if ( tty ) | 2227 | tty_flip_buffer_push(&info->port); |
2229 | tty_flip_buffer_push(tty); | ||
2230 | } | 2228 | } |
2231 | 2229 | ||
2232 | static void isr_txeom(SLMP_INFO * info, unsigned char status) | 2230 | static void isr_txeom(SLMP_INFO * info, unsigned char status) |
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index 1bfe97a8e2eb..b6efacadf23b 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c | |||
@@ -544,7 +544,7 @@ void tty_flush_to_ldisc(struct tty_struct *tty) | |||
544 | 544 | ||
545 | /** | 545 | /** |
546 | * tty_flip_buffer_push - terminal | 546 | * tty_flip_buffer_push - terminal |
547 | * @tty: tty to push | 547 | * @port: tty port to push |
548 | * | 548 | * |
549 | * Queue a push of the terminal flip buffers to the line discipline. This | 549 | * Queue a push of the terminal flip buffers to the line discipline. This |
550 | * function must not be called from IRQ context if port->low_latency is | 550 | * function must not be called from IRQ context if port->low_latency is |
@@ -556,9 +556,9 @@ void tty_flush_to_ldisc(struct tty_struct *tty) | |||
556 | * Locking: tty buffer lock. Driver locks in low latency mode. | 556 | * Locking: tty buffer lock. Driver locks in low latency mode. |
557 | */ | 557 | */ |
558 | 558 | ||
559 | void tty_flip_buffer_push(struct tty_struct *tty) | 559 | void tty_flip_buffer_push(struct tty_port *port) |
560 | { | 560 | { |
561 | struct tty_bufhead *buf = &tty->port->buf; | 561 | struct tty_bufhead *buf = &port->buf; |
562 | unsigned long flags; | 562 | unsigned long flags; |
563 | 563 | ||
564 | spin_lock_irqsave(&buf->lock, flags); | 564 | spin_lock_irqsave(&buf->lock, flags); |
@@ -566,7 +566,7 @@ void tty_flip_buffer_push(struct tty_struct *tty) | |||
566 | buf->tail->commit = buf->tail->used; | 566 | buf->tail->commit = buf->tail->used; |
567 | spin_unlock_irqrestore(&buf->lock, flags); | 567 | spin_unlock_irqrestore(&buf->lock, flags); |
568 | 568 | ||
569 | if (tty->port->low_latency) | 569 | if (port->low_latency) |
570 | flush_to_ldisc(&buf->work); | 570 | flush_to_ldisc(&buf->work); |
571 | else | 571 | else |
572 | schedule_work(&buf->work); | 572 | schedule_work(&buf->work); |