usb: gadget: f_acm: Allow restarting ACM console after stopping it
authorStephan Gerhold <stephan.gerhold@linaro.org>
Mon, 7 Apr 2025 14:59:36 +0000 (16:59 +0200)
committerMattijs Korpershoek <mkorpershoek@kernel.org>
Wed, 23 Apr 2025 07:50:52 +0000 (09:50 +0200)
commit22b5aad20ae0f17bd9617fb9c10ddb38d2b91920
tree797eef571395d0be13830c8ed75d2ca9a577b442
parenteeef1223025c68bd546a1f9411bdcdf518f8cb97
usb: gadget: f_acm: Allow restarting ACM console after stopping it

When using IOMUX, the "usbacm" console can be added/removed dynamically
from the stdout/stderr/stdin environment variables to allow temporarily
starting other USB gadgets (e.g. Fastboot).

However, right now acm_stdio_stop() does not completely undo
acm_stdio_start(): The USB gadget is unregistered, but as long as dev->priv
stays set acm_stdio_start() will never register the USB gadget again.

Clear dev->priv after we detach to make sure a start operation after a stop
operation registers the gadget again.

Fixes: fc2b399ac03b ("usb: gadget: Add CDC ACM function")
Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
Link: https://lore.kernel.org/r/20250407-acm-fixes-v1-2-e3dcb592d6d6@linaro.org
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
drivers/usb/gadget/f_acm.c