diff options
| author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-01-27 13:58:21 +0100 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-01-27 13:58:21 +0100 |
| commit | 0a15f43b92ddaa2fdb476891a12ac2e207c7fcd2 (patch) | |
| tree | 011c617d39fc49a9755b20635a2428cf5df6ea18 /drivers/tty | |
| parent | d000422a46aad32217cf1be747eb61d641baae2f (diff) | |
Revert "tty: tty_port: add workqueue to flip TTY buffer"
This reverts commit d000422a46aad32217cf1be747eb61d641baae2f.
It is reported by many to cause boot failures, so must be reverted.
Cc: Xin Zhao <jackzxcui1989@163.com>
Cc: Jiri Slaby <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/d1942304-ee30-478d-90fb-279519f3ae81@samsung.com
Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reported-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
| -rw-r--r-- | drivers/tty/pty.c | 14 | ||||
| -rw-r--r-- | drivers/tty/tty_buffer.c | 8 | ||||
| -rw-r--r-- | drivers/tty/tty_io.c | 21 | ||||
| -rw-r--r-- | drivers/tty/tty_port.c | 23 |
4 files changed, 9 insertions, 57 deletions
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index 1f17575f8fe0..6120d827a797 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c @@ -403,8 +403,6 @@ static int pty_common_install(struct tty_driver *driver, struct tty_struct *tty, o_tty->link = tty; tty_port_init(ports[0]); tty_port_init(ports[1]); - tty_port_link_wq(ports[0], system_dfl_wq); - tty_port_link_wq(ports[1], system_dfl_wq); tty_buffer_set_limit(ports[0], 8192); tty_buffer_set_limit(ports[1], 8192); o_tty->port = ports[0]; @@ -534,16 +532,14 @@ static void __init legacy_pty_init(void) pty_driver = tty_alloc_driver(legacy_count, TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW | - TTY_DRIVER_DYNAMIC_ALLOC | - TTY_DRIVER_CUSTOM_WORKQUEUE); + TTY_DRIVER_DYNAMIC_ALLOC); if (IS_ERR(pty_driver)) panic("Couldn't allocate pty driver"); pty_slave_driver = tty_alloc_driver(legacy_count, TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW | - TTY_DRIVER_DYNAMIC_ALLOC | - TTY_DRIVER_CUSTOM_WORKQUEUE); + TTY_DRIVER_DYNAMIC_ALLOC); if (IS_ERR(pty_slave_driver)) panic("Couldn't allocate pty slave driver"); @@ -853,8 +849,7 @@ static void __init unix98_pty_init(void) TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV | TTY_DRIVER_DEVPTS_MEM | - TTY_DRIVER_DYNAMIC_ALLOC | - TTY_DRIVER_CUSTOM_WORKQUEUE); + TTY_DRIVER_DYNAMIC_ALLOC); if (IS_ERR(ptm_driver)) panic("Couldn't allocate Unix98 ptm driver"); pts_driver = tty_alloc_driver(NR_UNIX98_PTY_MAX, @@ -862,8 +857,7 @@ static void __init unix98_pty_init(void) TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV | TTY_DRIVER_DEVPTS_MEM | - TTY_DRIVER_DYNAMIC_ALLOC | - TTY_DRIVER_CUSTOM_WORKQUEUE); + TTY_DRIVER_DYNAMIC_ALLOC); if (IS_ERR(pts_driver)) panic("Couldn't allocate Unix98 pts driver"); diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index 86e1e7178e90..1a5673acd9b1 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c @@ -76,7 +76,7 @@ void tty_buffer_unlock_exclusive(struct tty_port *port) mutex_unlock(&buf->lock); if (restart) - queue_work(buf->flip_wq, &buf->work); + queue_work(system_dfl_wq, &buf->work); } EXPORT_SYMBOL_GPL(tty_buffer_unlock_exclusive); @@ -530,7 +530,7 @@ void tty_flip_buffer_push(struct tty_port *port) struct tty_bufhead *buf = &port->buf; tty_flip_buffer_commit(buf->tail); - queue_work(buf->flip_wq, &buf->work); + queue_work(system_dfl_wq, &buf->work); } EXPORT_SYMBOL(tty_flip_buffer_push); @@ -560,7 +560,7 @@ int tty_insert_flip_string_and_push_buffer(struct tty_port *port, tty_flip_buffer_commit(buf->tail); spin_unlock_irqrestore(&port->lock, flags); - queue_work(buf->flip_wq, &buf->work); + queue_work(system_dfl_wq, &buf->work); return size; } @@ -613,7 +613,7 @@ void tty_buffer_set_lock_subclass(struct tty_port *port) bool tty_buffer_restart_work(struct tty_port *port) { - return queue_work(port->buf.flip_wq, &port->buf.work); + return queue_work(system_dfl_wq, &port->buf.work); } bool tty_buffer_cancel_work(struct tty_port *port) diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index d64fb08baa17..e2d92cf70eb7 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c @@ -3446,23 +3446,10 @@ int tty_register_driver(struct tty_driver *driver) if (error < 0) goto err; - if (!(driver->flags & TTY_DRIVER_CUSTOM_WORKQUEUE)) { - driver->flip_wq = alloc_workqueue("%s-flip-wq", WQ_UNBOUND | WQ_SYSFS, - 0, driver->name); - if (!driver->flip_wq) { - error = -ENOMEM; - goto err_unreg_char; - } - for (i = 0; i < driver->num; i++) { - if (driver->ports[i]) - tty_port_link_driver_wq(driver->ports[i], driver); - } - } - if (driver->flags & TTY_DRIVER_DYNAMIC_ALLOC) { error = tty_cdev_add(driver, dev, 0, driver->num); if (error) - goto err_destroy_wq; + goto err_unreg_char; } scoped_guard(mutex, &tty_mutex) @@ -3488,10 +3475,6 @@ err_unreg_devs: scoped_guard(mutex, &tty_mutex) list_del(&driver->tty_drivers); -err_destroy_wq: - if (!(driver->flags & TTY_DRIVER_CUSTOM_WORKQUEUE)) - destroy_workqueue(driver->flip_wq); - err_unreg_char: unregister_chrdev_region(dev, driver->num); err: @@ -3511,8 +3494,6 @@ void tty_unregister_driver(struct tty_driver *driver) driver->num); scoped_guard(mutex, &tty_mutex) list_del(&driver->tty_drivers); - if (!(driver->flags & TTY_DRIVER_CUSTOM_WORKQUEUE)) - destroy_workqueue(driver->flip_wq); } EXPORT_SYMBOL(tty_unregister_driver); diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c index 611f878149f8..fe67c5cb0a3f 100644 --- a/drivers/tty/tty_port.c +++ b/drivers/tty/tty_port.c @@ -100,26 +100,6 @@ void tty_port_init(struct tty_port *port) EXPORT_SYMBOL(tty_port_init); /** - * tty_port_link_wq - link tty_port and flip workqueue - * @port: tty_port of the device - * @flip_wq: workqueue to queue flip buffer work on - * - * When %TTY_DRIVER_CUSTOM_WORKQUEUE is used, every tty_port shall be linked to - * a workqueue manually by this function, otherwise tty_flip_buffer_push() will - * see %NULL flip_wq pointer on queue_work. - * When %TTY_DRIVER_CUSTOM_WORKQUEUE is NOT used, the function can be used to - * link a certain port to a specific workqueue, instead of using the workqueue - * allocated in tty_register_driver(). - * - * Note that TTY port API will NOT destroy the workqueue. - */ -void tty_port_link_wq(struct tty_port *port, struct workqueue_struct *flip_wq) -{ - port->buf.flip_wq = flip_wq; -} -EXPORT_SYMBOL_GPL(tty_port_link_wq); - -/** * tty_port_link_device - link tty and tty_port * @port: tty_port of the device * @driver: tty_driver for this device @@ -177,7 +157,6 @@ struct device *tty_port_register_device_attr(struct tty_port *port, const struct attribute_group **attr_grp) { tty_port_link_device(port, driver, index); - tty_port_link_driver_wq(port, driver); return tty_register_device_attr(driver, index, device, drvdata, attr_grp); } @@ -204,7 +183,6 @@ struct device *tty_port_register_device_attr_serdev(struct tty_port *port, struct device *dev; tty_port_link_device(port, driver, index); - tty_port_link_driver_wq(port, driver); dev = serdev_tty_port_register(port, host, parent, driver, index); if (PTR_ERR(dev) != -ENODEV) { @@ -725,7 +703,6 @@ int tty_port_install(struct tty_port *port, struct tty_driver *driver, struct tty_struct *tty) { tty->port = port; - tty_port_link_driver_wq(port, driver); return tty_standard_install(driver, tty); } EXPORT_SYMBOL_GPL(tty_port_install); |
