diff options
| -rw-r--r-- | drivers/tty/ipwireless/tty.c | 3 | ||||
| -rw-r--r-- | drivers/tty/tty_buffer.c | 20 | ||||
| -rw-r--r-- | drivers/usb/gadget/u_serial.c | 4 | ||||
| -rw-r--r-- | include/linux/tty.h | 2 |
4 files changed, 7 insertions, 22 deletions
diff --git a/drivers/tty/ipwireless/tty.c b/drivers/tty/ipwireless/tty.c index ebd5bff0f5c1..17ee3bf0926b 100644 --- a/drivers/tty/ipwireless/tty.c +++ b/drivers/tty/ipwireless/tty.c | |||
| @@ -176,9 +176,6 @@ void ipwireless_tty_received(struct ipw_tty *tty, unsigned char *data, | |||
| 176 | ": %d chars not inserted to flip buffer!\n", | 176 | ": %d chars not inserted to flip buffer!\n", |
| 177 | length - work); | 177 | length - work); |
| 178 | 178 | ||
| 179 | /* | ||
| 180 | * This may sleep if ->low_latency is set | ||
| 181 | */ | ||
| 182 | if (work) | 179 | if (work) |
| 183 | tty_flip_buffer_push(&tty->port); | 180 | tty_flip_buffer_push(&tty->port); |
| 184 | } | 181 | } |
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index 765125dff20e..8ebd9f88a6f6 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c | |||
| @@ -351,14 +351,11 @@ EXPORT_SYMBOL(tty_insert_flip_string_flags); | |||
| 351 | * Takes any pending buffers and transfers their ownership to the | 351 | * Takes any pending buffers and transfers their ownership to the |
| 352 | * ldisc side of the queue. It then schedules those characters for | 352 | * ldisc side of the queue. It then schedules those characters for |
| 353 | * processing by the line discipline. | 353 | * processing by the line discipline. |
| 354 | * Note that this function can only be used when the low_latency flag | ||
| 355 | * is unset. Otherwise the workqueue won't be flushed. | ||
| 356 | */ | 354 | */ |
| 357 | 355 | ||
| 358 | void tty_schedule_flip(struct tty_port *port) | 356 | void tty_schedule_flip(struct tty_port *port) |
| 359 | { | 357 | { |
| 360 | struct tty_bufhead *buf = &port->buf; | 358 | struct tty_bufhead *buf = &port->buf; |
| 361 | WARN_ON(port->low_latency); | ||
| 362 | 359 | ||
| 363 | buf->tail->commit = buf->tail->used; | 360 | buf->tail->commit = buf->tail->used; |
| 364 | schedule_work(&buf->work); | 361 | schedule_work(&buf->work); |
| @@ -482,17 +479,15 @@ static void flush_to_ldisc(struct work_struct *work) | |||
| 482 | */ | 479 | */ |
| 483 | void tty_flush_to_ldisc(struct tty_struct *tty) | 480 | void tty_flush_to_ldisc(struct tty_struct *tty) |
| 484 | { | 481 | { |
| 485 | if (!tty->port->low_latency) | 482 | flush_work(&tty->port->buf.work); |
| 486 | flush_work(&tty->port->buf.work); | ||
| 487 | } | 483 | } |
| 488 | 484 | ||
| 489 | /** | 485 | /** |
| 490 | * tty_flip_buffer_push - terminal | 486 | * tty_flip_buffer_push - terminal |
| 491 | * @port: tty port to push | 487 | * @port: tty port to push |
| 492 | * | 488 | * |
| 493 | * Queue a push of the terminal flip buffers to the line discipline. This | 489 | * Queue a push of the terminal flip buffers to the line discipline. |
| 494 | * function must not be called from IRQ context if port->low_latency is | 490 | * Can be called from IRQ/atomic context. |
| 495 | * set. | ||
| 496 | * | 491 | * |
| 497 | * In the event of the queue being busy for flipping the work will be | 492 | * In the event of the queue being busy for flipping the work will be |
| 498 | * held off and retried later. | 493 | * held off and retried later. |
| @@ -500,14 +495,7 @@ void tty_flush_to_ldisc(struct tty_struct *tty) | |||
| 500 | 495 | ||
| 501 | void tty_flip_buffer_push(struct tty_port *port) | 496 | void tty_flip_buffer_push(struct tty_port *port) |
| 502 | { | 497 | { |
| 503 | struct tty_bufhead *buf = &port->buf; | 498 | tty_schedule_flip(port); |
| 504 | |||
| 505 | buf->tail->commit = buf->tail->used; | ||
| 506 | |||
| 507 | if (port->low_latency) | ||
| 508 | flush_to_ldisc(&buf->work); | ||
| 509 | else | ||
| 510 | schedule_work(&buf->work); | ||
| 511 | } | 499 | } |
| 512 | EXPORT_SYMBOL(tty_flip_buffer_push); | 500 | EXPORT_SYMBOL(tty_flip_buffer_push); |
| 513 | 501 | ||
diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c index b369292d4b90..ad0aca812002 100644 --- a/drivers/usb/gadget/u_serial.c +++ b/drivers/usb/gadget/u_serial.c | |||
| @@ -549,8 +549,8 @@ static void gs_rx_push(unsigned long _port) | |||
| 549 | port->read_started--; | 549 | port->read_started--; |
| 550 | } | 550 | } |
| 551 | 551 | ||
| 552 | /* Push from tty to ldisc; without low_latency set this is handled by | 552 | /* Push from tty to ldisc; this is handled by a workqueue, |
| 553 | * a workqueue, so we won't get callbacks and can hold port_lock | 553 | * so we won't get callbacks and can hold port_lock |
| 554 | */ | 554 | */ |
| 555 | if (do_push) | 555 | if (do_push) |
| 556 | tty_flip_buffer_push(&port->port); | 556 | tty_flip_buffer_push(&port->port); |
diff --git a/include/linux/tty.h b/include/linux/tty.h index 90b4fdc8a61f..b90b5c221ff0 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
| @@ -208,7 +208,7 @@ struct tty_port { | |||
| 208 | wait_queue_head_t delta_msr_wait; /* Modem status change */ | 208 | wait_queue_head_t delta_msr_wait; /* Modem status change */ |
| 209 | unsigned long flags; /* TTY flags ASY_*/ | 209 | unsigned long flags; /* TTY flags ASY_*/ |
| 210 | unsigned char console:1, /* port is a console */ | 210 | unsigned char console:1, /* port is a console */ |
| 211 | low_latency:1; /* direct buffer flush */ | 211 | low_latency:1; /* optional: tune for latency */ |
| 212 | struct mutex mutex; /* Locking */ | 212 | struct mutex mutex; /* Locking */ |
| 213 | struct mutex buf_mutex; /* Buffer alloc lock */ | 213 | struct mutex buf_mutex; /* Buffer alloc lock */ |
| 214 | unsigned char *xmit_buf; /* Optional buffer */ | 214 | unsigned char *xmit_buf; /* Optional buffer */ |
