[parent not found: <1269431279-22438-1-git-send-email-felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>]
* [patch-2.6.34-rc2+ 01/11] musb: fix power field to hold all possible values
[not found] ` <1269431279-22438-1-git-send-email-felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
@ 2010-03-24 11:47 ` Felipe Balbi
2010-03-24 11:47 ` [patch-2.6.34-rc2+ 02/11] MUSB: fix DaVinci glue layer dependency Felipe Balbi
` (3 subsequent siblings)
4 siblings, 0 replies; 21+ messages in thread
From: Felipe Balbi @ 2010-03-24 11:47 UTC (permalink / raw)
To: Greg KH
Cc: Linux USB Mailing List, Linux OMAP Mailing List, Ajay Kumar Gupta,
Felipe Balbi
From: Ajay Kumar Gupta <ajay.gupta-l0cyMroinI0@public.gmane.org>
MUSB can supply upto 500mA such as, AM3517 and OMAP3EVM Rev >=E and thus
the 'power' field has to hold values above 255.
Signed-off-by: Ajay Kumar Gupta <ajay.gupta-l0cyMroinI0@public.gmane.org>
Signed-off-by: Felipe Balbi <felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
---
arch/arm/plat-omap/include/plat/usb.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/arm/plat-omap/include/plat/usb.h b/arch/arm/plat-omap/include/plat/usb.h
index 568578d..876ca8d 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -46,7 +46,7 @@ struct ehci_hcd_omap_platform_data {
struct omap_musb_board_data {
u8 interface_type;
u8 mode;
- u8 power;
+ u16 power;
};
enum musb_interface {MUSB_INTERFACE_ULPI, MUSB_INTERFACE_UTMI};
--
1.7.0.rc0.33.g7c3932
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 21+ messages in thread* [patch-2.6.34-rc2+ 02/11] MUSB: fix DaVinci glue layer dependency
[not found] ` <1269431279-22438-1-git-send-email-felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2010-03-24 11:47 ` [patch-2.6.34-rc2+ 01/11] musb: fix power field to hold all possible values Felipe Balbi
@ 2010-03-24 11:47 ` Felipe Balbi
2010-03-24 11:47 ` [patch-2.6.34-rc2+ 03/11] MUSB: Blackfin: don't fake blackfin_interrupt() result Felipe Balbi
` (2 subsequent siblings)
4 siblings, 0 replies; 21+ messages in thread
From: Felipe Balbi @ 2010-03-24 11:47 UTC (permalink / raw)
To: Greg KH
Cc: Linux USB Mailing List, Linux OMAP Mailing List, Sergei Shtylyov,
Felipe Balbi
From: Sergei Shtylyov <sshtylyov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
CONFIG_ARCH_DAVINCI now embraces both the "real" DaVinci and DA8xx/OMAP-L1x --
on which the DaVinci glue layer won't work. Change the Makefile dependency to
CONFIG_ARCH_DAVINCI_DMx which corresponds to "real" DaVinci.
Signed-off-by: Sergei Shtylyov <sshtylyov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
Signed-off-by: Felipe Balbi <felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
---
drivers/usb/musb/Kconfig | 2 +-
drivers/usb/musb/Makefile | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index 5e3f3ee..cfd38ed 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -43,7 +43,7 @@ config USB_MUSB_SOC
default y if (BF52x && !BF522 && !BF523)
comment "DaVinci 35x and 644x USB support"
- depends on USB_MUSB_HDRC && ARCH_DAVINCI
+ depends on USB_MUSB_HDRC && ARCH_DAVINCI_DMx
comment "OMAP 243x high speed USB support"
depends on USB_MUSB_HDRC && ARCH_OMAP2430
diff --git a/drivers/usb/musb/Makefile b/drivers/usb/musb/Makefile
index a641a76..a1677f9 100644
--- a/drivers/usb/musb/Makefile
+++ b/drivers/usb/musb/Makefile
@@ -6,7 +6,7 @@ musb_hdrc-objs := musb_core.o
obj-$(CONFIG_USB_MUSB_HDRC) += musb_hdrc.o
-ifeq ($(CONFIG_ARCH_DAVINCI),y)
+ifeq ($(CONFIG_ARCH_DAVINCI_DMx),y)
musb_hdrc-objs += davinci.o
endif
--
1.7.0.rc0.33.g7c3932
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 21+ messages in thread* [patch-2.6.34-rc2+ 03/11] MUSB: Blackfin: don't fake blackfin_interrupt() result
[not found] ` <1269431279-22438-1-git-send-email-felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2010-03-24 11:47 ` [patch-2.6.34-rc2+ 01/11] musb: fix power field to hold all possible values Felipe Balbi
2010-03-24 11:47 ` [patch-2.6.34-rc2+ 02/11] MUSB: fix DaVinci glue layer dependency Felipe Balbi
@ 2010-03-24 11:47 ` Felipe Balbi
2010-03-24 11:47 ` [patch-2.6.34-rc2+ 08/11] MUSB: DaVinci: fix musb_platform_init() error cleanup path Felipe Balbi
2010-03-24 11:47 ` [patch-2.6.34-rc2+ 09/11] MUSB: OMAP: don't call clk_put() Felipe Balbi
4 siblings, 0 replies; 21+ messages in thread
From: Felipe Balbi @ 2010-03-24 11:47 UTC (permalink / raw)
To: Greg KH
Cc: Linux USB Mailing List, Linux OMAP Mailing List, Sergei Shtylyov,
Sergei Shtylyov, Felipe Balbi
From: Sergei Shtylyov <sshtylyov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
Commit a5073b52833e4df8e16c93dc4cbb7e0c558c74a2 (musb_gadget: fix unhandled
endpoint 0 IRQs) misses this change to blackfin.c: stop faking successful
result of blackfin_interrupt() and emitting a debug message on an unhandled
interrupt.
Signed-off-by: Sergei Shtylyov <sshtylyov-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Felipe Balbi <felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
---
drivers/usb/musb/blackfin.c | 8 +-------
1 files changed, 1 insertions(+), 7 deletions(-)
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index 7160959..3774815 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -173,13 +173,7 @@ static irqreturn_t blackfin_interrupt(int irq, void *__hci)
spin_unlock_irqrestore(&musb->lock, flags);
- /* REVISIT we sometimes get spurious IRQs on g_ep0
- * not clear why... fall in BF54x too.
- */
- if (retval != IRQ_HANDLED)
- DBG(5, "spurious?\n");
^ permalink raw reply related [flat|nested] 21+ messages in thread* [patch-2.6.34-rc2+ 08/11] MUSB: DaVinci: fix musb_platform_init() error cleanup path
[not found] ` <1269431279-22438-1-git-send-email-felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
` (2 preceding siblings ...)
2010-03-24 11:47 ` [patch-2.6.34-rc2+ 03/11] MUSB: Blackfin: don't fake blackfin_interrupt() result Felipe Balbi
@ 2010-03-24 11:47 ` Felipe Balbi
2010-03-24 11:47 ` [patch-2.6.34-rc2+ 09/11] MUSB: OMAP: don't call clk_put() Felipe Balbi
4 siblings, 0 replies; 21+ messages in thread
From: Felipe Balbi @ 2010-03-24 11:47 UTC (permalink / raw)
To: Greg KH
Cc: Linux USB Mailing List, Linux OMAP Mailing List, Sergei Shtylyov,
Felipe Balbi
From: Sergei Shtylyov <sshtylyov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
This function forgets to call clk_disable() iff reading the USB module version
register returns 0.
Signed-off-by: Sergei Shtylyov <sshtylyov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
Signed-off-by: Felipe Balbi <felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
---
drivers/usb/musb/davinci.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
index d37abf3..8a3c5a2 100644
--- a/drivers/usb/musb/davinci.c
+++ b/drivers/usb/musb/davinci.c
@@ -445,6 +445,8 @@ int __init musb_platform_init(struct musb *musb, void *board_data)
return 0;
fail:
+ clk_disable(musb->clock);
+
usb_nop_xceiv_unregister();
return -ENODEV;
}
--
1.7.0.rc0.33.g7c3932
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 21+ messages in thread* [patch-2.6.34-rc2+ 09/11] MUSB: OMAP: don't call clk_put()
[not found] ` <1269431279-22438-1-git-send-email-felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
` (3 preceding siblings ...)
2010-03-24 11:47 ` [patch-2.6.34-rc2+ 08/11] MUSB: DaVinci: fix musb_platform_init() error cleanup path Felipe Balbi
@ 2010-03-24 11:47 ` Felipe Balbi
4 siblings, 0 replies; 21+ messages in thread
From: Felipe Balbi @ 2010-03-24 11:47 UTC (permalink / raw)
To: Greg KH
Cc: Linux USB Mailing List, Linux OMAP Mailing List, Sergei Shtylyov,
Felipe Balbi
From: Sergei Shtylyov <sshtylyov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
Remove duplicate/unbalanced call to clk_put() from musb_platform_exit() --
clk_put() gets called from musb_core.c anyway...
Signed-off-by: Sergei Shtylyov <sshtylyov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
Signed-off-by: Felipe Balbi <felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
---
drivers/usb/musb/omap2430.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index dd64aeb..f8cc636 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -341,8 +341,5 @@ int musb_platform_exit(struct musb *musb)
musb_platform_suspend(musb);
- clk_put(musb->clock);
- musb->clock = NULL;
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [patch-2.6.34-rc2+ 04/11] musb: save and restore missing bus control register
2010-03-24 11:47 [patch-2.6.34-rc2+ 00/11] musb patches Felipe Balbi
[not found] ` <1269431279-22438-1-git-send-email-felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
@ 2010-03-24 11:47 ` Felipe Balbi
2010-03-24 11:47 ` [patch-2.6.34-rc2+ 05/11] musb: potential use after free Felipe Balbi
` (4 subsequent siblings)
6 siblings, 0 replies; 21+ messages in thread
From: Felipe Balbi @ 2010-03-24 11:47 UTC (permalink / raw)
To: Greg KH
Cc: Linux USB Mailing List, Linux OMAP Mailing List, Ajay Kumar Gupta,
Felipe Balbi
From: Ajay Kumar Gupta <ajay.gupta@ti.com>
Added the missing BUS_CONTROL register in musb
save/restore routines.
Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
drivers/usb/musb/musb_core.c | 2 ++
drivers/usb/musb/musb_core.h | 2 +-
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 69a1429..7a7f6ec 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -2178,6 +2178,7 @@ void musb_save_context(struct musb *musb)
if (is_host_enabled(musb)) {
musb_context.frame = musb_readw(musb_base, MUSB_FRAME);
musb_context.testmode = musb_readb(musb_base, MUSB_TESTMODE);
+ musb_context.busctl = musb_read_ulpi_buscontrol(musb->mregs);
}
musb_context.power = musb_readb(musb_base, MUSB_POWER);
musb_context.intrtxe = musb_readw(musb_base, MUSB_INTRTXE);
@@ -2249,6 +2250,7 @@ void musb_restore_context(struct musb *musb)
if (is_host_enabled(musb)) {
musb_writew(musb_base, MUSB_FRAME, musb_context.frame);
musb_writeb(musb_base, MUSB_TESTMODE, musb_context.testmode);
+ musb_write_ulpi_buscontrol(musb->mregs, musb_context.busctl);
}
musb_writeb(musb_base, MUSB_POWER, musb_context.power);
musb_writew(musb_base, MUSB_INTRTXE, musb_context.intrtxe);
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index f57ecd0..d7b277e 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -479,7 +479,7 @@ struct musb_context_registers {
u16 frame;
u8 index, testmode;
- u8 devctl, misc;
+ u8 devctl, busctl, misc;
struct musb_csr_regs index_regs[MUSB_C_NUM_EPS];
};
--
1.7.0.rc0.33.g7c3932
^ permalink raw reply related [flat|nested] 21+ messages in thread* [patch-2.6.34-rc2+ 05/11] musb: potential use after free
2010-03-24 11:47 [patch-2.6.34-rc2+ 00/11] musb patches Felipe Balbi
[not found] ` <1269431279-22438-1-git-send-email-felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2010-03-24 11:47 ` [patch-2.6.34-rc2+ 04/11] musb: save and restore missing bus control register Felipe Balbi
@ 2010-03-24 11:47 ` Felipe Balbi
2010-03-24 11:47 ` [patch-2.6.34-rc2+ 06/11] musb_core: don't touch 'musb->clock' in musb_free() Felipe Balbi
` (3 subsequent siblings)
6 siblings, 0 replies; 21+ messages in thread
From: Felipe Balbi @ 2010-03-24 11:47 UTC (permalink / raw)
To: Greg KH
Cc: Linux USB Mailing List, Linux OMAP Mailing List, Dan Carpenter,
Felipe Balbi
From: Dan Carpenter <error27@gmail.com>
We assign "urb->hcpriv = qh;" a few lines down. I'm pretty sure we
want it "urb->hcpriv" to be NULL not a freed value.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
drivers/usb/musb/musb_host.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index dec896e..877d20b 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -2042,6 +2042,7 @@ static int musb_urb_enqueue(
* odd, rare, error prone, but legal.
*/
kfree(qh);
+ qh = NULL;
ret = 0;
} else
ret = musb_schedule(musb, qh,
--
1.7.0.rc0.33.g7c3932
^ permalink raw reply related [flat|nested] 21+ messages in thread* [patch-2.6.34-rc2+ 06/11] musb_core: don't touch 'musb->clock' in musb_free()
2010-03-24 11:47 [patch-2.6.34-rc2+ 00/11] musb patches Felipe Balbi
` (2 preceding siblings ...)
2010-03-24 11:47 ` [patch-2.6.34-rc2+ 05/11] musb: potential use after free Felipe Balbi
@ 2010-03-24 11:47 ` Felipe Balbi
2010-03-24 11:47 ` [patch-2.6.34-rc2+ 07/11] musb_core: don't prevent disabling clock on driver unload Felipe Balbi
` (2 subsequent siblings)
6 siblings, 0 replies; 21+ messages in thread
From: Felipe Balbi @ 2010-03-24 11:47 UTC (permalink / raw)
To: Greg KH
Cc: Linux USB Mailing List, Linux OMAP Mailing List, Sergei Shtylyov,
Felipe Balbi
From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Remove duplicate/unbalanced calls to clk_disable()/clk_put() in musb_free():
- clk_disable() is called by musb_platform_exit() just prior to this call;
- clk_put() is called by the callers of musb_free() prior to calling it...
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
drivers/usb/musb/musb_core.c | 5 -----
1 files changed, 0 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 7a7f6ec..d559ed6 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1854,11 +1854,6 @@ static void musb_free(struct musb *musb)
musb_platform_exit(musb);
musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
- if (musb->clock) {
- clk_disable(musb->clock);
- clk_put(musb->clock);
- }
-
#ifdef CONFIG_USB_MUSB_HDRC_HCD
usb_put_hcd(musb_to_hcd(musb));
#else
--
1.7.0.rc0.33.g7c3932
^ permalink raw reply related [flat|nested] 21+ messages in thread* [patch-2.6.34-rc2+ 07/11] musb_core: don't prevent disabling clock on driver unload
2010-03-24 11:47 [patch-2.6.34-rc2+ 00/11] musb patches Felipe Balbi
` (3 preceding siblings ...)
2010-03-24 11:47 ` [patch-2.6.34-rc2+ 06/11] musb_core: don't touch 'musb->clock' in musb_free() Felipe Balbi
@ 2010-03-24 11:47 ` Felipe Balbi
2010-03-24 11:47 ` [patch-2.6.34-rc2+ 10/11] musb_core: don't call musb_platform_exit() twice Felipe Balbi
2010-03-24 11:47 ` [patch-2.6.34-rc2+ 11/11] musb_core: fix musb_init_controller() error cleanup path Felipe Balbi
6 siblings, 0 replies; 21+ messages in thread
From: Felipe Balbi @ 2010-03-24 11:47 UTC (permalink / raw)
To: Greg KH
Cc: Linux USB Mailing List, Linux OMAP Mailing List, Sergei Shtylyov,
Felipe Balbi
From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Resetting 'musb->clock' to NULL in musb_shutdown() prevents musb_platform_exit()
from properly disabling the clock when unloading the driver -- don't do it.
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
drivers/usb/musb/musb_core.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index d559ed6..827b813 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -964,10 +964,8 @@ static void musb_shutdown(struct platform_device *pdev)
spin_lock_irqsave(&musb->lock, flags);
musb_platform_disable(musb);
musb_generic_disable(musb);
- if (musb->clock) {
+ if (musb->clock)
clk_put(musb->clock);
- musb->clock = NULL;
- }
spin_unlock_irqrestore(&musb->lock, flags);
/* FIXME power down */
--
1.7.0.rc0.33.g7c3932
^ permalink raw reply related [flat|nested] 21+ messages in thread* [patch-2.6.34-rc2+ 10/11] musb_core: don't call musb_platform_exit() twice
2010-03-24 11:47 [patch-2.6.34-rc2+ 00/11] musb patches Felipe Balbi
` (4 preceding siblings ...)
2010-03-24 11:47 ` [patch-2.6.34-rc2+ 07/11] musb_core: don't prevent disabling clock on driver unload Felipe Balbi
@ 2010-03-24 11:47 ` Felipe Balbi
[not found] ` <1269431279-22438-11-git-send-email-felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2010-03-24 11:47 ` [patch-2.6.34-rc2+ 11/11] musb_core: fix musb_init_controller() error cleanup path Felipe Balbi
6 siblings, 1 reply; 21+ messages in thread
From: Felipe Balbi @ 2010-03-24 11:47 UTC (permalink / raw)
To: Greg KH
Cc: Linux USB Mailing List, Linux OMAP Mailing List, Sergei Shtylyov,
Felipe Balbi
From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
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 misplaced 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>
---
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 827b813..90ac17b 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1848,10 +1848,6 @@ static void musb_free(struct musb *musb)
put_device(musb->xceiv->dev);
#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
usb_put_hcd(musb_to_hcd(musb));
#else
@@ -2029,8 +2025,6 @@ bad_config:
musb->xceiv->state = OTG_STATE_A_IDLE;
status = usb_add_hcd(musb_to_hcd(musb), -1, 0);
- if (status)
- goto fail;
DBG(1, "%s mode, status %d, devctl %02x %c\n",
"HOST", status,
@@ -2045,8 +2039,6 @@ bad_config:
musb->xceiv->state = OTG_STATE_B_IDLE;
status = musb_gadget_setup(musb);
- if (status)
- goto fail;
DBG(1, "%s mode, status %d, dev%02x\n",
is_otg_enabled(musb) ? "OTG" : "PERIPHERAL",
@@ -2054,6 +2046,8 @@ bad_config:
musb_readb(musb->mregs, MUSB_DEVCTL));
}
+ if (status < 0)
+ goto fail2;
status = musb_init_debugfs(musb);
if (status < 0)
@@ -2061,9 +2055,9 @@ bad_config:
#ifdef CONFIG_SYSFS
status = sysfs_create_group(&musb->controller->kobj, &musb_attr_group);
-#endif
if (status)
goto fail2;
+#endif
dev_info(dev, "USB %s mode controller at %p using %s, IRQ %d\n",
({char *s;
@@ -2126,7 +2120,6 @@ static int __init musb_probe(struct platform_device *pdev)
/* clobbered by use_dma=n */
orig_dma_mask = dev->dma_mask;
#endif
-
status = musb_init_controller(dev, irq, base);
if (status < 0)
iounmap(base);
@@ -2150,6 +2143,10 @@ static int __exit musb_remove(struct platform_device *pdev)
if (musb->board_mode == MUSB_HOST)
usb_remove_hcd(musb_to_hcd(musb));
#endif
+ musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
+ musb_platform_exit(musb);
+ musb_writeb(musb->mregs, MUSB_DEVCTL, 0);
+
musb_free(musb);
iounmap(ctrl_base);
device_init_wakeup(&pdev->dev, 0);
--
1.7.0.rc0.33.g7c3932
^ permalink raw reply related [flat|nested] 21+ messages in thread* [patch-2.6.34-rc2+ 11/11] musb_core: fix musb_init_controller() error cleanup path
2010-03-24 11:47 [patch-2.6.34-rc2+ 00/11] musb patches Felipe Balbi
` (5 preceding siblings ...)
2010-03-24 11:47 ` [patch-2.6.34-rc2+ 10/11] musb_core: don't call musb_platform_exit() twice Felipe Balbi
@ 2010-03-24 11:47 ` Felipe Balbi
2010-03-24 12:16 ` Sergei Shtylyov
6 siblings, 1 reply; 21+ messages in thread
From: Felipe Balbi @ 2010-03-24 11:47 UTC (permalink / raw)
To: Greg KH
Cc: Linux USB Mailing List, Linux OMAP Mailing List, Sergei Shtylyov,
Felipe Balbi
From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
This function forgets to call usb_remove_hcd() or musb_gadget_cleanup() iff
sysfs_create_group() fails.
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
[ felipe.balbi@nokia.com : review the entire error path
not only when we fail hcd or gadget ]
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
drivers/usb/musb/musb_core.c | 50 +++++++++++++++++++++++++++--------------
1 files changed, 33 insertions(+), 17 deletions(-)
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 90ac17b..13f36bf 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1875,8 +1875,10 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
*/
if (!plat) {
dev_dbg(dev, "no platform_data?\n");
- return -ENODEV;
+ status = -ENODEV;
+ goto fail0;
}
+
switch (plat->mode) {
case MUSB_HOST:
#ifdef CONFIG_USB_MUSB_HDRC_HCD
@@ -1898,13 +1900,16 @@ bad_config:
#endif
default:
dev_err(dev, "incompatible Kconfig role setting\n");
- return -EINVAL;
+ status = -EINVAL;
+ goto fail0;
}
/* allocate */
musb = allocate_instance(dev, plat->config, ctrl);
- if (!musb)
- return -ENOMEM;
+ if (!musb) {
+ status = -ENOMEM;
+ goto fail0;
+ }
spin_lock_init(&musb->lock);
musb->board_mode = plat->mode;
@@ -1922,7 +1927,7 @@ bad_config:
if (IS_ERR(musb->clock)) {
status = PTR_ERR(musb->clock);
musb->clock = NULL;
- goto fail;
+ goto fail1;
}
}
@@ -1941,12 +1946,12 @@ bad_config:
*/
musb->isr = generic_interrupt;
status = musb_platform_init(musb, plat->board_data);
-
if (status < 0)
- goto fail;
+ goto fail2;
+
if (!musb->isr) {
status = -ENODEV;
- goto fail2;
+ goto fail3;
}
#ifndef CONFIG_MUSB_PIO_ONLY
@@ -1972,7 +1977,7 @@ bad_config:
? MUSB_CONTROLLER_MHDRC
: MUSB_CONTROLLER_HDRC, musb);
if (status < 0)
- goto fail2;
+ goto fail3;
#ifdef CONFIG_USB_MUSB_OTG
setup_timer(&musb->otg_timer, musb_otg_timer_func, (unsigned long) musb);
@@ -1985,7 +1990,7 @@ bad_config:
if (request_irq(nIrq, musb->isr, 0, dev_name(dev), musb)) {
dev_err(dev, "request_irq %d failed!\n", nIrq);
status = -ENODEV;
- goto fail2;
+ goto fail3;
}
musb->nIrq = nIrq;
/* FIXME this handles wakeup irqs wrong */
@@ -2047,7 +2052,7 @@ bad_config:
}
if (status < 0)
- goto fail2;
+ goto fail4;
status = musb_init_debugfs(musb);
if (status < 0)
@@ -2056,7 +2061,7 @@ bad_config:
#ifdef CONFIG_SYSFS
status = sysfs_create_group(&musb->controller->kobj, &musb_attr_group);
if (status)
- goto fail2;
+ goto fail4;
#endif
dev_info(dev, "USB %s mode controller at %p using %s, IRQ %d\n",
@@ -2073,17 +2078,28 @@ bad_config:
return 0;
-fail2:
+fail4:
+ if (!is_otg_enabled(musb) && is_host_enabled(musb))
+ usb_remove_hcd(musb_to_hcd(musb));
+ else
+ musb_gadget_cleanup(musb);
+ device_init_wakeup(dev, 0);
+
+fail3:
musb_platform_exit(musb);
-fail:
- dev_err(musb->controller,
- "musb_init_controller failed with status %d\n", status);
+fail2:
if (musb->clock)
clk_put(musb->clock);
- device_init_wakeup(dev, 0);
+
+fail1:
+ dev_err(musb->controller,
+ "musb_init_controller failed with status %d\n", status);
+
musb_free(musb);
+fail0:
+
return status;
}
--
1.7.0.rc0.33.g7c3932
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [patch-2.6.34-rc2+ 11/11] musb_core: fix musb_init_controller() error cleanup path
2010-03-24 11:47 ` [patch-2.6.34-rc2+ 11/11] musb_core: fix musb_init_controller() error cleanup path Felipe Balbi
@ 2010-03-24 12:16 ` Sergei Shtylyov
0 siblings, 0 replies; 21+ messages in thread
From: Sergei Shtylyov @ 2010-03-24 12:16 UTC (permalink / raw)
To: Felipe Balbi; +Cc: Greg KH, Linux USB Mailing List, Linux OMAP Mailing List
Hello.
Felipe Balbi wrote:
> From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
>
> This function forgets to call usb_remove_hcd() or musb_gadget_cleanup() iff
> sysfs_create_group() fails.
>
> Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
>
> [ felipe.balbi@nokia.com : review the entire error path
> not only when we fail hcd or gadget ]
>
> Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
> ---
> drivers/usb/musb/musb_core.c | 50 +++++++++++++++++++++++++++--------------
> 1 files changed, 33 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
> index 90ac17b..13f36bf 100644
> --- a/drivers/usb/musb/musb_core.c
> +++ b/drivers/usb/musb/musb_core.c
[...]
> @@ -2047,7 +2052,7 @@ bad_config:
>
> }
> if (status < 0)
> - goto fail2;
> + goto fail4;
>
No, the label should be 'fail3' here. In this case usb_add_hcd() or
musb_gadget_setup() have failed, so we shouldn't undo them...
> status = musb_init_debugfs(musb);
> if (status < 0)
>
Is there also a 'goto' that needs to be fixed up?
> @@ -2056,7 +2061,7 @@ bad_config:
> #ifdef CONFIG_SYSFS
> status = sysfs_create_group(&musb->controller->kobj, &musb_attr_group);
> if (status)
> - goto fail2;
> + goto fail4;
> #endif
>
> dev_info(dev, "USB %s mode controller at %p using %s, IRQ %d\n",
> @@ -2073,17 +2078,28 @@ bad_config:
>
> return 0;
>
> -fail2:
> +fail4:
> + if (!is_otg_enabled(musb) && is_host_enabled(musb))
> + usb_remove_hcd(musb_to_hcd(musb));
> + else
> + musb_gadget_cleanup(musb);
> + device_init_wakeup(dev, 0);
> +
> +fail3:
> musb_platform_exit(musb);
> -fail:
> - dev_err(musb->controller,
> - "musb_init_controller failed with status %d\n", status);
>
> +fail2:
> if (musb->clock)
> clk_put(musb->clock);
> - device_init_wakeup(dev, 0);
> +
> +fail1:
> + dev_err(musb->controller,
> + "musb_init_controller failed with status %d\n", status);
> +
> musb_free(musb);
>
> +fail0:
> +
> return status;
>
> }
>
WBR, Sergei
^ permalink raw reply [flat|nested] 21+ messages in thread