drivers/usb/gadget/legacy/raw_gadget.c
Source file repositories/reference/linux-study-clean/drivers/usb/gadget/legacy/raw_gadget.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/gadget/legacy/raw_gadget.c- Extension
.c- Size
- 33960 bytes
- Lines
- 1377
- 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/compiler.hlinux/ctype.hlinux/debugfs.hlinux/delay.hlinux/idr.hlinux/kref.hlinux/miscdevice.hlinux/module.hlinux/semaphore.hlinux/sched.hlinux/slab.hlinux/uaccess.hlinux/wait.hlinux/usb.hlinux/usb/ch9.hlinux/usb/ch11.hlinux/usb/gadget.hlinux/usb/composite.huapi/linux/usb/raw_gadget.h
Detected Declarations
struct raw_event_queuestruct raw_devstruct raw_epstruct raw_devenum ep_stateenum dev_statefunction raw_event_queue_initfunction raw_event_queue_addfunction down_interruptiblefunction raw_event_queue_destroyfunction dev_freefunction raw_queue_eventfunction gadget_ep0_completefunction get_ep_addrfunction gadget_bindfunction gadget_unbindfunction gadget_setupfunction gadget_disconnectfunction gadget_suspendfunction gadget_resumefunction gadget_resetfunction raw_openfunction raw_releasefunction raw_ioctl_initfunction raw_ioctl_runfunction raw_ioctl_event_fetchfunction raw_process_ep0_iofunction raw_ioctl_ep0_writefunction raw_ioctl_ep0_readfunction raw_ioctl_ep0_stallfunction raw_ioctl_ep_enablefunction raw_ioctl_ep_disablefunction raw_ioctl_ep_set_clear_halt_wedgefunction gadget_ep_completefunction raw_process_ep_iofunction raw_ioctl_ep_writefunction raw_ioctl_ep_readfunction raw_ioctl_configurefunction raw_ioctl_vbus_drawfunction fill_ep_capsfunction fill_ep_limitsfunction raw_ioctl_eps_infofunction raw_ioctl
Annotated Snippet
static const struct file_operations raw_fops = {
.open = raw_open,
.unlocked_ioctl = raw_ioctl,
.compat_ioctl = raw_ioctl,
.release = raw_release,
};
static struct miscdevice raw_misc_device = {
.minor = MISC_DYNAMIC_MINOR,
.name = DRIVER_NAME,
.fops = &raw_fops,
};
module_misc_device(raw_misc_device);
Annotation
- Immediate include surface: `linux/compiler.h`, `linux/ctype.h`, `linux/debugfs.h`, `linux/delay.h`, `linux/idr.h`, `linux/kref.h`, `linux/miscdevice.h`, `linux/module.h`.
- Detected declarations: `struct raw_event_queue`, `struct raw_dev`, `struct raw_ep`, `struct raw_dev`, `enum ep_state`, `enum dev_state`, `function raw_event_queue_init`, `function raw_event_queue_add`, `function down_interruptible`, `function raw_event_queue_destroy`.
- 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.