[PATCH] usb: bdc: change state when port disconnected

From: justinpopo6
Date: Wed Oct 05 2022 - 15:14:53 EST


From: Justin Chen <justinpopo6@xxxxxxxxx>

When port is connected and then disconnected, the state stays as
configured. Which is incorrect as the port is no longer configured,
but in a not attached state.

Signed-off-by: Justin Chen <justinpopo6@xxxxxxxxx>
---
drivers/usb/gadget/udc/bdc/bdc_udc.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/udc/bdc/bdc_udc.c b/drivers/usb/gadget/udc/bdc/bdc_udc.c
index 5ac0ef8..53ffaf4 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_udc.c
+++ b/drivers/usb/gadget/udc/bdc/bdc_udc.c
@@ -151,6 +151,7 @@ static void bdc_uspc_disconnected(struct bdc *bdc, bool reinit)
bdc->delayed_status = false;
bdc->reinit = reinit;
bdc->test_mode = false;
+ usb_gadget_set_state(&bdc->gadget, USB_STATE_NOTATTACHED);
}

/* TNotify wkaeup timer */
--
2.7.4