Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 361244
b: refs/heads/master
c: bc530a7
h: refs/heads/master
v: v3
  • Loading branch information
Felipe Balbi committed Mar 4, 2013
1 parent ed99ab8 commit 61e7782
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9992a9979fd463903e1a34b68d609441f36bafd4
refs/heads/master: bc530a72726d54357ea3a10e82761f203201e5b2
20 changes: 8 additions & 12 deletions trunk/drivers/usb/gadget/imx_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1334,27 +1334,18 @@ static int imx_udc_start(struct usb_gadget *gadget,
struct usb_gadget_driver *driver)
{
struct imx_udc_struct *imx_usb;
int retval;

imx_usb = container_of(gadget, struct imx_udc_struct, gadget);
/* first hook up the driver ... */
imx_usb->driver = driver;
imx_usb->gadget.dev.driver = &driver->driver;

retval = device_add(&imx_usb->gadget.dev);
if (retval)
goto fail;

D_INI(imx_usb->dev, "<%s> registered gadget driver '%s'\n",
__func__, driver->driver.name);

imx_udc_enable(imx_usb);

return 0;
fail:
imx_usb->driver = NULL;
imx_usb->gadget.dev.driver = NULL;
return retval;
}

static int imx_udc_stop(struct usb_gadget *gadget,
Expand All @@ -1370,8 +1361,6 @@ static int imx_udc_stop(struct usb_gadget *gadget,
imx_usb->gadget.dev.driver = NULL;
imx_usb->driver = NULL;

device_del(&imx_usb->gadget.dev);

D_INI(imx_usb->dev, "<%s> unregistered gadget driver '%s'\n",
__func__, driver->driver.name);

Expand Down Expand Up @@ -1477,6 +1466,10 @@ static int __init imx_udc_probe(struct platform_device *pdev)
imx_usb->gadget.dev.parent = &pdev->dev;
imx_usb->gadget.dev.dma_mask = pdev->dev.dma_mask;

ret = device_add(&imx_usb->gadget.dev);
if (retval)
goto fail4;

platform_set_drvdata(pdev, imx_usb);

usb_init_data(imx_usb);
Expand All @@ -1488,9 +1481,11 @@ static int __init imx_udc_probe(struct platform_device *pdev)

ret = usb_add_gadget_udc(&pdev->dev, &imx_usb->gadget);
if (ret)
goto fail4;
goto fail5;

return 0;
fail5:
device_unregister(&imx_usb->gadget.dev);
fail4:
for (i = 0; i < IMX_USB_NB_EP + 1; i++)
free_irq(imx_usb->usbd_int[i], imx_usb);
Expand All @@ -1514,6 +1509,7 @@ static int __exit imx_udc_remove(struct platform_device *pdev)
int i;

usb_del_gadget_udc(&imx_usb->gadget);
device_unregister(&imx_usb->gadget.dev);
imx_udc_disable(imx_usb);
del_timer(&imx_usb->timer);

Expand Down

0 comments on commit 61e7782

Please sign in to comment.