drivers/usb/roles/class.c
Source file repositories/reference/linux-study-clean/drivers/usb/roles/class.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/roles/class.c- Extension
.c- Size
- 11324 bytes
- Lines
- 470
- Domain
- Driver Families
- Bucket
- drivers/usb
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/component.hlinux/usb/role.hlinux/property.hlinux/device.hlinux/lockdep.hlinux/module.hlinux/mutex.hlinux/slab.h
Detected Declarations
struct usb_role_switchfunction connector_bindfunction connector_unbindfunction usb_role_switch_set_rolefunction usb_role_switch_get_rolefunction usb_role_switch_is_parentfunction usb_role_switch_getfunction usb_role_switch_putfunction usb_role_switch_find_by_fwnodefunction usb_role_switch_is_visiblefunction role_showfunction role_storefunction usb_role_switch_ueventfunction usb_role_switch_releasefunction usb_role_switch_registerfunction usb_role_switch_registerfunction usb_role_switch_set_drvdatafunction usb_roles_initfunction usb_roles_exitmodule init usb_roles_initexport usb_role_switch_set_roleexport usb_role_switch_get_roleexport usb_role_switch_getexport fwnode_usb_role_switch_getexport usb_role_switch_putexport usb_role_switch_find_by_fwnodeexport usb_role_stringexport usb_role_switch_registerexport usb_role_switch_unregisterexport usb_role_switch_set_drvdataexport usb_role_switch_get_drvdata
Annotated Snippet
subsys_initcall(usb_roles_init);
static void __exit usb_roles_exit(void)
{
class_unregister(&role_class);
}
module_exit(usb_roles_exit);
MODULE_AUTHOR("Heikki Krogerus <heikki.krogerus@linux.intel.com>");
MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>");
MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("USB Role Class");
Annotation
- Immediate include surface: `linux/component.h`, `linux/usb/role.h`, `linux/property.h`, `linux/device.h`, `linux/lockdep.h`, `linux/module.h`, `linux/mutex.h`, `linux/slab.h`.
- Detected declarations: `struct usb_role_switch`, `function connector_bind`, `function connector_unbind`, `function usb_role_switch_set_role`, `function usb_role_switch_get_role`, `function usb_role_switch_is_parent`, `function usb_role_switch_get`, `function usb_role_switch_put`, `function usb_role_switch_find_by_fwnode`, `function usb_role_switch_is_visible`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: integration implementation candidate.
- 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.