drivers/usb/usbip/vudc_transfer.c
Source file repositories/reference/linux-study-clean/drivers/usb/usbip/vudc_transfer.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/usbip/vudc_transfer.c- Extension
.c- Size
- 11993 bytes
- Lines
- 498
- Domain
- Driver Families
- Bucket
- drivers/usb
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/usb.hlinux/timer.hlinux/usb/ch9.hvudc.h
Detected Declarations
function Copyrightfunction handle_control_requestfunction transferfunction v_timerfunction v_init_timerfunction v_start_timerfunction v_kick_timerfunction v_stop_timer
Annotated Snippet
if (setup->bRequestType == DEV_REQUEST) {
ret_val = 0;
switch (w_value) {
case USB_DEVICE_REMOTE_WAKEUP:
break;
case USB_DEVICE_B_HNP_ENABLE:
udc->gadget.b_hnp_enable = 1;
break;
case USB_DEVICE_A_HNP_SUPPORT:
udc->gadget.a_hnp_support = 1;
break;
case USB_DEVICE_A_ALT_HNP_SUPPORT:
udc->gadget.a_alt_hnp_support = 1;
break;
default:
ret_val = -EOPNOTSUPP;
}
if (ret_val == 0) {
udc->devstatus |= (1 << w_value);
*status = 0;
}
} else if (setup->bRequestType == EP_REQUEST) {
/* endpoint halt */
ep2 = vudc_find_endpoint(udc, w_index);
if (!ep2 || ep2->ep.name == udc->ep[0].ep.name) {
ret_val = -EOPNOTSUPP;
break;
}
ep2->halted = 1;
ret_val = 0;
*status = 0;
}
break;
case USB_REQ_CLEAR_FEATURE:
if (setup->bRequestType == DEV_REQUEST) {
ret_val = 0;
switch (w_value) {
case USB_DEVICE_REMOTE_WAKEUP:
w_value = USB_DEVICE_REMOTE_WAKEUP;
break;
case USB_DEVICE_U1_ENABLE:
case USB_DEVICE_U2_ENABLE:
case USB_DEVICE_LTM_ENABLE:
ret_val = -EOPNOTSUPP;
break;
default:
ret_val = -EOPNOTSUPP;
break;
}
if (ret_val == 0) {
udc->devstatus &= ~(1 << w_value);
*status = 0;
}
} else if (setup->bRequestType == EP_REQUEST) {
/* endpoint halt */
ep2 = vudc_find_endpoint(udc, w_index);
if (!ep2) {
ret_val = -EOPNOTSUPP;
break;
}
if (!ep2->wedged)
ep2->halted = 0;
ret_val = 0;
*status = 0;
}
break;
case USB_REQ_GET_STATUS:
if (setup->bRequestType == DEV_INREQUEST
|| setup->bRequestType == INTF_INREQUEST
|| setup->bRequestType == EP_INREQUEST) {
char *buf;
/*
* device: remote wakeup, selfpowered
* interface: nothing
* endpoint: halt
*/
buf = (char *)urb->transfer_buffer;
if (urb->transfer_buffer_length > 0) {
if (setup->bRequestType == EP_INREQUEST) {
ep2 = vudc_find_endpoint(udc, w_index);
if (!ep2) {
ret_val = -EOPNOTSUPP;
break;
}
buf[0] = ep2->halted;
} else if (setup->bRequestType ==
DEV_INREQUEST) {
buf[0] = (u8)udc->devstatus;
} else
Annotation
- Immediate include surface: `linux/usb.h`, `linux/timer.h`, `linux/usb/ch9.h`, `vudc.h`.
- Detected declarations: `function Copyright`, `function handle_control_request`, `function transfer`, `function v_timer`, `function v_init_timer`, `function v_start_timer`, `function v_kick_timer`, `function v_stop_timer`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: source 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.