usb_ep_alloc_request(9)
π usb_ep_alloc_request β the Kernel API Manual glow-up β¨
okay so bestie, welcome to usb_ep_alloc_request(9) from the Kernel API Manual. yes, that's the whole title. it's giving "very official, very serious" but honestly? the function itself is a whole mood and we're gonna get into it. π
β¨ NAME β¨
usb_ep_alloc_request β allocate a request object to use with this endpoint. that's it, that's the job, and it does it iconically. π¦
πΈ SYNOPSIS πΈ
struct usb_request * usb_ep_alloc_request (struct usb_ep *ep , gfp_t gfp_flags );
look at that signature. clean. precise. main character energy fr fr. π
π ARGUMENTS π
epβ the endpoint that's gonna be used with the request. your little buddy for this whole operation. π«Άgfp_flagsβ theGFP_*flags to use. yes, the allocation flags, hand them over, be honest about them. β¨
π DESCRIPTION π
okay so here's the tea β β request objects must be allocated with this call. like, not optional, not "you could also just kmalloc it", no. this is the way. why? because they normally need controller-specific setup, and they may even need endpoint-specific resources, such as allocation of DMA descriptors. that's real resource allocation happening under the hood, bestie. π
once you've got your request, requests may be submitted with usb_ep_queue, and they receive a single completion callback. one. single. callback. no cap. π―
when you're done with it and it's no longer needed, free requests with usb_ep_free_request. please. don't just leave it lying around, that's not the vibe. π§
β¨ Returns the request, or null if one could not be allocated. yes, null β check for it, don't get caught out. π
π SEE ALSO π
the whole friend group showed up for this one, and we're listing every single one of them because nobody gets left out:
Kernel file ./drivers/usb/gadget/udc/core.c struct usb_udc(9)usb_ep_set_maxpacket_limit(9)usb_ep_enable(9)usb_ep_disable(9)usb_ep_free_request(9)usb_ep_queue(9)usb_ep_dequeue(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)
like, the entire USB gadget udc extended universe. iykyk. π
and that's the page, bestie!! π so much love to ./drivers/usb/gadget/udc for being the source of all this, and a big sparkly shoutout to October 2026 for the date on this iconic little doc. mwah. πβπ
π¦ 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