drivers/input/serio/userio.c
Source file repositories/reference/linux-study-clean/drivers/input/serio/userio.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/input/serio/userio.c- Extension
.c- Size
- 6711 bytes
- Lines
- 284
- Domain
- Driver Families
- Bucket
- drivers/input
- 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.
- 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/circ_buf.hlinux/mutex.hlinux/module.hlinux/init.hlinux/kernel.hlinux/serio.hlinux/slab.hlinux/fs.hlinux/miscdevice.hlinux/sched.hlinux/poll.huapi/linux/userio.h
Detected Declarations
struct userio_devicefunction userio_device_writefunction scoped_guardfunction userio_char_openfunction userio_char_releasefunction userio_fetch_datafunction userio_char_readfunction userio_execute_cmdfunction userio_char_writefunction scoped_cond_guardfunction userio_char_poll
Annotated Snippet
static const struct file_operations userio_fops = {
.owner = THIS_MODULE,
.open = userio_char_open,
.release = userio_char_release,
.read = userio_char_read,
.write = userio_char_write,
.poll = userio_char_poll,
};
static struct miscdevice userio_misc = {
.fops = &userio_fops,
.minor = USERIO_MINOR,
.name = USERIO_NAME,
};
module_driver(userio_misc, misc_register, misc_deregister);
MODULE_ALIAS_MISCDEV(USERIO_MINOR);
MODULE_ALIAS("devname:" USERIO_NAME);
MODULE_AUTHOR("Stephen Chandler Paul <thatslyude@gmail.com>");
MODULE_DESCRIPTION("Virtual Serio Device Support");
MODULE_LICENSE("GPL");
Annotation
- Immediate include surface: `linux/circ_buf.h`, `linux/mutex.h`, `linux/module.h`, `linux/init.h`, `linux/kernel.h`, `linux/serio.h`, `linux/slab.h`, `linux/fs.h`.
- Detected declarations: `struct userio_device`, `function userio_device_write`, `function scoped_guard`, `function userio_char_open`, `function userio_char_release`, `function userio_fetch_data`, `function userio_char_read`, `function userio_execute_cmd`, `function userio_char_write`, `function scoped_cond_guard`.
- Atlas domain: Driver Families / drivers/input.
- 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.
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.