usb: dwc2: gadget: fix gadget unregistration in udc_stop() function
authorMarek Szyprowski <m.szyprowski@samsung.com>
Mon, 20 Oct 2014 10:45:33 +0000 (12:45 +0200)
committerFelipe Balbi <balbi@ti.com>
Thu, 23 Oct 2014 18:57:08 +0000 (13:57 -0500)
udc_stop() should clear ->driver pointer unconditionally to let the UDC
framework to work correctly with both registering/unregistering gadgets
and enabling/disabling gadgets by writing to
/sys/class/udc/*hsotg/soft_connect interface.

Acked-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/dwc2/gadget.c

index 7f25527..5e548f7 100644 (file)
@@ -2937,9 +2937,7 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget,
 
        spin_lock_irqsave(&hsotg->lock, flags);
 
-       if (!driver)
-               hsotg->driver = NULL;
-
+       hsotg->driver = NULL;
        hsotg->gadget.speed = USB_SPEED_UNKNOWN;
 
        spin_unlock_irqrestore(&hsotg->lock, flags);