diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2013-08-20 12:35:44 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2013-08-27 15:18:14 -0400 |
commit | 9047428894660f8f46305917e519ab62f7395cac (patch) | |
tree | 1661f315da9f809463f606cde44086745619287f | |
parent | 51ef74f6400c731827454d010b35b122103fe9f9 (diff) |
usb: musb: only remove host/udc if it has been added
musb_shutdown() removes always USB host and device.
musb_init_controller() adds host and device depending on port_mode. If
port mode is set to HOST then the removal of UDC leads only to:
|(NULL device *): gadget not registered.
and nothing else happens. If port mode is set to DEVICE and we remove
the host then we oops in usb_remove_hcd().
This patch ensures that we only remove host in OTG/host mode and device
only in OTG/device mode to avoid any trouble.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r-- | drivers/usb/musb/musb_gadget.c | 2 | ||||
-rw-r--r-- | drivers/usb/musb/musb_host.c | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index b7b8b2bc4ee9..9a08679d204d 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
@@ -1812,6 +1812,8 @@ err: | |||
1812 | 1812 | ||
1813 | void musb_gadget_cleanup(struct musb *musb) | 1813 | void musb_gadget_cleanup(struct musb *musb) |
1814 | { | 1814 | { |
1815 | if (musb->port_mode == MUSB_PORT_MODE_HOST) | ||
1816 | return; | ||
1815 | usb_del_gadget_udc(&musb->g); | 1817 | usb_del_gadget_udc(&musb->g); |
1816 | } | 1818 | } |
1817 | 1819 | ||
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index a9695f5a92fb..9a2b8c85f19a 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c | |||
@@ -2628,6 +2628,8 @@ int musb_host_alloc(struct musb *musb) | |||
2628 | 2628 | ||
2629 | void musb_host_cleanup(struct musb *musb) | 2629 | void musb_host_cleanup(struct musb *musb) |
2630 | { | 2630 | { |
2631 | if (musb->port_mode == MUSB_PORT_MODE_GADGET) | ||
2632 | return; | ||
2631 | usb_remove_hcd(musb->hcd); | 2633 | usb_remove_hcd(musb->hcd); |
2632 | musb->hcd = NULL; | 2634 | musb->hcd = NULL; |
2633 | } | 2635 | } |