diff options
| author | seteiro <[email protected]> | 2026-11-27 13:23:44 +0800 |
|---|---|---|
| committer | Rbb666 <[email protected]> | 2026-11-29 23:16:43 +0800 |
| commit | 332ac026959dab0c489ab7d8ac305f78f5559398 (patch) | |
| tree | 29746541fdda49cb5d274e00e40c6d548db1477a /bsp/lpc176x/template.ewp | |
| parent | b3e0697cd21de6a8768e1857501060994d4d907b (diff) | |
Fix #11718
When board code registers a serial device before INIT_PREV_EXPORT initializes
the tty workqueue, defer the registration onto a pending slist and flush it
during INIT_COMPONENT_EXPORT.
The pending slist is accessed exclusively during early single-threaded boot
before the scheduler starts. Once flush runs, mark it completed via
_tty_flush_done; subsequent registrations cannot append further pending nodes
if workqueue creation failed, preventing unbounded accumulation of pending
allocations.
rt_hw_serial_register_tty() now records the created TTY in the serial device
(rt_serial_device::ttydev). rx_notify.dev cannot be used for that: the notify
callback belongs to whoever installs it and is not touched by the TTY at all,
so it cannot tell "no TTY was ever created" from "the TTY exists but was never
opened". The unregister path now frees a TTY that was created but never
opened, and rt_hw_serial_register_tty() rejects a second registration of the
same serial device instead of creating a second TTY.
tty_rel_gone() already releases the TTY (device object, queues and the serial
context through tsw_free) once its last session has left, or immediately for a
TTY that was never opened. The unregister path no longer frees the TTY a
second time with rt_device_destroy()/lwp_tty_delete(), and the device switch
now provides the tsw_free() destructor that lwp_tty_delete() requires.
rt_hw_serial_unregister_tty() no longer writes rx_notify back to a snapshot
taken at registration time. The TTY receives through the bypass hook and never
installs an rx_notify callback of its own, so there is nothing to revoke;
restoring the snapshot only replaced a callback that somebody else installed
with RT_DEVICE_CTRL_NOTIFY_SET after the TTY was created. The backup field and
the dead _restore_serial() helper that carried the same unconditional write go
with it.
Diffstat (limited to 'bsp/lpc176x/template.ewp')
0 files changed, 0 insertions, 0 deletions
