drivers/tty/serial/rp2.c
Source file repositories/reference/linux-study-clean/drivers/tty/serial/rp2.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/tty/serial/rp2.c- Extension
.c- Size
- 23267 bytes
- Lines
- 846
- Domain
- Driver Families
- Bucket
- drivers/tty
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitops.hlinux/compiler.hlinux/completion.hlinux/console.hlinux/delay.hlinux/firmware.hlinux/init.hlinux/io.hlinux/ioport.hlinux/irq.hlinux/kernel.hlinux/log2.hlinux/module.hlinux/pci.hlinux/serial.hlinux/serial_core.hlinux/slab.hlinux/sysrq.hlinux/tty.hlinux/tty_flip.hlinux/types.h
Detected Declarations
struct rp2_cardstruct rp2_uart_portstruct rp2_cardfunction rp2_decode_capfunction rp2_alloc_portsfunction rp2_rmwfunction rp2_rmw_clrfunction rp2_rmw_setfunction rp2_mask_ch_irqfunction rp2_uart_tx_emptyfunction rp2_uart_get_mctrlfunction rp2_uart_set_mctrlfunction rp2_uart_start_txfunction rp2_uart_stop_txfunction rp2_uart_stop_rxfunction rp2_uart_break_ctlfunction rp2_uart_enable_msfunction __rp2_uart_set_termiosfunction rp2_uart_set_termiosfunction rp2_rx_charsfunction rp2_tx_charsfunction rp2_ch_interruptfunction rp2_asic_interruptfunction for_each_set_bitfunction rp2_uart_interruptfunction rp2_flush_fifosfunction rp2_uart_startupfunction rp2_uart_shutdownfunction rp2_uart_release_portfunction rp2_uart_config_portfunction rp2_uart_verify_portfunction rp2_reset_asicfunction rp2_init_cardfunction rp2_init_portfunction rp2_remove_portsfunction rp2_load_firmwarefunction rp2_probefunction rp2_removefunction rp2_uart_initfunction rp2_uart_exitmodule init rp2_uart_init
Annotated Snippet
static struct pci_driver rp2_pci_driver = {
.name = DRV_NAME,
.id_table = rp2_pci_tbl,
.probe = rp2_probe,
.remove = rp2_remove,
};
static int __init rp2_uart_init(void)
{
int rc;
rc = uart_register_driver(&rp2_uart_driver);
if (rc)
return rc;
rc = pci_register_driver(&rp2_pci_driver);
if (rc) {
uart_unregister_driver(&rp2_uart_driver);
return rc;
}
return 0;
}
static void __exit rp2_uart_exit(void)
{
pci_unregister_driver(&rp2_pci_driver);
uart_unregister_driver(&rp2_uart_driver);
}
module_init(rp2_uart_init);
module_exit(rp2_uart_exit);
MODULE_DESCRIPTION("Comtrol RocketPort EXPRESS/INFINITY driver");
MODULE_AUTHOR("Kevin Cernekee <cernekee@gmail.com>");
MODULE_LICENSE("GPL v2");
MODULE_FIRMWARE(RP2_FW_NAME);
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/compiler.h`, `linux/completion.h`, `linux/console.h`, `linux/delay.h`, `linux/firmware.h`, `linux/init.h`, `linux/io.h`.
- Detected declarations: `struct rp2_card`, `struct rp2_uart_port`, `struct rp2_card`, `function rp2_decode_cap`, `function rp2_alloc_ports`, `function rp2_rmw`, `function rp2_rmw_clr`, `function rp2_rmw_set`, `function rp2_mask_ch_irq`, `function rp2_uart_tx_empty`.
- Atlas domain: Driver Families / drivers/tty.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.