usb_register_bus(9)
π usb_register_bus(9) β like, the Kernel API Manual page you actually wanna read π
okay so bestie, this is usb_register_bus from the Kernel API Manual, and honestly? it's lowkey the moment your USB host controller officially becomes A Somebody. let's get into it β¨
πΈ NAME πΈ
usb_register_bus β registers the USB host controller with the usb core
that's it. that's the whole vibe. your controller goes from "random struct in the void" to "known and loved by usbcore" π«Ά
β¨ SYNOPSIS β¨
int usb_register_bus (struct usb_bus *bus );
literally one function, one argument, returns an int. no cap, that's the whole signature π
π¦ ARGUMENTS π¦
busβ pointer to the bus to register. yes girl, hand over yourstruct usb_bus *and let the kernel do its thing π
π CONTEXT π
task context, might sleep.
ngl this is the important part: it runs in task context and it might sleep, so do NOT call it from somewhere sleepy-unsafe. periodt. π
π DESCRIPTION π
So what does it actually do? Two iconic jobs:
- Assigns a bus number β your bus gets its very own number, main character energy π
- Links the controller into usbcore data structures β so that it can be seen by scanning the bus list π₯
that's the whole glow-up: number assigned, controller linked in, now the rest of usbcore can find it by scanning the bus list. slay. β¨
β RETURN β
0if successful π- A negative error code otherwise π
so like, check the return value, bestie. 0 = we ate. negative = vibe check failed π
π§ SEE ALSO π§
Kernel file ./drivers/usb/core/hcd.c, plus a whole friend group of functions β all of these, in this exact order, no notes:
ascii2desc(9)rh_string(9)usb_bus_init(9)usb_deregister_bus(9)register_root_hub(9)usb_calc_bus_time(9)usb_hcd_link_urb_to_ep(9)usb_hcd_check_unlink_urb(9)usb_hcd_unlink_urb_from_ep(9)usb_hcd_giveback_urb(9)usb_hcd_alloc_bandwidth(9)usb_hcd_reset_endpoint(9)usb_alloc_streams(9)usb_free_streams(9)usb_hcd_resume_root_hub(9)usb_bus_start_enum(9)usb_hcd_irq(9)usb_hc_died(9)usb_create_shared_hcd(9)usb_create_hcd(9)usb_stop_hcd(9)usb_add_hcd(9)usb_remove_hcd(9)
iykyk π
and that's the page!! π«Ά this lil beauty lives in ./drivers/usb/core, dated October 2026 β go read the source, it's giving iconic. bye bestie, 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