diff options
author | Tejun Heo <tj@kernel.org> | 2018-08-06 10:22:35 -0700 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2018-08-06 10:22:35 -0700 |
commit | eac7e072d7e99fad1b6e817c608b03c48205241e (patch) | |
tree | 6e784ff60407a73b4822560fa0e09517149d3ad1 /drivers/ata/libahci_platform.c | |
parent | 11c291461b6ea8d1195a96d6bba6673a94aacebc (diff) |
Revert "ata: ahci_platform: allow disabling of hotplug to save power"
This reverts commit aece27a2f01be4bb7683790f69cd1bed3a0929a2.
Causes boot failure on some devices.
http://lore.kernel.org/r/CA+G9fYuKW_jCFZPqG4tz=QY9ROfHO38KiCp9XTA+KaDOFVtcqQ@mail.gmail.com
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/ata/libahci_platform.c')
-rw-r--r-- | drivers/ata/libahci_platform.c | 82 |
1 files changed, 17 insertions, 65 deletions
diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c index 2ceebaf2ed56..8fbb532b62dd 100644 --- a/drivers/ata/libahci_platform.c +++ b/drivers/ata/libahci_platform.c @@ -257,7 +257,7 @@ static void ahci_platform_put_resources(struct device *dev, void *res) int c; if (hpriv->got_runtime_pm) { - pm_runtime_allow(dev); + pm_runtime_put_sync(dev); pm_runtime_disable(dev); } @@ -477,10 +477,8 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev) if (rc == -EPROBE_DEFER) goto err_out; } - - pm_runtime_set_active(dev); pm_runtime_enable(dev); - pm_runtime_forbid(dev); + pm_runtime_get_sync(dev); hpriv->got_runtime_pm = true; devres_remove_group(dev, NULL); @@ -709,21 +707,6 @@ int ahci_platform_resume_host(struct device *dev) } EXPORT_SYMBOL_GPL(ahci_platform_resume_host); -static int _ahci_platform_suspend(struct device *dev) -{ - struct ata_host *host = dev_get_drvdata(dev); - struct ahci_host_priv *hpriv = host->private_data; - int rc; - - rc = ahci_platform_suspend_host(dev); - if (rc) - return rc; - - ahci_platform_disable_resources(hpriv); - - return 0; -} - /** * ahci_platform_suspend - Suspend an ahci-platform device * @dev: the platform device to suspend @@ -736,44 +719,19 @@ static int _ahci_platform_suspend(struct device *dev) */ int ahci_platform_suspend(struct device *dev) { - return _ahci_platform_suspend(dev); -} -EXPORT_SYMBOL_GPL(ahci_platform_suspend); - -/** - * ahci_platform_runtime_suspend - Runtime suspend an ahci-platform device - * @dev: the platform device to suspend - * - * This function suspends the host associated with the device, followed by - * disabling all the resources of the device. - * - * RETURNS: - * 0 on success otherwise a negative error code - */ -int ahci_platform_runtime_suspend(struct device *dev) -{ - return _ahci_platform_suspend(dev); -} -EXPORT_SYMBOL_GPL(ahci_platform_runtime_suspend); - -static int _ahci_platform_resume(struct device *dev) -{ struct ata_host *host = dev_get_drvdata(dev); struct ahci_host_priv *hpriv = host->private_data; int rc; - rc = ahci_platform_enable_resources(hpriv); + rc = ahci_platform_suspend_host(dev); if (rc) return rc; - rc = ahci_platform_resume_host(dev); - if (rc) { - ahci_platform_disable_resources(hpriv); - return rc; - } + ahci_platform_disable_resources(hpriv); return 0; } +EXPORT_SYMBOL_GPL(ahci_platform_suspend); /** * ahci_platform_resume - Resume an ahci-platform device @@ -787,37 +745,31 @@ static int _ahci_platform_resume(struct device *dev) */ int ahci_platform_resume(struct device *dev) { + struct ata_host *host = dev_get_drvdata(dev); + struct ahci_host_priv *hpriv = host->private_data; int rc; - rc = _ahci_platform_resume(dev); + rc = ahci_platform_enable_resources(hpriv); if (rc) return rc; + rc = ahci_platform_resume_host(dev); + if (rc) + goto disable_resources; + /* We resumed so update PM runtime state */ pm_runtime_disable(dev); pm_runtime_set_active(dev); pm_runtime_enable(dev); return 0; -} -EXPORT_SYMBOL_GPL(ahci_platform_resume); -/** - * ahci_platform_runtime_resume - Runtime resume an ahci-platform device - * @dev: the platform device to resume - * - * This function enables all the resources of the device followed by - * resuming the host associated with the device. - * - * RETURNS: - * 0 on success otherwise a negative error code - */ -int ahci_platform_runtime_resume(struct device *dev) -{ - return _ahci_platform_resume(dev); -} -EXPORT_SYMBOL_GPL(ahci_platform_runtime_resume); +disable_resources: + ahci_platform_disable_resources(hpriv); + return rc; +} +EXPORT_SYMBOL_GPL(ahci_platform_resume); #endif MODULE_DESCRIPTION("AHCI SATA platform library"); |