From: Stephan Gerhold Date: Mon, 7 Apr 2025 14:59:36 +0000 (+0200) Subject: usb: gadget: f_acm: Allow restarting ACM console after stopping it X-Git-Tag: v2025.07-rc1~21^2~2 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22b5aad20ae0f17bd9617fb9c10ddb38d2b91920;p=pandora-u-boot.git 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 Reviewed-by: Mattijs Korpershoek Link: https://lore.kernel.org/r/20250407-acm-fixes-v1-2-e3dcb592d6d6@linaro.org Signed-off-by: Mattijs Korpershoek --- diff --git a/drivers/usb/gadget/f_acm.c b/drivers/usb/gadget/f_acm.c index 2665fa4168f..8f7256069f5 100644 --- a/drivers/usb/gadget/f_acm.c +++ b/drivers/usb/gadget/f_acm.c @@ -663,6 +663,7 @@ static int acm_stdio_stop(struct stdio_dev *dev) { g_dnl_unregister(); g_dnl_clear_detach(); + dev->priv = NULL; return 0; }