drivers/usb/misc/usbio.c
Source file repositories/reference/linux-study-clean/drivers/usb/misc/usbio.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/misc/usbio.c- Extension
.c- Size
- 19415 bytes
- Lines
- 753
- 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/acpi.hlinux/auxiliary_bus.hlinux/byteorder/generic.hlinux/cleanup.hlinux/completion.hlinux/dev_printk.hlinux/device.hlinux/lockdep.hlinux/mutex.hlinux/string.hlinux/types.hlinux/usb.hlinux/usb/usbio.h
Detected Declarations
struct usbio_protverstruct usbio_fwverstruct usbio_devicestruct usbio_clientstruct usbio_match_ids_walk_datafunction usbio_ctrl_msgfunction usbio_control_msgfunction usbio_bulk_recvfunction usbio_bulk_msgfunction usbio_acquirefunction usbio_releasefunction usbio_get_txrxbuf_lenfunction usbio_get_quirksfunction usbio_auxdev_releasefunction usbio_add_clientfunction usbio_enum_gpiosfunction usbio_enum_i2csfunction usbio_suspendfunction usbio_resumefunction usbio_disconnectfunction list_for_each_entry_reversefunction usbio_probefunction usbio_match_device_idsfunction usbio_acpi_bind
Annotated Snippet
struct usbio_protver {
u8 ver;
} __packed;
struct usbio_fwver {
u8 major;
u8 minor;
__le16 patch;
__le16 build;
} __packed;
/***********************************
* USBIO Bridge Device Definitions *
***********************************/
/**
* struct usbio_device - the usb device exposing IOs
*
* @dev: the device in the usb interface
* @udev: the detected usb device
* @intf: the usb interface
* @quirks: quirks
* @ctrl_mutex: protects ctrl_buf
* @ctrl_pipe: the control transfer pipe
* @ctrlbuf_len: the size of the control transfer pipe
* @ctrlbuf: the buffer used for control transfers
* @bulk_mutex: protects tx_buf, rx_buf and split bulk-transfers getting interrupted
* @tx_pipe: the bulk out pipe
* @txbuf_len: the size of the bulk out pipe
* @txbuf: the buffer used for bulk out transfers
* @rx_pipe: the bulk in pipe
* @rxbuf_len: the size of the bulk in pipe
* @rxdat_len: the data length at rx buffer
* @rxbuf: the buffer used for bulk in transfers
* @urb: the urb to read bulk pipe
* @done: completion object as request is done
* @cli_list: device's client list
* @nr_gpio_banks: Number of GPIO banks
* @gpios: GPIO bank descriptors
* @nr_gpio_banks: Number of I2C busses
* @gpios: I2C bank descriptors
*/
struct usbio_device {
struct device *dev;
struct usb_device *udev;
struct usb_interface *intf;
unsigned long quirks;
struct mutex ctrl_mutex;
unsigned int ctrl_pipe;
u16 ctrlbuf_len;
void *ctrlbuf;
struct mutex bulk_mutex;
unsigned int tx_pipe;
u16 txbuf_len;
void *txbuf;
unsigned int rx_pipe;
u16 rxbuf_len;
u16 rxdat_len;
void *rxbuf;
struct urb *urb;
struct completion done;
struct list_head cli_list;
unsigned int nr_gpio_banks;
struct usbio_gpio_bank_desc gpios[USBIO_MAX_GPIOBANKS];
unsigned int nr_i2c_buses;
struct usbio_i2c_bus_desc i2cs[USBIO_MAX_I2CBUSES];
};
/**
* struct usbio_client - represents a usbio client
*
* @auxdev: auxiliary device object
* @mutex: protects @bridge
* @bridge: usbio bridge who service the client
* @link: usbio bridge clients list member
*/
struct usbio_client {
struct auxiliary_device auxdev;
struct mutex mutex;
struct usbio_device *bridge;
struct list_head link;
};
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/auxiliary_bus.h`, `linux/byteorder/generic.h`, `linux/cleanup.h`, `linux/completion.h`, `linux/dev_printk.h`, `linux/device.h`, `linux/lockdep.h`.
- Detected declarations: `struct usbio_protver`, `struct usbio_fwver`, `struct usbio_device`, `struct usbio_client`, `struct usbio_match_ids_walk_data`, `function usbio_ctrl_msg`, `function usbio_control_msg`, `function usbio_bulk_recv`, `function usbio_bulk_msg`, `function usbio_acquire`.
- 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.