usb_ep_align_maybe(9)
π usb_ep_align_maybe(9)
okay so bestie, this is a page from the Kernel API Manual and honestly? it's a tiny little helper with main character energy π it does exactly one (1) thing and it does it slayfully. let's get into it β¨
πΈ NAME πΈ
usb_ep_align_maybe β returns len aligned to ep's maxpacketsize if the gadget requires quirk_ep_out_aligned_size, otherwise it just returns len as-is. no cap, that's the whole deal π
β¨ SYNOPSIS β¨
size_t usb_ep_align_maybe (struct usb_gadget *g , struct usb_ep *ep ,
size_t len );
like, three args in, one size_t out. clean. iconic. we love a simple signature π«Ά
π¦ ARGUMENTS π¦
gβ the controller we're checking for the quirk. yep, the gadget vibes get inspected here πepβ the endpoint whose maxpacketsize is used to alignlen. it's giving "the ruler" πlenβ the buffer size's length that we want to align toep's maxpacketsize π«
π DESCRIPTION π
so the way this works: this helper exists for in case it's required, for any reason, to check and maybe align a buffer's size to an ep's maxpacketsize. that's it. that's the function. "maybe" is literally in the name because sometimes it aligns and sometimes it doesn't β it reads the room first ππ
π SEE ALSO π
okay this is the part where the whole friend group shows up β the kernel file ./include/linux/usb/gadget.h and literally everyone in it:
struct usb_request(9)struct usb_ep_caps(9)struct usb_ep(9)free_usb_request(9)struct usb_gadget(9)usb_ep_align(9)gadget_is_altset_supported(9)gadget_is_stall_supported(9)gadget_is_zlp_supported(9)gadget_avoids_skb_reserve(9)gadget_is_dualspeed(9)gadget_is_superspeed(9)gadget_is_superspeed_plus(9)gadget_is_otg(9)struct usb_gadget_driver(9)usb_gadget_register_driver_owner(9)usb_gadget_unregister_driver(9)struct usb_string(9)struct usb_gadget_strings(9)usb_free_descriptors(9)
go read all of them, they're all in ./include/linux/usb and they all ate π₯
fr fr bestie, "maybe" is the whole personality here β don't assume it aligned anything, check the return value ππ
mwah, that's the page! π this was filed under ./include/linux/usb and dated October 2026 β see you in the next one, iykyk πΈβπ§
π¦ 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