Preparation for converting to kthread_worker Signed-off-by: Steven Walter <stevenrwalter@xxxxxxxxx> --- drivers/tty/n_tty.c | 2 +- drivers/tty/tty_buffer.c | 19 ++++++++++++++++--- drivers/tty/tty_ldisc.c | 4 ++-- include/linux/tty.h | 2 ++ 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index 47ca0f3..c3869a5 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c @@ -214,7 +214,7 @@ static void n_tty_set_room(struct tty_struct *tty) */ WARN_RATELIMIT(test_bit(TTY_LDISC_HALTED, &tty->flags), "scheduling buffer work for halted ldisc\n"); - queue_work(system_unbound_wq, &tty->port->buf.work); + tty_buffer_queue_work(tty->port); } } diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index 143deb6..ed7b5c8 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c @@ -72,7 +72,7 @@ void tty_buffer_unlock_exclusive(struct tty_port *port) atomic_dec(&buf->priority); mutex_unlock(&buf->lock); if (restart) - queue_work(system_unbound_wq, &buf->work); + tty_buffer_queue_work(port); } EXPORT_SYMBOL_GPL(tty_buffer_unlock_exclusive); @@ -364,7 +364,7 @@ void tty_schedule_flip(struct tty_port *port) struct tty_bufhead *buf = &port->buf; buf->tail->commit = buf->tail->used; - schedule_work(&buf->work); + tty_buffer_queue_work(port); } EXPORT_SYMBOL(tty_schedule_flip); @@ -492,7 +492,7 @@ static void flush_to_ldisc(struct work_struct *work) */ void tty_flush_to_ldisc(struct tty_struct *tty) { - flush_work(&tty->port->buf.work); + tty_buffer_flush_work(tty->port); } /** @@ -520,6 +520,19 @@ EXPORT_SYMBOL(tty_flip_buffer_push); * Must be called before the other tty buffer functions are used. */ + +void tty_buffer_queue_work(struct tty_port *port) +{ + struct tty_bufhead *buf = &port->buf; + schedule_work(&buf->work); +} + +void tty_buffer_flush_work(struct tty_port *port) +{ + struct tty_bufhead *buf = &port->buf; + flush_work(&buf->work); +} + void tty_buffer_init(struct tty_port *port) { struct tty_bufhead *buf = &port->buf; diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c index 2d822aa..982f082 100644 --- a/drivers/tty/tty_ldisc.c +++ b/drivers/tty/tty_ldisc.c @@ -584,9 +584,9 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc) /* Restart the work queue in case no characters kick it off. Safe if already running */ - schedule_work(&tty->port->buf.work); + tty_buffer_queue_work(tty->port); if (o_tty) - schedule_work(&o_tty->port->buf.work); + tty_buffer_queue_work(o_tty->port); tty_unlock(tty); return retval; diff --git a/include/linux/tty.h b/include/linux/tty.h index 5171ef8..7bad787 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -446,6 +446,8 @@ extern void tty_flush_to_ldisc(struct tty_struct *tty); extern void tty_buffer_free_all(struct tty_port *port); extern void tty_buffer_flush(struct tty_struct *tty); extern void tty_buffer_init(struct tty_port *port); +extern void tty_buffer_queue_work(struct tty_port *port); +extern void tty_buffer_flush_work(struct tty_port *port); extern speed_t tty_termios_baud_rate(struct ktermios *termios); extern speed_t tty_termios_input_baud_rate(struct ktermios *termios); extern void tty_termios_encode_baud_rate(struct ktermios *termios, -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html