Skip to content

Commit

Permalink
sdhci-pxav3: Fix runtime PM initialization
Browse files Browse the repository at this point in the history
Commit bb691ae breaks boot on OLPC
XO-4, it hangs somewhere inside sdhci_add_host.

When pm_runtime_set_autosuspend_delay() was being called, the device's
usage counter was 0, causing the PM layer to runtime-suspend the
device.  We then went on to call sdhci_add_host() on a suspended
device, which hung.

Fix this by making the driver consistent with the omap_hsmmc driver,
both in terms of runtime PM initialization and error handling. Now
the device is not runtime-suspended until we exit the probe routine.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
  • Loading branch information
Daniel Drake authored and Chris Ball committed Jun 27, 2013
1 parent 5a36d6b commit 0dcaa24
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions drivers/mmc/host/sdhci-pxav3.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,18 +287,15 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
}
}

pm_runtime_set_active(&pdev->dev);
pm_runtime_enable(&pdev->dev);
pm_runtime_get_sync(&pdev->dev);
pm_runtime_set_autosuspend_delay(&pdev->dev, PXAV3_RPM_DELAY_MS);
pm_runtime_use_autosuspend(&pdev->dev);
pm_suspend_ignore_children(&pdev->dev, 1);
pm_runtime_get_noresume(&pdev->dev);

ret = sdhci_add_host(host);
if (ret) {
dev_err(&pdev->dev, "failed to add host\n");
pm_runtime_forbid(&pdev->dev);
pm_runtime_disable(&pdev->dev);
goto err_add_host;
}

Expand All @@ -318,6 +315,8 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
err_of_parse:
err_cd_req:
err_add_host:
pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev);
clk_disable_unprepare(clk);
clk_put(clk);
err_clk_get:
Expand Down

0 comments on commit 0dcaa24

Please sign in to comment.