drivers/usb/misc/chaoskey.c
Source file repositories/reference/linux-study-clean/drivers/usb/misc/chaoskey.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/misc/chaoskey.c- Extension
.c- Size
- 14084 bytes
- Lines
- 607
- Domain
- Driver Families
- Bucket
- drivers/usb
- 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/module.hlinux/slab.hlinux/usb.hlinux/wait.hlinux/hw_random.hlinux/mutex.hlinux/uaccess.h
Detected Declarations
struct chaoskeyfunction chaoskey_freefunction chaoskey_probefunction chaoskey_disconnectfunction chaoskey_openfunction chaoskey_releasefunction chaos_read_callbackfunction _chaoskey_fillfunction chaoskey_readfunction chaoskey_rng_readfunction chaoskey_suspendfunction chaoskey_resume
Annotated Snippet
static const struct file_operations chaoskey_fops = {
.owner = THIS_MODULE,
.read = chaoskey_read,
.open = chaoskey_open,
.release = chaoskey_release,
.llseek = default_llseek,
};
/* class driver information */
static struct usb_class_driver chaoskey_class = {
.name = "chaoskey%d",
.fops = &chaoskey_fops,
.minor_base = USB_CHAOSKEY_MINOR_BASE,
};
/* usb specific object needed to register this driver with the usb subsystem */
static struct usb_driver chaoskey_driver = {
.name = DRIVER_SHORT,
.probe = chaoskey_probe,
.disconnect = chaoskey_disconnect,
.suspend = chaoskey_suspend,
.resume = chaoskey_resume,
.reset_resume = chaoskey_resume,
.id_table = chaoskey_table,
.supports_autosuspend = 1,
};
module_usb_driver(chaoskey_driver);
Annotation
- Immediate include surface: `linux/module.h`, `linux/slab.h`, `linux/usb.h`, `linux/wait.h`, `linux/hw_random.h`, `linux/mutex.h`, `linux/uaccess.h`.
- Detected declarations: `struct chaoskey`, `function chaoskey_free`, `function chaoskey_probe`, `function chaoskey_disconnect`, `function chaoskey_open`, `function chaoskey_release`, `function chaos_read_callback`, `function _chaoskey_fill`, `function chaoskey_read`, `function chaoskey_rng_read`.
- Atlas domain: Driver Families / drivers/usb.
- 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.