Commit d6c53c0e9bd0a83f9f9ddbc9fd80141a54d83896
Committed by
Greg Kroah-Hartman
1 parent
05c7cd3990
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
TTY: move low_latency to tty_port
One point is to have less places where we actually need tty pointer. The other is that low_latency is bound to buffer processing and buffers are now in tty_port. So it makes sense to move low_latency to tty_port too. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing 29 changed files with 42 additions and 41 deletions Side-by-side Diff
- arch/ia64/hp/sim/simserial.c
- arch/mn10300/kernel/mn10300-serial.c
- drivers/char/pcmcia/synclink_cs.c
- drivers/isdn/gigaset/interface.c
- drivers/net/caif/caif_serial.c
- drivers/net/irda/irtty-sir.c
- drivers/s390/char/con3215.c
- drivers/s390/char/sclp_tty.c
- drivers/s390/char/sclp_vt220.c
- drivers/s390/char/tty3270.c
- drivers/tty/amiserial.c
- drivers/tty/ipwireless/tty.c
- drivers/tty/mxser.c
- drivers/tty/serial/cpm_uart/cpm_uart_core.c
- drivers/tty/serial/crisv10.c
- drivers/tty/serial/ifx6x60.c
- drivers/tty/serial/ioc3_serial.c
- drivers/tty/serial/ioc4_serial.c
- drivers/tty/serial/max3100.c
- drivers/tty/serial/mpsc.c
- drivers/tty/serial/mrst_max3110.c
- drivers/tty/serial/msm_serial_hs.c
- drivers/tty/serial/serial_core.c
- drivers/tty/synclink.c
- drivers/tty/synclink_gt.c
- drivers/tty/synclinkmp.c
- drivers/tty/tty_buffer.c
- include/linux/tty.h
- net/irda/ircomm/ircomm_tty.c
arch/ia64/hp/sim/simserial.c
... | ... | @@ -436,7 +436,7 @@ |
436 | 436 | struct tty_port *port = &info->port; |
437 | 437 | |
438 | 438 | tty->driver_data = info; |
439 | - tty->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | |
439 | + port->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | |
440 | 440 | |
441 | 441 | /* |
442 | 442 | * figure out which console to use (should be one already) |
arch/mn10300/kernel/mn10300-serial.c
... | ... | @@ -537,7 +537,7 @@ |
537 | 537 | count = CIRC_CNT(port->rx_inp, port->rx_outp, MNSC_BUFFER_SIZE); |
538 | 538 | count = tty_buffer_request_room(port, count); |
539 | 539 | if (count == 0) { |
540 | - if (!tty->low_latency) | |
540 | + if (!port->low_latency) | |
541 | 541 | tty_flip_buffer_push(tty); |
542 | 542 | return; |
543 | 543 | } |
... | ... | @@ -546,7 +546,7 @@ |
546 | 546 | /* pull chars out of the hat */ |
547 | 547 | ix = ACCESS_ONCE(port->rx_outp); |
548 | 548 | if (CIRC_CNT(port->rx_inp, ix, MNSC_BUFFER_SIZE) == 0) { |
549 | - if (push && !tty->low_latency) | |
549 | + if (push && !port->low_latency) | |
550 | 550 | tty_flip_buffer_push(tty); |
551 | 551 | return; |
552 | 552 | } |
... | ... | @@ -678,7 +678,7 @@ |
678 | 678 | |
679 | 679 | count--; |
680 | 680 | if (count <= 0) { |
681 | - if (!tty->low_latency) | |
681 | + if (!port->low_latency) | |
682 | 682 | tty_flip_buffer_push(tty); |
683 | 683 | return; |
684 | 684 | } |
drivers/char/pcmcia/synclink_cs.c
... | ... | @@ -2522,7 +2522,7 @@ |
2522 | 2522 | goto cleanup; |
2523 | 2523 | } |
2524 | 2524 | |
2525 | - tty->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | |
2525 | + port->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | |
2526 | 2526 | |
2527 | 2527 | spin_lock_irqsave(&info->netlock, flags); |
2528 | 2528 | if (info->netcount) { |
drivers/isdn/gigaset/interface.c
drivers/net/caif/caif_serial.c
... | ... | @@ -91,7 +91,7 @@ |
91 | 91 | ser->tty->hw_stopped << 4 | |
92 | 92 | ser->tty->flow_stopped << 3 | |
93 | 93 | ser->tty->packet << 2 | |
94 | - ser->tty->low_latency << 1 | | |
94 | + ser->tty->port->low_latency << 1 | | |
95 | 95 | ser->tty->warned; |
96 | 96 | } |
97 | 97 | static inline void debugfs_init(struct ser_device *ser, struct tty_struct *tty) |
drivers/net/irda/irtty-sir.c
... | ... | @@ -210,7 +210,7 @@ |
210 | 210 | * been received, which can now be decapsulated and delivered for |
211 | 211 | * further processing |
212 | 212 | * |
213 | - * calling context depends on underlying driver and tty->low_latency! | |
213 | + * calling context depends on underlying driver and tty->port->low_latency! | |
214 | 214 | * for example (low_latency: 1 / 0): |
215 | 215 | * serial.c: uart-interrupt / softint |
216 | 216 | * usbserial: urb-complete-interrupt / softint |
drivers/s390/char/con3215.c
drivers/s390/char/sclp_tty.c
drivers/s390/char/sclp_vt220.c
... | ... | @@ -495,7 +495,7 @@ |
495 | 495 | { |
496 | 496 | if (tty->count == 1) { |
497 | 497 | tty_port_tty_set(&sclp_vt220_port, tty); |
498 | - tty->low_latency = 0; | |
498 | + sclp_vt220_port.low_latency = 0; | |
499 | 499 | if (!tty->winsize.ws_row && !tty->winsize.ws_col) { |
500 | 500 | tty->winsize.ws_row = 24; |
501 | 501 | tty->winsize.ws_col = 80; |
drivers/s390/char/tty3270.c
... | ... | @@ -860,7 +860,7 @@ |
860 | 860 | tty->driver_data = tp; |
861 | 861 | tty->winsize.ws_row = tp->view.rows - 2; |
862 | 862 | tty->winsize.ws_col = tp->view.cols; |
863 | - tty->low_latency = 0; | |
863 | + tp->port.low_latency = 0; | |
864 | 864 | /* why to reassign? */ |
865 | 865 | tty_port_tty_set(&tp->port, tty); |
866 | 866 | tp->inattr = TF_INPUT; |
... | ... | @@ -893,7 +893,7 @@ |
893 | 893 | } |
894 | 894 | |
895 | 895 | tty_port_tty_set(&tp->port, tty); |
896 | - tty->low_latency = 0; | |
896 | + tp->port.low_latency = 0; | |
897 | 897 | tty->winsize.ws_row = tp->view.rows - 2; |
898 | 898 | tty->winsize.ws_col = tp->view.cols; |
899 | 899 |
drivers/tty/amiserial.c
... | ... | @@ -1099,7 +1099,7 @@ |
1099 | 1099 | state->custom_divisor = new_serial.custom_divisor; |
1100 | 1100 | port->close_delay = new_serial.close_delay * HZ/100; |
1101 | 1101 | port->closing_wait = new_serial.closing_wait * HZ/100; |
1102 | - tty->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | |
1102 | + port->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | |
1103 | 1103 | |
1104 | 1104 | check_and_exit: |
1105 | 1105 | if (port->flags & ASYNC_INITIALIZED) { |
... | ... | @@ -1528,7 +1528,7 @@ |
1528 | 1528 | if (serial_paranoia_check(info, tty->name, "rs_open")) |
1529 | 1529 | return -ENODEV; |
1530 | 1530 | |
1531 | - tty->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | |
1531 | + port->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | |
1532 | 1532 | |
1533 | 1533 | retval = startup(tty, info); |
1534 | 1534 | if (retval) { |
drivers/tty/ipwireless/tty.c
drivers/tty/mxser.c
... | ... | @@ -1264,7 +1264,7 @@ |
1264 | 1264 | (new_serial.flags & ASYNC_FLAGS)); |
1265 | 1265 | port->close_delay = new_serial.close_delay * HZ / 100; |
1266 | 1266 | port->closing_wait = new_serial.closing_wait * HZ / 100; |
1267 | - tty->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | |
1267 | + port->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | |
1268 | 1268 | if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST && |
1269 | 1269 | (new_serial.baud_base != info->baud_base || |
1270 | 1270 | new_serial.custom_divisor != |
drivers/tty/serial/cpm_uart/cpm_uart_core.c
... | ... | @@ -508,7 +508,7 @@ |
508 | 508 | |
509 | 509 | baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk / 16); |
510 | 510 | if (baud < HW_BUF_SPD_THRESHOLD || |
511 | - (pinfo->port.state && pinfo->port.state->port.tty->low_latency)) | |
511 | + (pinfo->port.state && pinfo->port.state->port.low_latency)) | |
512 | 512 | pinfo->rx_fifosize = 1; |
513 | 513 | else |
514 | 514 | pinfo->rx_fifosize = RX_BUF_SIZE; |
drivers/tty/serial/crisv10.c
... | ... | @@ -3462,7 +3462,7 @@ |
3462 | 3462 | info->type = new_serial.type; |
3463 | 3463 | info->close_delay = new_serial.close_delay; |
3464 | 3464 | info->closing_wait = new_serial.closing_wait; |
3465 | - info->port.tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | |
3465 | + info->port.low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | |
3466 | 3466 | |
3467 | 3467 | check_and_exit: |
3468 | 3468 | if (info->flags & ASYNC_INITIALIZED) { |
... | ... | @@ -4106,7 +4106,7 @@ |
4106 | 4106 | tty->driver_data = info; |
4107 | 4107 | info->port.tty = tty; |
4108 | 4108 | |
4109 | - tty->low_latency = !!(info->flags & ASYNC_LOW_LATENCY); | |
4109 | + info->port.low_latency = !!(info->flags & ASYNC_LOW_LATENCY); | |
4110 | 4110 | |
4111 | 4111 | /* |
4112 | 4112 | * If the port is in the middle of closing, bail out now |
drivers/tty/serial/ifx6x60.c
... | ... | @@ -615,7 +615,7 @@ |
615 | 615 | tty->driver_data = ifx_dev; |
616 | 616 | |
617 | 617 | /* allows flip string push from int context */ |
618 | - tty->low_latency = 1; | |
618 | + port->low_latency = 1; | |
619 | 619 | |
620 | 620 | /* set flag to allows data transfer */ |
621 | 621 | set_bit(IFX_SPI_STATE_IO_AVAILABLE, &ifx_dev->flags); |
drivers/tty/serial/ioc3_serial.c
drivers/tty/serial/ioc4_serial.c
drivers/tty/serial/max3100.c
drivers/tty/serial/mpsc.c
... | ... | @@ -970,7 +970,7 @@ |
970 | 970 | #endif |
971 | 971 | /* Following use of tty struct directly is deprecated */ |
972 | 972 | if (tty_buffer_request_room(port, bytes_in) < bytes_in) { |
973 | - if (tty->low_latency) | |
973 | + if (port->low_latency) | |
974 | 974 | tty_flip_buffer_push(tty); |
975 | 975 | /* |
976 | 976 | * If this failed then we will throw away the bytes |
drivers/tty/serial/mrst_max3110.c
drivers/tty/serial/msm_serial_hs.c
... | ... | @@ -1400,7 +1400,7 @@ |
1400 | 1400 | |
1401 | 1401 | /* do not let tty layer execute RX in global workqueue, use a |
1402 | 1402 | * dedicated workqueue managed by this driver */ |
1403 | - uport->state->port.tty->low_latency = 1; | |
1403 | + uport->state->port.low_latency = 1; | |
1404 | 1404 | |
1405 | 1405 | /* turn on uart clk */ |
1406 | 1406 | ret = msm_hs_init_clk_locked(uport); |
drivers/tty/serial/serial_core.c
... | ... | @@ -867,9 +867,7 @@ |
867 | 867 | port->closing_wait = closing_wait; |
868 | 868 | if (new_info->xmit_fifo_size) |
869 | 869 | uport->fifosize = new_info->xmit_fifo_size; |
870 | - if (port->tty) | |
871 | - port->tty->low_latency = | |
872 | - (uport->flags & UPF_LOW_LATENCY) ? 1 : 0; | |
870 | + port->low_latency = (uport->flags & UPF_LOW_LATENCY) ? 1 : 0; | |
873 | 871 | |
874 | 872 | check_and_exit: |
875 | 873 | retval = 0; |
... | ... | @@ -1565,7 +1563,8 @@ |
1565 | 1563 | */ |
1566 | 1564 | tty->driver_data = state; |
1567 | 1565 | state->uart_port->state = state; |
1568 | - tty->low_latency = (state->uart_port->flags & UPF_LOW_LATENCY) ? 1 : 0; | |
1566 | + state->port.low_latency = | |
1567 | + (state->uart_port->flags & UPF_LOW_LATENCY) ? 1 : 0; | |
1569 | 1568 | tty_port_tty_set(port, tty); |
1570 | 1569 | |
1571 | 1570 | /* |
drivers/tty/synclink.c
... | ... | @@ -3415,7 +3415,7 @@ |
3415 | 3415 | goto cleanup; |
3416 | 3416 | } |
3417 | 3417 | |
3418 | - info->port.tty->low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0; | |
3418 | + info->port.low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0; | |
3419 | 3419 | |
3420 | 3420 | spin_lock_irqsave(&info->netlock, flags); |
3421 | 3421 | if (info->netcount) { |
drivers/tty/synclink_gt.c
... | ... | @@ -682,7 +682,7 @@ |
682 | 682 | } |
683 | 683 | |
684 | 684 | mutex_lock(&info->port.mutex); |
685 | - info->port.tty->low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0; | |
685 | + info->port.low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0; | |
686 | 686 | |
687 | 687 | spin_lock_irqsave(&info->netlock, flags); |
688 | 688 | if (info->netcount) { |
drivers/tty/synclinkmp.c
... | ... | @@ -761,7 +761,7 @@ |
761 | 761 | goto cleanup; |
762 | 762 | } |
763 | 763 | |
764 | - info->port.tty->low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0; | |
764 | + info->port.low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0; | |
765 | 765 | |
766 | 766 | spin_lock_irqsave(&info->netlock, flags); |
767 | 767 | if (info->netcount) { |
drivers/tty/tty_buffer.c
... | ... | @@ -364,7 +364,7 @@ |
364 | 364 | { |
365 | 365 | struct tty_bufhead *buf = &tty->port->buf; |
366 | 366 | unsigned long flags; |
367 | - WARN_ON(tty->low_latency); | |
367 | + WARN_ON(tty->port->low_latency); | |
368 | 368 | |
369 | 369 | spin_lock_irqsave(&buf->lock, flags); |
370 | 370 | if (buf->tail != NULL) |
... | ... | @@ -538,7 +538,7 @@ |
538 | 538 | */ |
539 | 539 | void tty_flush_to_ldisc(struct tty_struct *tty) |
540 | 540 | { |
541 | - if (!tty->low_latency) | |
541 | + if (!tty->port->low_latency) | |
542 | 542 | flush_work(&tty->port->buf.work); |
543 | 543 | } |
544 | 544 | |
... | ... | @@ -547,7 +547,8 @@ |
547 | 547 | * @tty: tty to push |
548 | 548 | * |
549 | 549 | * Queue a push of the terminal flip buffers to the line discipline. This |
550 | - * function must not be called from IRQ context if tty->low_latency is set. | |
550 | + * function must not be called from IRQ context if port->low_latency is | |
551 | + * set. | |
551 | 552 | * |
552 | 553 | * In the event of the queue being busy for flipping the work will be |
553 | 554 | * held off and retried later. |
... | ... | @@ -565,7 +566,7 @@ |
565 | 566 | buf->tail->commit = buf->tail->used; |
566 | 567 | spin_unlock_irqrestore(&buf->lock, flags); |
567 | 568 | |
568 | - if (tty->low_latency) | |
569 | + if (tty->port->low_latency) | |
569 | 570 | flush_to_ldisc(&buf->work); |
570 | 571 | else |
571 | 572 | schedule_work(&buf->work); |
include/linux/tty.h
... | ... | @@ -202,7 +202,8 @@ |
202 | 202 | unsigned long iflags; /* TTYP_ internal flags */ |
203 | 203 | #define TTYP_FLUSHING 1 /* Flushing to ldisc in progress */ |
204 | 204 | #define TTYP_FLUSHPENDING 2 /* Queued buffer flush pending */ |
205 | - unsigned char console:1; /* port is a console */ | |
205 | + unsigned char console:1, /* port is a console */ | |
206 | + low_latency:1; /* direct buffer flush */ | |
206 | 207 | struct mutex mutex; /* Locking */ |
207 | 208 | struct mutex buf_mutex; /* Buffer alloc lock */ |
208 | 209 | unsigned char *xmit_buf; /* Optional buffer */ |
... | ... | @@ -254,7 +255,7 @@ |
254 | 255 | int count; |
255 | 256 | struct winsize winsize; /* termios mutex */ |
256 | 257 | unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1; |
257 | - unsigned char low_latency:1, warned:1; | |
258 | + unsigned char warned:1; | |
258 | 259 | unsigned char ctrl_status; /* ctrl_lock */ |
259 | 260 | unsigned int receive_room; /* Bytes free for queue */ |
260 | 261 |
net/irda/ircomm/ircomm_tty.c
... | ... | @@ -452,7 +452,7 @@ |
452 | 452 | self->line, self->port.count); |
453 | 453 | |
454 | 454 | /* Not really used by us, but lets do it anyway */ |
455 | - tty->low_latency = (self->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0; | |
455 | + self->port.low_latency = (self->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0; | |
456 | 456 | |
457 | 457 | /* |
458 | 458 | * If the port is the middle of closing, bail out now |