[PATCH 12/15] usb: musb: Remove extra PM runtime calls from 2430 glue layer

Tony Lindgren
2016-05-12T00:53:13Z

With PM runtime behaving, these are all now unnecessary.
Doing pm_runtime_get(musb->controller) will keep the parent
glue layer also active.

Signed-off-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
---
drivers/usb/musb/omap2430.c | 28 ++++------------------------
1 file changed, 4 insertions(+), 24 deletions(-)

diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 0b8b5c6..97bd365 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -268,13 +268,8 @@ static void omap_musb_mailbox_work(struct work_struct *mailbox_work)
{
struct omap2430_glue *glue = container_of(mailbox_work,
struct omap2430_glue, omap_musb_mailbox_work);
- struct musb *musb = glue_to_musb(glue);
- struct device *dev = musb->controller;

- pm_runtime_get_sync(dev);
omap_musb_set_mailbox(glue);
- pm_runtime_mark_last_busy(dev);
- pm_runtime_put_autosuspend(dev);
}

static irqreturn_t omap2430_musb_interrupt(int irq, void *__hci)
@@ -343,16 +338,6 @@ static int omap2430_musb_init(struct musb *musb)
musb->isr = omap2430_musb_interrupt;
phy_init(musb->phy);

- /*
- * Enable runtime PM for musb parent (this driver). We can't
- * do it earlier as struct musb is not yet allocated and we
- * need to touch the musb registers for runtime PM.
- */
- pm_runtime_enable(glue->dev);
- status = pm_runtime_get_sync(glue->dev);
- if (status < 0)
- goto err1;
-
l = musb_readl(musb->mregs, OTG_INTERFSEL);

if (data->interface_type == MUSB_INTERFACE_UTMI) {
@@ -376,11 +361,7 @@ static int omap2430_musb_init(struct musb *musb)
if (glue->status != MUSB_UNKNOWN)
omap_musb_set_mailbox(glue);

- pm_runtime_put(glue->dev);
return 0;
-
-err1:
- return status;
}

static void omap2430_musb_enable(struct musb *musb)
@@ -591,11 +572,9 @@ static int omap2430_probe(struct platform_device *pdev)
goto err2;
}

- /*
- * Note that we cannot enable PM runtime yet for this
- * driver as we need struct musb initialized first.
- * See omap2430_musb_init above.
- */
+ pm_runtime_enable(glue->dev);
+ pm_runtime_use_autosuspend(glue->dev);
+ pm_runtime_set_autosuspend_delay(glue->dev, 500);

ret = platform_device_add(musb);
if (ret) {
@@ -621,6 +600,7 @@ static int omap2430_remove(struct platform_device *pdev)
platform_device_unregister(glue->musb);
omap2430_set_power(musb, false, false);
pm_runtime_put_sync(glue->dev);
+ pm_runtime_dont_use_autosuspend(glue->dev);
pm_runtime_disable(glue->dev);

return 0;
--
2.8.1