Skip to content

Commit

Permalink
ACPI / PM: Combine two identical device resume routines
Browse files Browse the repository at this point in the history
Notice that acpi_dev_runtime_resume() and acpi_dev_resume_early() are
actually literally identical after some more-or-less recent changes,
so rename acpi_dev_runtime_resume() to acpi_dev_resume(), use it
everywhere instead of acpi_dev_resume_early() and drop the latter.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
  • Loading branch information
Rafael J. Wysocki committed Oct 11, 2017
1 parent 8055af0 commit 63705c4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 34 deletions.
6 changes: 3 additions & 3 deletions drivers/acpi/acpi_lpss.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ static int acpi_lpss_activate(struct device *dev)
struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev));
int ret;

ret = acpi_dev_runtime_resume(dev);
ret = acpi_dev_resume(dev);
if (ret)
return ret;

Expand Down Expand Up @@ -737,7 +737,7 @@ static int acpi_lpss_resume_early(struct device *dev)
struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev));
int ret;

ret = acpi_dev_resume_early(dev);
ret = acpi_dev_resume(dev);
if (ret)
return ret;

Expand Down Expand Up @@ -872,7 +872,7 @@ static int acpi_lpss_runtime_resume(struct device *dev)
if (lpss_quirks & LPSS_QUIRK_ALWAYS_POWER_ON && iosf_mbi_available())
lpss_iosf_exit_d3_state();

ret = acpi_dev_runtime_resume(dev);
ret = acpi_dev_resume(dev);
if (ret)
return ret;

Expand Down
35 changes: 6 additions & 29 deletions drivers/acpi/device_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -882,14 +882,13 @@ int acpi_dev_runtime_suspend(struct device *dev)
EXPORT_SYMBOL_GPL(acpi_dev_runtime_suspend);

/**
* acpi_dev_runtime_resume - Put device into the full-power state using ACPI.
* acpi_dev_resume - Put device into the full-power state using ACPI.
* @dev: Device to put into the full-power state.
*
* Put the given device into the full-power state using the standard ACPI
* mechanism at run time. Set the power state of the device to ACPI D0 and
* disable remote wakeup.
* mechanism. Set the power state of the device to ACPI D0 and disable wakeup.
*/
int acpi_dev_runtime_resume(struct device *dev)
int acpi_dev_resume(struct device *dev)
{
struct acpi_device *adev = ACPI_COMPANION(dev);
int error;
Expand All @@ -901,7 +900,7 @@ int acpi_dev_runtime_resume(struct device *dev)
acpi_device_wakeup_disable(adev);
return error;
}
EXPORT_SYMBOL_GPL(acpi_dev_runtime_resume);
EXPORT_SYMBOL_GPL(acpi_dev_resume);

/**
* acpi_subsys_runtime_suspend - Suspend device using ACPI.
Expand All @@ -926,7 +925,7 @@ EXPORT_SYMBOL_GPL(acpi_subsys_runtime_suspend);
*/
int acpi_subsys_runtime_resume(struct device *dev)
{
int ret = acpi_dev_runtime_resume(dev);
int ret = acpi_dev_resume(dev);
return ret ? ret : pm_generic_runtime_resume(dev);
}
EXPORT_SYMBOL_GPL(acpi_subsys_runtime_resume);
Expand Down Expand Up @@ -967,28 +966,6 @@ int acpi_dev_suspend_late(struct device *dev)
}
EXPORT_SYMBOL_GPL(acpi_dev_suspend_late);

/**
* acpi_dev_resume_early - Put device into the full-power state using ACPI.
* @dev: Device to put into the full-power state.
*
* Put the given device into the full-power state using the standard ACPI
* mechanism during system transition to the working state. Set the power
* state of the device to ACPI D0 and disable remote wakeup.
*/
int acpi_dev_resume_early(struct device *dev)
{
struct acpi_device *adev = ACPI_COMPANION(dev);
int error;

if (!adev)
return 0;

error = acpi_dev_pm_full_power(adev);
acpi_device_wakeup_disable(adev);
return error;
}
EXPORT_SYMBOL_GPL(acpi_dev_resume_early);

/**
* acpi_subsys_prepare - Prepare device for system transition to a sleep state.
* @dev: Device to prepare.
Expand Down Expand Up @@ -1057,7 +1034,7 @@ EXPORT_SYMBOL_GPL(acpi_subsys_suspend_late);
*/
int acpi_subsys_resume_early(struct device *dev)
{
int ret = acpi_dev_resume_early(dev);
int ret = acpi_dev_resume(dev);
return ret ? ret : pm_generic_resume_early(dev);
}
EXPORT_SYMBOL_GPL(acpi_subsys_resume_early);
Expand Down
3 changes: 1 addition & 2 deletions include/linux/acpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ static inline void arch_reserve_mem_area(acpi_physical_address addr,

#if defined(CONFIG_ACPI) && defined(CONFIG_PM)
int acpi_dev_runtime_suspend(struct device *dev);
int acpi_dev_runtime_resume(struct device *dev);
int acpi_dev_resume(struct device *dev);
int acpi_subsys_runtime_suspend(struct device *dev);
int acpi_subsys_runtime_resume(struct device *dev);
int acpi_dev_pm_attach(struct device *dev, bool power_on);
Expand All @@ -882,7 +882,6 @@ static inline int acpi_dev_pm_attach(struct device *dev, bool power_on)

#if defined(CONFIG_ACPI) && defined(CONFIG_PM_SLEEP)
int acpi_dev_suspend_late(struct device *dev);
int acpi_dev_resume_early(struct device *dev);
int acpi_subsys_prepare(struct device *dev);
void acpi_subsys_complete(struct device *dev);
int acpi_subsys_suspend_late(struct device *dev);
Expand Down

0 comments on commit 63705c4

Please sign in to comment.