drivers/tty/nozomi.c
Source file repositories/reference/linux-study-clean/drivers/tty/nozomi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/tty/nozomi.c- Extension
.c- Size
- 46486 bytes
- Lines
- 1857
- 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/kernel.hlinux/module.hlinux/pci.hlinux/ioport.hlinux/tty.hlinux/tty_driver.hlinux/tty_flip.hlinux/sched.hlinux/serial.hlinux/interrupt.hlinux/kmod.hlinux/init.hlinux/kfifo.hlinux/uaccess.hlinux/slab.hasm/byteorder.hlinux/delay.h
Detected Declarations
struct togglesstruct config_tablestruct ctrl_dlstruct ctrl_ulstruct togglesstruct config_tablestruct ctrl_dlstruct ctrl_ulstruct portstruct nozomienum card_typeenum card_stateenum channel_typeenum ctrl_port_typeenum port_typefunction read_mem32function write_mem32function nozomi_setup_memoryfunction dump_tablefunction dump_tablefunction enable_transmit_ulfunction disable_transmit_ulfunction enable_transmit_dlfunction disable_transmit_dlfunction send_datafunction receive_datafunction receive_flow_controlfunction port2ctrlfunction send_flow_controlfunction handle_data_dlfunction handle_data_ulfunction interrupt_handlerfunction nozomi_get_card_typefunction nozomi_setup_private_datafunction card_type_showfunction open_ttys_showfunction make_sysfs_filesfunction remove_sysfs_filesfunction nozomi_card_initfunction tty_exitfunction nozomi_card_exitfunction set_rtsfunction set_dtrfunction ntty_installfunction ntty_cleanupfunction ntty_activatefunction ntty_openfunction ntty_shutdown
Annotated Snippet
static struct pci_driver nozomi_driver = {
.name = NOZOMI_NAME,
.id_table = nozomi_pci_tbl,
.probe = nozomi_card_init,
.remove = nozomi_card_exit,
};
static __init int nozomi_init(void)
{
int ret;
ntty_driver = tty_alloc_driver(NTTY_TTY_MAXMINORS, TTY_DRIVER_REAL_RAW |
TTY_DRIVER_DYNAMIC_DEV);
if (IS_ERR(ntty_driver))
return PTR_ERR(ntty_driver);
ntty_driver->driver_name = NOZOMI_NAME_TTY;
ntty_driver->name = "noz";
ntty_driver->major = 0;
ntty_driver->type = TTY_DRIVER_TYPE_SERIAL;
ntty_driver->subtype = SERIAL_TYPE_NORMAL;
ntty_driver->init_termios = tty_std_termios;
ntty_driver->init_termios.c_cflag = B115200 | CS8 | CREAD | \
HUPCL | CLOCAL;
ntty_driver->init_termios.c_ispeed = 115200;
ntty_driver->init_termios.c_ospeed = 115200;
tty_set_operations(ntty_driver, &tty_ops);
ret = tty_register_driver(ntty_driver);
if (ret) {
printk(KERN_ERR "Nozomi: failed to register ntty driver\n");
goto free_tty;
}
ret = pci_register_driver(&nozomi_driver);
if (ret) {
printk(KERN_ERR "Nozomi: can't register pci driver\n");
goto unr_tty;
}
return 0;
unr_tty:
tty_unregister_driver(ntty_driver);
free_tty:
tty_driver_kref_put(ntty_driver);
return ret;
}
static __exit void nozomi_exit(void)
{
pci_unregister_driver(&nozomi_driver);
tty_unregister_driver(ntty_driver);
tty_driver_kref_put(ntty_driver);
}
module_init(nozomi_init);
module_exit(nozomi_exit);
MODULE_LICENSE("Dual BSD/GPL");
MODULE_DESCRIPTION("Nozomi driver");
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/pci.h`, `linux/ioport.h`, `linux/tty.h`, `linux/tty_driver.h`, `linux/tty_flip.h`, `linux/sched.h`.
- Detected declarations: `struct toggles`, `struct config_table`, `struct ctrl_dl`, `struct ctrl_ul`, `struct toggles`, `struct config_table`, `struct ctrl_dl`, `struct ctrl_ul`, `struct port`, `struct nozomi`.
- 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.