diff options
author | Sergei Shtylyov <sshtylyov@ru.mvista.com> | 2010-03-25 07:14:32 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-04-30 12:25:09 -0400 |
commit | 461972d8a4c94bc44f11a13046041c78a7cf18dd (patch) | |
tree | bf42a78cd77fe5f76ff8340d2931796dcee70f80 | |
parent | 7917a9df73c13822cc830f0ead0fb1b44a930616 (diff) |
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>
-rw-r--r-- | drivers/usb/musb/musb_core.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 8b68f21d3f82..508fd582973f 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -1851,10 +1851,6 @@ static void musb_free(struct musb *musb) | |||
1851 | put_device(musb->xceiv->dev); | 1851 | put_device(musb->xceiv->dev); |
1852 | #endif | 1852 | #endif |
1853 | 1853 | ||
1854 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); | ||
1855 | musb_platform_exit(musb); | ||
1856 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); | ||
1857 | |||
1858 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | 1854 | #ifdef CONFIG_USB_MUSB_HDRC_HCD |
1859 | usb_put_hcd(musb_to_hcd(musb)); | 1855 | usb_put_hcd(musb_to_hcd(musb)); |
1860 | #else | 1856 | #else |
@@ -2032,8 +2028,6 @@ bad_config: | |||
2032 | musb->xceiv->state = OTG_STATE_A_IDLE; | 2028 | musb->xceiv->state = OTG_STATE_A_IDLE; |
2033 | 2029 | ||
2034 | status = usb_add_hcd(musb_to_hcd(musb), -1, 0); | 2030 | status = usb_add_hcd(musb_to_hcd(musb), -1, 0); |
2035 | if (status) | ||
2036 | goto fail; | ||
2037 | 2031 | ||
2038 | DBG(1, "%s mode, status %d, devctl %02x %c\n", | 2032 | DBG(1, "%s mode, status %d, devctl %02x %c\n", |
2039 | "HOST", status, | 2033 | "HOST", status, |
@@ -2048,8 +2042,6 @@ bad_config: | |||
2048 | musb->xceiv->state = OTG_STATE_B_IDLE; | 2042 | musb->xceiv->state = OTG_STATE_B_IDLE; |
2049 | 2043 | ||
2050 | status = musb_gadget_setup(musb); | 2044 | status = musb_gadget_setup(musb); |
2051 | if (status) | ||
2052 | goto fail; | ||
2053 | 2045 | ||
2054 | DBG(1, "%s mode, status %d, dev%02x\n", | 2046 | DBG(1, "%s mode, status %d, dev%02x\n", |
2055 | is_otg_enabled(musb) ? "OTG" : "PERIPHERAL", | 2047 | is_otg_enabled(musb) ? "OTG" : "PERIPHERAL", |
@@ -2057,12 +2049,14 @@ bad_config: | |||
2057 | musb_readb(musb->mregs, MUSB_DEVCTL)); | 2049 | musb_readb(musb->mregs, MUSB_DEVCTL)); |
2058 | 2050 | ||
2059 | } | 2051 | } |
2052 | if (status < 0) | ||
2053 | goto fail2; | ||
2060 | 2054 | ||
2061 | #ifdef CONFIG_SYSFS | 2055 | #ifdef CONFIG_SYSFS |
2062 | status = sysfs_create_group(&musb->controller->kobj, &musb_attr_group); | 2056 | status = sysfs_create_group(&musb->controller->kobj, &musb_attr_group); |
2063 | #endif | ||
2064 | if (status) | 2057 | if (status) |
2065 | goto fail2; | 2058 | goto fail2; |
2059 | #endif | ||
2066 | 2060 | ||
2067 | dev_info(dev, "USB %s mode controller at %p using %s, IRQ %d\n", | 2061 | dev_info(dev, "USB %s mode controller at %p using %s, IRQ %d\n", |
2068 | ({char *s; | 2062 | ({char *s; |
@@ -2125,7 +2119,6 @@ static int __init musb_probe(struct platform_device *pdev) | |||
2125 | /* clobbered by use_dma=n */ | 2119 | /* clobbered by use_dma=n */ |
2126 | orig_dma_mask = dev->dma_mask; | 2120 | orig_dma_mask = dev->dma_mask; |
2127 | #endif | 2121 | #endif |
2128 | |||
2129 | status = musb_init_controller(dev, irq, base); | 2122 | status = musb_init_controller(dev, irq, base); |
2130 | if (status < 0) | 2123 | if (status < 0) |
2131 | iounmap(base); | 2124 | iounmap(base); |
@@ -2148,6 +2141,10 @@ static int __exit musb_remove(struct platform_device *pdev) | |||
2148 | if (musb->board_mode == MUSB_HOST) | 2141 | if (musb->board_mode == MUSB_HOST) |
2149 | usb_remove_hcd(musb_to_hcd(musb)); | 2142 | usb_remove_hcd(musb_to_hcd(musb)); |
2150 | #endif | 2143 | #endif |
2144 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); | ||
2145 | musb_platform_exit(musb); | ||
2146 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); | ||
2147 | |||
2151 | musb_free(musb); | 2148 | musb_free(musb); |
2152 | iounmap(ctrl_base); | 2149 | iounmap(ctrl_base); |
2153 | device_init_wakeup(&pdev->dev, 0); | 2150 | device_init_wakeup(&pdev->dev, 0); |