drivers/tty/tty_port.c
Source file repositories/reference/linux-study-clean/drivers/tty/tty_port.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/tty/tty_port.c- Extension
.c- Size
- 21379 bytes
- Lines
- 778
- Domain
- Driver Families
- Bucket
- drivers/tty
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/errno.hlinux/tty.hlinux/tty_driver.hlinux/tty_flip.hlinux/serial.hlinux/timer.hlinux/string.hlinux/slab.hlinux/sched/signal.hlinux/wait.hlinux/bitops.hlinux/delay.hlinux/module.hlinux/serdev.htty.h
Detected Declarations
function tty_port_default_receive_buffunction tty_port_default_lookahead_buffunction tty_port_default_wakeupfunction tty_port_initfunction tty_port_link_wqfunction ttyfunction tty_register_devicefunction tty_register_device_attrfunction tty_port_register_device_serdevfunction tty_port_alloc_xmit_buffunction tty_port_free_xmit_buffunction tty_port_initfunction tty_port_destructorfunction tty_port_putfunction ttyfunction tty_port_tty_setfunction tty_port_hangupfunction tty_port_hangupfunction scoped_guardfunction __tty_port_tty_hangupfunction tty_port_tty_wakeupfunction tty_port_carrier_raisedfunction tty_port_raise_dtr_rtsfunction tty_port_lower_dtr_rtsfunction statefunction tty_port_drain_delayfunction tty_port_close_endfunction scoped_guardfunction tty_port_close_endfunction tty_port_close_startfunction tty_standard_installfunction tty_port_block_til_readyfunction scoped_guardexport tty_port_default_client_opsexport tty_port_initexport tty_port_link_wqexport tty_port_link_deviceexport tty_port_register_deviceexport tty_port_register_device_attrexport tty_port_register_device_attr_serdevexport tty_port_unregister_deviceexport tty_port_alloc_xmit_bufexport tty_port_free_xmit_bufexport tty_port_destroyexport tty_port_putexport tty_port_tty_getexport tty_port_tty_setexport tty_port_hangup
Annotated Snippet
if (!check_clocal || !C_CLOCAL(tty)) {
if (async)
tty_hangup(tty);
else
tty_vhangup(tty);
}
}
}
EXPORT_SYMBOL_GPL(__tty_port_tty_hangup);
/**
* tty_port_tty_wakeup - helper to wake up a tty
* @port: tty port
*/
void tty_port_tty_wakeup(struct tty_port *port)
{
port->client_ops->write_wakeup(port);
}
EXPORT_SYMBOL_GPL(tty_port_tty_wakeup);
/**
* tty_port_carrier_raised - carrier raised check
* @port: tty port
*
* Wrapper for the carrier detect logic. For the moment this is used
* to hide some internal details. This will eventually become entirely
* internal to the tty port.
*/
bool tty_port_carrier_raised(struct tty_port *port)
{
if (port->ops->carrier_raised == NULL)
return true;
return port->ops->carrier_raised(port);
}
EXPORT_SYMBOL(tty_port_carrier_raised);
/**
* tty_port_raise_dtr_rts - Raise DTR/RTS
* @port: tty port
*
* Wrapper for the DTR/RTS raise logic. For the moment this is used to hide
* some internal details. This will eventually become entirely internal to the
* tty port.
*/
void tty_port_raise_dtr_rts(struct tty_port *port)
{
if (port->ops->dtr_rts)
port->ops->dtr_rts(port, true);
}
EXPORT_SYMBOL(tty_port_raise_dtr_rts);
/**
* tty_port_lower_dtr_rts - Lower DTR/RTS
* @port: tty port
*
* Wrapper for the DTR/RTS raise logic. For the moment this is used to hide
* some internal details. This will eventually become entirely internal to the
* tty port.
*/
void tty_port_lower_dtr_rts(struct tty_port *port)
{
if (port->ops->dtr_rts)
port->ops->dtr_rts(port, false);
}
EXPORT_SYMBOL(tty_port_lower_dtr_rts);
/**
* tty_port_block_til_ready - Waiting logic for tty open
* @port: the tty port being opened
* @tty: the tty device being bound
* @filp: the file pointer of the opener or %NULL
*
* Implement the core POSIX/SuS tty behaviour when opening a tty device.
* Handles:
*
* - hangup (both before and during)
* - non blocking open
* - rts/dtr/dcd
* - signals
* - port flags and counts
*
* The passed @port must implement the @port->ops->carrier_raised method if it
* can do carrier detect and the @port->ops->dtr_rts method if it supports
* software management of these lines. Note that the dtr/rts raise is done each
* iteration as a hangup may have previously dropped them while we wait.
*
* Caller holds tty lock.
*
* Note: May drop and reacquire tty lock when blocking, so @tty and @port may
* have changed state (eg., may have been hung up).
Annotation
- Immediate include surface: `linux/types.h`, `linux/errno.h`, `linux/tty.h`, `linux/tty_driver.h`, `linux/tty_flip.h`, `linux/serial.h`, `linux/timer.h`, `linux/string.h`.
- Detected declarations: `function tty_port_default_receive_buf`, `function tty_port_default_lookahead_buf`, `function tty_port_default_wakeup`, `function tty_port_init`, `function tty_port_link_wq`, `function tty`, `function tty_register_device`, `function tty_register_device_attr`, `function tty_port_register_device_serdev`, `function tty_port_alloc_xmit_buf`.
- Atlas domain: Driver Families / drivers/tty.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.