musb_core: don't call musb_platform_exit() twice
musb_platform_exit() is called twice from musb_init_controller() iff controller initialization fails. Move the call (and the DevCtl register writes surrounding it) from musb_free() to musb_remove(). Fix mispalced and now incorrect 'goto's in musb_init_controller(). Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
7917a9df73
commit
461972d8a4
1 changed files with 7 additions and 10 deletions
|
@ -1851,10 +1851,6 @@ static void musb_free(struct musb *musb)
|
||||||
put_device(musb->xceiv->dev);
|
put_device(musb->xceiv->dev);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
|
|
||||||
musb_platform_exit(musb);
|
|
||||||
musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
|
|
||||||
|
|
||||||
#ifdef CONFIG_USB_MUSB_HDRC_HCD
|
#ifdef CONFIG_USB_MUSB_HDRC_HCD
|
||||||
usb_put_hcd(musb_to_hcd(musb));
|
usb_put_hcd(musb_to_hcd(musb));
|
||||||
#else
|
#else
|
||||||
|
@ -2032,8 +2028,6 @@ bad_config:
|
||||||
musb->xceiv->state = OTG_STATE_A_IDLE;
|
musb->xceiv->state = OTG_STATE_A_IDLE;
|
||||||
|
|
||||||
status = usb_add_hcd(musb_to_hcd(musb), -1, 0);
|
status = usb_add_hcd(musb_to_hcd(musb), -1, 0);
|
||||||
if (status)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
DBG(1, "%s mode, status %d, devctl %02x %c\n",
|
DBG(1, "%s mode, status %d, devctl %02x %c\n",
|
||||||
"HOST", status,
|
"HOST", status,
|
||||||
|
@ -2048,8 +2042,6 @@ bad_config:
|
||||||
musb->xceiv->state = OTG_STATE_B_IDLE;
|
musb->xceiv->state = OTG_STATE_B_IDLE;
|
||||||
|
|
||||||
status = musb_gadget_setup(musb);
|
status = musb_gadget_setup(musb);
|
||||||
if (status)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
DBG(1, "%s mode, status %d, dev%02x\n",
|
DBG(1, "%s mode, status %d, dev%02x\n",
|
||||||
is_otg_enabled(musb) ? "OTG" : "PERIPHERAL",
|
is_otg_enabled(musb) ? "OTG" : "PERIPHERAL",
|
||||||
|
@ -2057,12 +2049,14 @@ bad_config:
|
||||||
musb_readb(musb->mregs, MUSB_DEVCTL));
|
musb_readb(musb->mregs, MUSB_DEVCTL));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (status < 0)
|
||||||
|
goto fail2;
|
||||||
|
|
||||||
#ifdef CONFIG_SYSFS
|
#ifdef CONFIG_SYSFS
|
||||||
status = sysfs_create_group(&musb->controller->kobj, &musb_attr_group);
|
status = sysfs_create_group(&musb->controller->kobj, &musb_attr_group);
|
||||||
#endif
|
|
||||||
if (status)
|
if (status)
|
||||||
goto fail2;
|
goto fail2;
|
||||||
|
#endif
|
||||||
|
|
||||||
dev_info(dev, "USB %s mode controller at %p using %s, IRQ %d\n",
|
dev_info(dev, "USB %s mode controller at %p using %s, IRQ %d\n",
|
||||||
({char *s;
|
({char *s;
|
||||||
|
@ -2125,7 +2119,6 @@ static int __init musb_probe(struct platform_device *pdev)
|
||||||
/* clobbered by use_dma=n */
|
/* clobbered by use_dma=n */
|
||||||
orig_dma_mask = dev->dma_mask;
|
orig_dma_mask = dev->dma_mask;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
status = musb_init_controller(dev, irq, base);
|
status = musb_init_controller(dev, irq, base);
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
iounmap(base);
|
iounmap(base);
|
||||||
|
@ -2148,6 +2141,10 @@ static int __exit musb_remove(struct platform_device *pdev)
|
||||||
if (musb->board_mode == MUSB_HOST)
|
if (musb->board_mode == MUSB_HOST)
|
||||||
usb_remove_hcd(musb_to_hcd(musb));
|
usb_remove_hcd(musb_to_hcd(musb));
|
||||||
#endif
|
#endif
|
||||||
|
musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
|
||||||
|
musb_platform_exit(musb);
|
||||||
|
musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
|
||||||
|
|
||||||
musb_free(musb);
|
musb_free(musb);
|
||||||
iounmap(ctrl_base);
|
iounmap(ctrl_base);
|
||||||
device_init_wakeup(&pdev->dev, 0);
|
device_init_wakeup(&pdev->dev, 0);
|
||||||
|
|
Loading…
Reference in a new issue