usb_gadget_u...ister_driver(9)
π usb_gadget_u...ister_driver(9) β Kernel API Manual β¨
okay bestie, welcome to the Kernel API Manual, and today's main character is usb_gadget_unregister_driver π she's the goodbye girl, the one you call when your gadget driver is packing its bags. let's get into it π
β¨ NAME β¨
usb_gadget_unregister_driver β unregister a gadget driver π«Ά like, she's leaving the group chat and you have to tell everyone.
π¦ SYNOPSIS π¦
int usb_gadget_unregister_driver (struct usb_gadget_driver *driver );
that's it. one function, one pointer, one very final vibe check π
πΈ ARGUMENTS πΈ
driverβ the driver being unregistered β¨ yeah she's the one getting un-registered. the driver in question. the departing icon π
π CONTEXT π
can sleep π΄ lowkey the chillest context note ever β no cap, this one is allowed to snooze, fr fr. no atomic-zone stress, no "not me in interrupt context" panic π
π DESCRIPTION π
so here's the tea π: you call this in your gadget driver's module cleanup function, to tell the underlying usb controller that your driver is going away. it's giving "hey bestie, i'm heading out, just letting you know" π«Ά
if the controller is connected to a USB host, it will first disconnect πβ¨ like, she unplugs before she leaves the party. no awkward lingering, periodt.
the driver is also requested to unbind and clean up any device state, before this procedure finally returns π§Ήπ so like, tidy up your room before you go, the whole "unbind and clean up" thing happens before the function hands control back to you.
β οΈ important caveat alert β οΈ it's expected that the unbind functions will be in exit sections, so they may not be linked in some kernels ππ so like, don't go assuming they're always there, iykyk. plan accordingly, bestie.
π SEE ALSO π
- Kernel file
./include/linux/usb/gadget.hπ 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)πusb_ep_align_maybe(9)π€gadget_is_altset_supported(9)βgadget_is_stall_supported(9)πgadget_is_zlp_supported(9)0οΈβ£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)πstruct usb_string(9)π€struct usb_gadget_strings(9)π§΅usb_free_descriptors(9)ποΈ
like, that's a whole friend group right there, go say hi π
π reminder bestie: unregistering is a safe-to-sleep operation, the disconnect happens first if a USB host is attached, and your unbind functions live in exit sections that may be gone entirely in some kernels. that last bit is the one that gets people, ngl. π
okay that's the whole page!! slayed, no cap π this cutie came from ./include/linux/usb and she's dated October 2026 β stamped and titled usb_gadget_u...ister_driver(9), so you know exactly where to find her. 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