]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
usb: ci_udc: call udc_disconnect() from ci_pullup()
authorStephen Warren <swarren@nvidia.com>
Tue, 10 Jun 2014 17:02:35 +0000 (11:02 -0600)
committerMarek Vasut <marex@denx.de>
Wed, 11 Jun 2014 00:26:05 +0000 (02:26 +0200)
ci_pullup()'s !is_on path contains a cut/paste copy of udc_disconnect().
Remove the duplication by simply calling udc_disconnect() instead.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
drivers/usb/gadget/ci_udc.c

index 6dc20c6c954c5a6b6ef4916946aabb20b041fb71..5f308563e2462246469a0bb2ea1757c4ef2a7d4f 100644 (file)
@@ -697,6 +697,17 @@ int usb_gadget_handle_interrupts(void)
        return value;
 }
 
+void udc_disconnect(void)
+{
+       struct ci_udc *udc = (struct ci_udc *)controller.ctrl->hcor;
+       /* disable pullup */
+       stop_activity();
+       writel(USBCMD_FS2, &udc->usbcmd);
+       udelay(800);
+       if (controller.driver)
+               controller.driver->disconnect(&controller.gadget);
+}
+
 static int ci_pullup(struct usb_gadget *gadget, int is_on)
 {
        struct ci_udc *udc = (struct ci_udc *)controller.ctrl->hcor;
@@ -715,27 +726,12 @@ static int ci_pullup(struct usb_gadget *gadget, int is_on)
                /* Turn on the USB connection by enabling the pullup resistor */
                writel(USBCMD_ITC(MICRO_8FRAME) | USBCMD_RUN, &udc->usbcmd);
        } else {
-               stop_activity();
-               writel(USBCMD_FS2, &udc->usbcmd);
-               udelay(800);
-               if (controller.driver)
-                       controller.driver->disconnect(gadget);
+               udc_disconnect();
        }
 
        return 0;
 }
 
-void udc_disconnect(void)
-{
-       struct ci_udc *udc = (struct ci_udc *)controller.ctrl->hcor;
-       /* disable pullup */
-       stop_activity();
-       writel(USBCMD_FS2, &udc->usbcmd);
-       udelay(800);
-       if (controller.driver)
-               controller.driver->disconnect(&controller.gadget);
-}
-
 static int ci_udc_probe(void)
 {
        struct ept_queue_head *head;