usb_ep_dequeue(9)
π usb_ep_dequeue(9) π
okay bestie, welcome to the Kernel API Manual β this one's about cancelling an I/O request on an endpoint, and it's honestly kind of a vibe. let's get into it π
β¨ NAME β¨
usb_ep_dequeue β dequeues (cancels, unlinks) an I/O request from an endpoint π
πΈ SYNOPSIS πΈ
int usb_ep_dequeue (struct usb_ep *ep , struct usb_request *req );
π¦ ARGUMENTS π¦
epβ the endpoint that's associated with the request, aka where the drama is happening πreqβ the request being canceled, the main character getting pulled off stage π
π DESCRIPTION π
so here's the tea: if the request is still active on the endpoint, it gets dequeued, and eventually its completion routine is called β with status -ECONNRESET. if it's not active? you get a negative error code back. rude, but fair. π
and the important part β this routine is asynchronous. that means it may return before the completion routine runs. so don't go assuming the thing is done-done just because the call came back, ok? fr fr.
β οΈ okay this next bit lowkey matters a lot: some hardware can't clear out write fifos (that's how you'd unlink the request sitting at the head of the queue) except as part of disconnecting from usb. and those restrictions? they prevent drivers from supporting configuration changes, even changes to configuration zero β which, yes, is a "chapter 9" requirement. so like... the hardware said no and the spec said yes. iconic conflict, honestly. π
one more thing and it's good news: this routine may be called in interrupt context. slay. β
π SEE ALSO π
Kernel file ./drivers/usb/gadget/udc/core.c, plus the whole friend group:
struct usb_udc(9), usb_ep_set_maxpacket_limit(9), usb_ep_enable(9), usb_ep_disable(9), usb_ep_alloc_request(9), usb_ep_free_request(9), usb_ep_queue(9), usb_ep_set_halt(9), usb_ep_clear_halt(9), usb_ep_set_wedge(9), usb_ep_fifo_status(9), usb_ep_fifo_flush(9), usb_gadget_frame_number(9), usb_gadget_wakeup(9), usb_gadget_set_remote_wakeup(9), usb_gadget_set_selfpowered(9), usb_gadget_clear_selfpowered(9), usb_gadget_vbus_connect(9), usb_gadget_vbus_draw(9), usb_gadget_vbus_disconnect(9), usb_gadget_connect(9), usb_gadget_disconnect(9), usb_gadget_deactivate(9), usb_gadget_activate(9), usb_gadget_giveback_request(9), gadget_find_ep_by_name(9), usb_gadget_check_config(9), usb_udc_vbus_handler(9), usb_gadget_udc_reset(9), usb_gadget_udc_start_locked(9), usb_gadget_udc_stop_locked(9), usb_gadget_udc_set_speed(9), usb_gadget_enable_async_callbacks(9), usb_gadget_disable_async_callbacks(9), usb_udc_release(9), usb_initialize_gadget(9), usb_add_gadget(9), usb_add_gadget_udc_release(9), usb_get_gadget_udc_name(9), usb_add_gadget_udc(9), usb_del_gadget(9), usb_del_gadget_udc(9)
and that's the whole page, bestie!! π«Ά this lil masterpiece lives in ./drivers/usb/gadget/udc and it's dated October 2026 β go forth and dequeue responsibly π
β¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms