Skip to content

Commit 536d599

Browse files
tmlindgregkh
authored andcommitted
usb: musb: Add missing pm_runtime_disable and drop 2430 PM timeout
We are missing pm_runtime_disable() in 2430 glue layer. Further, we only need to enable PM runtime and disable it on exit. With musb_core.c doing PM, the glue layer as a parent will always be active when musb_core.c is active. This fixes host enumeration issues with some devices as reported by Ladislav Michl <ladis@linux-mips.org>. And holding an RPM reference while deregistering the child would lead to a crash in omap2430_runtime_suspend() which dereferences the now freed child's driver data on put as pointed out by Johan Hovold <johan@kernel.org>: Unable to handle kernel paging request at virtual address 6b6b6f17 ... [<c05453d4>] (omap2430_runtime_suspend) from [<c0481410>] (pm_generic_runtime_suspend+0x3c/0x48) [<c0481410>] (pm_generic_runtime_suspend) from [<c0121028>] (_od_runtime_suspend+0x1c/0x30) [<c0121028>] (_od_runtime_suspend) from [<c04833b0>] (__rpm_callback+0x3c/0x70) [<c04833b0>] (__rpm_callback) from [<c0483414>] (rpm_callback+0x30/0x90) [<c0483414>] (rpm_callback) from [<c0483984>] (rpm_suspend+0x118/0x6b4) [<c0483984>] (rpm_suspend) from [<c04840f4>] (rpm_idle+0x104/0x440) [<c04840f4>] (rpm_idle) from [<c04844ac>] (__pm_runtime_idle+0x7c/0xb0) [<c04844ac>] (__pm_runtime_idle) from [<c0545458>] (omap2430_remove+0x38/0x58) [<c0545458>] (omap2430_remove) from [<c047b2bc>] (platform_drv_remove+0x34/0x4c) Note that if changes are needed to the autosuspend timeout, it should be done in musb_core.c. Reported-by: Ladislav Michl <ladis@linux-mips.org> Fixes: 87326e8 ("usb: musb: Remove extra PM runtime calls from 2430 glue layer") Tested-by: Ladislav Michl <ladis@linux-mips.org> Reviewed-by: Johan Hovold <johan@kernel.org> Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2bff391 commit 536d599

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

drivers/usb/musb/omap2430.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -513,17 +513,18 @@ static int omap2430_probe(struct platform_device *pdev)
513513
}
514514

515515
pm_runtime_enable(glue->dev);
516-
pm_runtime_use_autosuspend(glue->dev);
517-
pm_runtime_set_autosuspend_delay(glue->dev, 100);
518516

519517
ret = platform_device_add(musb);
520518
if (ret) {
521519
dev_err(&pdev->dev, "failed to register musb device\n");
522-
goto err2;
520+
goto err3;
523521
}
524522

525523
return 0;
526524

525+
err3:
526+
pm_runtime_disable(glue->dev);
527+
527528
err2:
528529
platform_device_put(musb);
529530

@@ -535,10 +536,7 @@ static int omap2430_remove(struct platform_device *pdev)
535536
{
536537
struct omap2430_glue *glue = platform_get_drvdata(pdev);
537538

538-
pm_runtime_get_sync(glue->dev);
539539
platform_device_unregister(glue->musb);
540-
pm_runtime_put_sync(glue->dev);
541-
pm_runtime_dont_use_autosuspend(glue->dev);
542540
pm_runtime_disable(glue->dev);
543541

544542
return 0;

0 commit comments

Comments
 (0)