path: root/drivers/usb/musb/musb_core.c
diff options
authorGrazvydas Ignotas <notasas@gmail.com>2012-02-04 19:43:51 +0200
committerFelipe Balbi <balbi@ti.com>2012-04-10 19:11:43 +0300
commitc04352a590538123f8c93bd87ef1d4bb9e3a64c7 (patch)
treeb4c4b1881f1168e2e82b33fe8af357fed5085392 /drivers/usb/musb/musb_core.c
parentafb76df140823c57738598a876cd1d6568cd57c7 (diff)
usb: musb: fix some runtime_pm issues
When runtime_pm was originally added, it was done in rather confusing way: omap2430_musb_init() (called from musb_init_controller) would do runtime_pm_get_sync() and musb_init_controller() itself would do runtime_pm_put to balance it out. This is not only confusing but also wrong if non-omap2430 glue layer is used. This confusion resulted in commit 772aed45b604 "usb: musb: fix pm_runtime mismatch", that removed runtime_pm_put() from musb_init_controller as that looked unbalanced, and also happened to fix unrelated isp1704_charger crash. However this broke runtime PM functionality (musb is now always powered, even without gadget active). Avoid these confusing runtime pm dependences by making musb_init_controller() and omap2430_musb_init() do their own runtime get/put pairs; also cover error paths. Remove unneeded runtime_pm_put in omap2430_remove too. isp1704_charger crash that motivated 772aed45b604 will be fixed by following patch. Cc: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Grazvydas Ignotas <notasas@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/musb/musb_core.c')
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 0f8b82918a40..239214626ec5 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1904,7 +1904,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
if (!musb->isr) {
status = -ENODEV;
- goto fail3;
+ goto fail2;
if (!musb->xceiv->io_ops) {
@@ -1912,6 +1912,8 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
musb->xceiv->io_ops = &musb_ulpi_access;
+ pm_runtime_get_sync(musb->controller);
if (use_dma && dev->dma_mask) {
struct dma_controller *c;
@@ -2023,6 +2025,8 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
goto fail5;
+ pm_runtime_put(musb->controller);
dev_info(dev, "USB %s mode controller at %p using %s, IRQ %d\n",
({char *s;
switch (musb->board_mode) {
@@ -2047,6 +2051,9 @@ fail4:
+ pm_runtime_put_sync(musb->controller);
if (musb->irq_wake)
device_init_wakeup(dev, 0);

Privacy Policy