usb_udc_vbus_handler(9)
β¨ NAME β¨
okay so bestie, welcome to the page for usb_udc_vbus_handler(9) from the Kernel API Manual π«Ά This is the function that updates the udc core vbus status, and try to connect or disconnect gadget. That's the name-section tea β.
π SYNOPSIS π
void usb_udc_vbus_handler (struct usb_gadget *gadget , bool status );
yep, it returns void β nothing comes back out, bestie π
.
π ARGUMENTS π
gadgetβ the gadget where the vbus change occurs. That's the one getting the vbus update.statusβ the vbus status. That's it, that's the argument πΈ.
π DESCRIPTION π
The udc driver calls it when it wants to connect or disconnect the gadget according to vbus status. Simple vibe on the surface, right? β¨
Now the important context check, because this is where people get got π This function can be invoked from interrupt context by irq handlers of the gadget drivers. However, usb_udc_connect_control has to run in non-atomic context due to the following:
- Some of the gadget driver implementations expect the
->pullupcallback to be invoked in non-atomic context. usb_gadget_disconnectacquiresudc_lock, which is a mutex.
Hence, the invocation of usb_udc_connect_control is offloaded to a workqueue. So yeah: interrupt context for this function? fine. usb_udc_connect_control in atomic context? absolutely not, bestie π context rules ate here.
π SEE ALSO π
go read these too, iykyk π:
- 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_alloc_request(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_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)
mwah π that's the page! source/version: ./drivers/usb/gadget/udc Β· date: October 2026 Β· page: usb_udc_vbus_handler(9) π«Ά
π¦ 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