drivers/input/misc/uinput.c
Source file repositories/reference/linux-study-clean/drivers/input/misc/uinput.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/input/misc/uinput.c- Extension
.c- Size
- 27116 bytes
- Lines
- 1172
- 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
uapi/linux/uinput.hlinux/poll.hlinux/sched.hlinux/slab.hlinux/module.hlinux/init.hlinux/fs.hlinux/lockdep.hlinux/miscdevice.hlinux/overflow.hlinux/spinlock.hlinux/input/mt.h../input-compat.h
Detected Declarations
struct uinput_requeststruct uinput_devicestruct uinput_ff_upload_compatenum uinput_statefunction uinput_dev_eventfunction uinput_request_alloc_idfunction uinput_request_reserve_slotfunction uinput_request_release_slotfunction uinput_request_sendfunction uinput_request_submitfunction uinput_flush_requestsfunction uinput_dev_set_gainfunction uinput_dev_set_autocenterfunction uinput_dev_playbackfunction uinput_dev_upload_effectfunction uinput_dev_erase_effectfunction uinput_dev_flushfunction uinput_destroy_devicefunction uinput_create_devicefunction uinput_openfunction uinput_validate_absinfofunction valuefunction uinput_validate_absbitsfunction for_each_set_bitfunction uinput_dev_setupfunction uinput_abs_setupfunction uinput_setup_device_legacyfunction validfunction uinput_inject_eventsfunction uinput_writefunction uinput_fetch_next_eventfunction uinput_events_to_userfunction uinput_readfunction uinput_pollfunction uinput_releasefunction uinput_ff_upload_to_userfunction uinput_ff_upload_from_userfunction uinput_ff_upload_to_userfunction uinput_ff_upload_from_userfunction uinput_str_to_userfunction uinput_ioctl_handlerfunction UI_GET_SYSNAMEfunction uinput_ioctlfunction uinput_compat_ioctl
Annotated Snippet
static const struct file_operations uinput_fops = {
.owner = THIS_MODULE,
.open = uinput_open,
.release = uinput_release,
.read = uinput_read,
.write = uinput_write,
.poll = uinput_poll,
.unlocked_ioctl = uinput_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = uinput_compat_ioctl,
#endif
};
static struct miscdevice uinput_misc = {
.fops = &uinput_fops,
.minor = UINPUT_MINOR,
.name = UINPUT_NAME,
};
module_misc_device(uinput_misc);
MODULE_ALIAS_MISCDEV(UINPUT_MINOR);
MODULE_ALIAS("devname:" UINPUT_NAME);
MODULE_AUTHOR("Aristeu Sergio Rozanski Filho");
MODULE_DESCRIPTION("User level driver support for input subsystem");
MODULE_LICENSE("GPL");
Annotation
- Immediate include surface: `uapi/linux/uinput.h`, `linux/poll.h`, `linux/sched.h`, `linux/slab.h`, `linux/module.h`, `linux/init.h`, `linux/fs.h`, `linux/lockdep.h`.
- Detected declarations: `struct uinput_request`, `struct uinput_device`, `struct uinput_ff_upload_compat`, `enum uinput_state`, `function uinput_dev_event`, `function uinput_request_alloc_id`, `function uinput_request_reserve_slot`, `function uinput_request_release_slot`, `function uinput_request_send`, `function uinput_request_submit`.
- 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.