[22/67] usb: dwc3: gadget: set state to NOT_ATTACHED on disconnect_irq

Message ID 1413566234-13537-23-git-send-email-balbi@ti.com
State Accepted
Commit 06a374ed13fdb7c6b2edd8cbdcf52bd1b0cc67b9
Headers show

Commit Message

Felipe Balbi Oct. 17, 2014, 5:16 p.m.
whenever we get a Disconnect Interrupt, we should
make sure to update out udc state to NOT_ATTACHED,
otherwise sysfs will show wrong values.

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 drivers/usb/dwc3/gadget.c | 1 +
 1 file changed, 1 insertion(+)

Patch

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 89cfdbf..d08666d 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2141,6 +2141,7 @@  static void dwc3_gadget_disconnect_interrupt(struct dwc3 *dwc)
 
 	dwc->gadget.speed = USB_SPEED_UNKNOWN;
 	dwc->setup_packet_pending = false;
+	usb_gadget_set_state(&dwc->gadget, USB_STATE_NOTATTACHED);
 }
 
 static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc)