usb_hcd_link_urb_to_ep(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay so bestie, welcome to the Kernel API Manual β€” yes we're in kernel land now, bring your sparkle πŸ¦‹


πŸŽ€ NAME πŸŽ€

usb_hcd_link_urb_to_ep β€” literally just adds an URB to its endpoint queue, that's the whole vibe πŸ’…


🌸 SYNOPSIS 🌸

int usb_hcd_link_urb_to_ep (struct usb_hcd *hcd , struct urb *urb );

πŸ’– ARGUMENTS πŸ’–

  • hcd β€” the host controller that urb got submitted to, aka the main character here πŸ‘‘
  • urb β€” the URB that's being submitted, the little guy we're linking up 🫢

🌈 DESCRIPTION 🌈

okay so here's the tea: host controller drivers should call this routine inside their enqueue method. no cap, that's where it goes 🎯

⚠️ the HCD's private spinlock must be held and interrupts must be disabled. like, both. don't skip this, i'm begging 😭

the actions carried out here are required for URB submission, plus for endpoint shutdown, plus for usb_kill_urb. all three, same little function, iconic behaviour honestly πŸ’€βœ¨


⭐ RETURN ⭐

  • 0 β€” no error, we slayed πŸ’…
  • otherwise β€” a negative error code, and in that case the enqueue method must fail, periodt

and if no error occurs but enqueue fails anyway? then it must call usb_hcd_unlink_urb_from_ep before releasing the private spinlock and returning. do not forget this step bestie, it's giving "required cleanup" πŸ™ˆ


🧚 SEE ALSO 🧚

kernel file ./drivers/usb/core/hcd.c β€” go read it, iykyk πŸ“–

then the whole friend group, in this exact order:


and that's the page!! 🌸 this lil gem lives in ./drivers/usb/core, dated October 2026, and it's filed under usb_hcd_link_urb_to_ep(9) in the Kernel API Manual β€” mwah, go forth and link urbs responsibly πŸ’œβœ¨πŸŽ€

πŸ“¦ where this page comes from