mirror-linux/drivers/usb/musb
Drew Hamilton 67a59f8219 usb: musb: fix gadget state on disconnect
When unplugging the USB cable or disconnecting a gadget in usb peripheral mode with
echo "" > /sys/kernel/config/usb_gadget/<your_gadget>/UDC,
/sys/class/udc/musb-hdrc.0/state does not change from USB_STATE_CONFIGURED.

Testing on dwc2/3 shows they both update the state to USB_STATE_NOTATTACHED.

Add calls to usb_gadget_set_state in musb_g_disconnect and musb_gadget_stop
to fix both cases.

Fixes: 49401f4169 ("usb: gadget: introduce gadget state tracking")
Cc: stable@vger.kernel.org
Co-authored-by: Yehowshua Immanuel <yehowshua.immanuel@twosixtech.com>
Signed-off-by: Yehowshua Immanuel <yehowshua.immanuel@twosixtech.com>
Signed-off-by: Drew Hamilton <drew.hamilton@zetier.com>
Link: https://lore.kernel.org/r/20250701154126.8543-1-drew.hamilton@zetier.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-07-07 10:58:15 +02:00
..
Kconfig usb: use "prompt" instead of "bool" for choice prompts 2024-11-04 17:53:09 +09:00
Makefile
cppi_dma.h
da8xx.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
jz4740.c usb: musb: Constify struct musb_fifo_cfg 2025-02-03 16:29:53 +01:00
mediatek.c usb: musb: Constify struct musb_fifo_cfg 2025-02-03 16:29:53 +01:00
mpfs.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
musb_core.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
musb_core.h
musb_cppi41.c usb: musb: cppi41: Switch to use hrtimer_setup() 2025-02-18 11:19:02 +01:00
musb_debug.h
musb_debugfs.c
musb_dma.h
musb_dsps.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
musb_gadget.c usb: musb: fix gadget state on disconnect 2025-07-07 10:58:15 +02:00
musb_gadget.h
musb_gadget_ep0.c drivers/usb/musb: refactor min/max with min_t/max_t 2024-11-13 15:09:51 +01:00
musb_host.c USB: Use str_enable_disable-like helpers 2025-01-15 18:28:13 +01:00
musb_host.h
musb_io.h
musb_regs.h
musb_trace.c
musb_trace.h tracing/treewide: Remove second parameter of __assign_str() 2024-05-22 20:14:47 -04:00
musb_virthub.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
musbhsdma.c
omap2430.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
omap2430.h
sunxi.c usb: musb: Constify struct musb_fifo_cfg 2025-02-03 16:29:53 +01:00
tusb6010.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
tusb6010.h
tusb6010_omap.c
ux500.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ux500_dma.c