include/linux/usb.h
Source file repositories/reference/linux-study-clean/include/linux/usb.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/usb.h- Extension
.h- Size
- 83096 bytes
- Lines
- 2118
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/mod_devicetable.hlinux/usb/ch9.hlinux/errno.hlinux/delay.hlinux/interrupt.hlinux/list.hlinux/kref.hlinux/device.hlinux/fs.hlinux/completion.hlinux/sched.hlinux/mutex.hlinux/spinlock.hlinux/pm_runtime.h
Detected Declarations
struct usb_devicestruct usb_driverstruct ep_devicestruct usb_host_endpointstruct usb_host_interfacestruct usb_interfacestruct usb_interface_cachestruct usb_host_configstruct usb_host_bosstruct usb_busstruct usb_dev_statestruct usb_ttstruct usb2_lpm_parametersstruct usb3_lpm_parametersstruct usb_devicestruct usb_dynidsstruct usb_dynidstruct usb_driverstruct usb_device_driverstruct usb_class_driverstruct usb_iso_packet_descriptorstruct urbstruct usb_anchorstruct urbstruct usb_sg_requestenum usb_interface_conditionenum usb_wireless_statusenum usb_link_tunnel_modeenum usb_port_connect_typeenum dma_data_directionenum usb_led_eventfunction usb_find_bulk_in_endpointfunction usb_find_bulk_out_endpointfunction usb_find_int_in_endpointfunction usb_find_int_out_endpointfunction usb_find_last_bulk_in_endpointfunction usb_find_last_bulk_out_endpointfunction usb_find_last_int_in_endpointfunction usb_find_last_int_out_endpointfunction usb_set_intfdatafunction usb_acpi_set_power_statefunction usb_acpi_power_manageablefunction usb_acpi_port_lpm_incapablefunction usb_mark_last_busyfunction usb_enable_autosuspendfunction usb_autopm_get_interface_asyncfunction usb_autopm_put_interfacefunction usb_offload_get
Annotated Snippet
#include <linux/fs.h> /* for struct file_operations */
#include <linux/completion.h> /* for struct completion */
#include <linux/sched.h> /* for current && schedule_timeout */
#include <linux/mutex.h> /* for struct mutex */
#include <linux/spinlock.h> /* for spinlock_t */
#include <linux/pm_runtime.h> /* for runtime PM */
struct usb_device;
struct usb_driver;
/*-------------------------------------------------------------------------*/
/*
* Host-side wrappers for standard USB descriptors ... these are parsed
* from the data provided by devices. Parsing turns them from a flat
* sequence of descriptors into a hierarchy:
*
* - devices have one (usually) or more configs;
* - configs have one (often) or more interfaces;
* - interfaces have one (usually) or more settings;
* - each interface setting has zero or (usually) more endpoints.
* - a SuperSpeed endpoint has a companion descriptor
*
* And there might be other descriptors mixed in with those.
*
* Devices may also have class-specific or vendor-specific descriptors.
*/
struct ep_device;
/**
* struct usb_host_endpoint - host-side endpoint descriptor and queue
* @desc: descriptor for this endpoint, wMaxPacketSize in native byteorder
* @ss_ep_comp: SuperSpeed companion descriptor for this endpoint
* @ssp_isoc_ep_comp: SuperSpeedPlus isoc companion descriptor for this endpoint
* @eusb2_isoc_ep_comp: eUSB2 isoc companion descriptor for this endpoint
* @urb_list: urbs queued to this endpoint; maintained by usbcore
* @hcpriv: for use by HCD; typically holds hardware dma queue head (QH)
* with one or more transfer descriptors (TDs) per urb; must be preserved
* by core while BW is allocated for the endpoint
* @ep_dev: ep_device for sysfs info
* @extra: descriptors following this endpoint in the configuration
* @extralen: how many bytes of "extra" are valid
* @enabled: URBs may be submitted to this endpoint
* @streams: number of USB-3 streams allocated on the endpoint
*
* USB requests are always queued to a given endpoint, identified by a
* descriptor within an active interface in a given USB configuration.
*/
struct usb_host_endpoint {
struct usb_endpoint_descriptor desc;
struct usb_ss_ep_comp_descriptor ss_ep_comp;
struct usb_ssp_isoc_ep_comp_descriptor ssp_isoc_ep_comp;
struct usb_eusb2_isoc_ep_comp_descriptor eusb2_isoc_ep_comp;
struct list_head urb_list;
void *hcpriv;
struct ep_device *ep_dev; /* For sysfs info */
unsigned char *extra; /* Extra descriptors */
int extralen;
int enabled;
int streams;
};
/* host-side wrapper for one interface setting's parsed descriptors */
struct usb_host_interface {
struct usb_interface_descriptor desc;
int extralen;
unsigned char *extra; /* Extra descriptors */
/* array of desc.bNumEndpoints endpoints associated with this
* interface setting. these will be in no particular order.
*/
struct usb_host_endpoint *endpoint;
char *string; /* iInterface string, if present */
};
enum usb_interface_condition {
USB_INTERFACE_UNBOUND = 0,
USB_INTERFACE_BINDING,
USB_INTERFACE_BOUND,
USB_INTERFACE_UNBINDING,
};
int __must_check
usb_find_common_endpoints(struct usb_host_interface *alt,
struct usb_endpoint_descriptor **bulk_in,
struct usb_endpoint_descriptor **bulk_out,
Annotation
- Immediate include surface: `linux/mod_devicetable.h`, `linux/usb/ch9.h`, `linux/errno.h`, `linux/delay.h`, `linux/interrupt.h`, `linux/list.h`, `linux/kref.h`, `linux/device.h`.
- Detected declarations: `struct usb_device`, `struct usb_driver`, `struct ep_device`, `struct usb_host_endpoint`, `struct usb_host_interface`, `struct usb_interface`, `struct usb_interface_cache`, `struct usb_host_config`, `struct usb_host_bos`, `struct usb_bus`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: pattern 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.