drivers/tty/mxser.c
Source file repositories/reference/linux-study-clean/drivers/tty/mxser.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/tty/mxser.c- Extension
.c- Size
- 48128 bytes
- Lines
- 1882
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/module.hlinux/errno.hlinux/signal.hlinux/sched.hlinux/timer.hlinux/interrupt.hlinux/tty.hlinux/tty_flip.hlinux/serial.hlinux/serial_reg.hlinux/major.hlinux/string.hlinux/fcntl.hlinux/ptrace.hlinux/ioport.hlinux/mm.hlinux/delay.hlinux/pci.hlinux/bitops.hlinux/slab.hlinux/ratelimit.hasm/io.hasm/irq.hlinux/uaccess.h
Detected Declarations
struct mxser_boardstruct mxser_portstruct mxser_boardenum mxser_must_hwidfunction __mxser_must_set_EFRfunction mxser_must_select_bankfunction mxser_set_must_xon1_valuefunction mxser_set_must_xoff1_valuefunction mxser_set_must_fifo_valuefunction mxser_set_must_enum_valuefunction mxser_get_must_hardware_idfunction mxser_must_set_EFRfunction mxser_must_set_enhance_modefunction mxser_must_no_sw_flow_controlfunction mxser_must_set_tx_sw_flow_controlfunction mxser_must_set_rx_sw_flow_controlfunction mxser_must_get_hwidfunction mxser_16550A_or_MUSTfunction mxser_process_txrx_fifofunction __mxser_start_txfunction mxser_start_txfunction __mxser_stop_txfunction mxser_carrier_raisedfunction mxser_dtr_rtsfunction mxser_set_baudfunction mxser_handle_ctsfunction mxser_change_speedfunction mxser_check_modem_statusfunction mxser_disable_and_clear_FIFOfunction mxser_activatefunction mxser_stop_rxfunction mxser_shutdown_portfunction scoped_guardfunction mxser_openfunction mxser_flush_bufferfunction scoped_guardfunction mxser_closefunction mxser_writefunction scoped_guardfunction mxser_put_charfunction mxser_flush_charsfunction mxser_write_roomfunction mxser_chars_in_bufferfunction mxser_ioctlfunction mxser_set_serial_infofunction mxser_get_lsr_infofunction mxser_tiocmgetfunction scoped_guard
Annotated Snippet
static struct pci_driver mxser_driver = {
.name = "mxser",
.id_table = mxser_pcibrds,
.probe = mxser_probe,
.remove = mxser_remove
};
static int __init mxser_module_init(void)
{
int retval;
mxvar_sdriver = tty_alloc_driver(MXSER_PORTS, TTY_DRIVER_REAL_RAW |
TTY_DRIVER_DYNAMIC_DEV);
if (IS_ERR(mxvar_sdriver))
return PTR_ERR(mxvar_sdriver);
/* Initialize the tty_driver structure */
mxvar_sdriver->name = "ttyMI";
mxvar_sdriver->major = ttymajor;
mxvar_sdriver->minor_start = 0;
mxvar_sdriver->type = TTY_DRIVER_TYPE_SERIAL;
mxvar_sdriver->subtype = SERIAL_TYPE_NORMAL;
mxvar_sdriver->init_termios = tty_std_termios;
mxvar_sdriver->init_termios.c_cflag = B9600|CS8|CREAD|HUPCL|CLOCAL;
tty_set_operations(mxvar_sdriver, &mxser_ops);
retval = tty_register_driver(mxvar_sdriver);
if (retval) {
printk(KERN_ERR "Couldn't install MOXA Smartio/Industio family "
"tty driver !\n");
goto err_put;
}
retval = pci_register_driver(&mxser_driver);
if (retval) {
printk(KERN_ERR "mxser: can't register pci driver\n");
goto err_unr;
}
return 0;
err_unr:
tty_unregister_driver(mxvar_sdriver);
err_put:
tty_driver_kref_put(mxvar_sdriver);
return retval;
}
static void __exit mxser_module_exit(void)
{
pci_unregister_driver(&mxser_driver);
tty_unregister_driver(mxvar_sdriver);
tty_driver_kref_put(mxvar_sdriver);
}
module_init(mxser_module_init);
module_exit(mxser_module_exit);
Annotation
- Immediate include surface: `linux/module.h`, `linux/errno.h`, `linux/signal.h`, `linux/sched.h`, `linux/timer.h`, `linux/interrupt.h`, `linux/tty.h`, `linux/tty_flip.h`.
- Detected declarations: `struct mxser_board`, `struct mxser_port`, `struct mxser_board`, `enum mxser_must_hwid`, `function __mxser_must_set_EFR`, `function mxser_must_select_bank`, `function mxser_set_must_xon1_value`, `function mxser_set_must_xoff1_value`, `function mxser_set_must_fifo_value`, `function mxser_set_must_enum_value`.
- Atlas domain: Driver Families / drivers/tty.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.