Commit 032b4cc8 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'pm-4.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management fix from Rafael Wysocki:
 "This fixes an issue in two recent commits that may cause
  pm_runtime_enable() to be called for too many times for some devices
  during the "thaw" transition belonging to hibernation"

* tag 'pm-4.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  PM / sleep: Avoid excess pm_runtime_enable() calls in device_resume()
parents 04243787 3487972d
...@@ -1138,7 +1138,7 @@ int acpi_subsys_thaw_noirq(struct device *dev) ...@@ -1138,7 +1138,7 @@ int acpi_subsys_thaw_noirq(struct device *dev)
* skip all of the subsequent "thaw" callbacks for the device. * skip all of the subsequent "thaw" callbacks for the device.
*/ */
if (dev_pm_smart_suspend_and_suspended(dev)) { if (dev_pm_smart_suspend_and_suspended(dev)) {
dev->power.direct_complete = true; dev_pm_skip_next_resume_phases(dev);
return 0; return 0;
} }
......
...@@ -525,6 +525,21 @@ static void dpm_watchdog_clear(struct dpm_watchdog *wd) ...@@ -525,6 +525,21 @@ static void dpm_watchdog_clear(struct dpm_watchdog *wd)
/*------------------------- Resume routines -------------------------*/ /*------------------------- Resume routines -------------------------*/
/**
* dev_pm_skip_next_resume_phases - Skip next system resume phases for device.
* @dev: Target device.
*
* Make the core skip the "early resume" and "resume" phases for @dev.
*
* This function can be called by middle-layer code during the "noirq" phase of
* system resume if necessary, but not by device drivers.
*/
void dev_pm_skip_next_resume_phases(struct device *dev)
{
dev->power.is_late_suspended = false;
dev->power.is_suspended = false;
}
/** /**
* device_resume_noirq - Execute a "noirq resume" callback for given device. * device_resume_noirq - Execute a "noirq resume" callback for given device.
* @dev: Device to handle. * @dev: Device to handle.
......
...@@ -999,7 +999,7 @@ static int pci_pm_thaw_noirq(struct device *dev) ...@@ -999,7 +999,7 @@ static int pci_pm_thaw_noirq(struct device *dev)
* the subsequent "thaw" callbacks for the device. * the subsequent "thaw" callbacks for the device.
*/ */
if (dev_pm_smart_suspend_and_suspended(dev)) { if (dev_pm_smart_suspend_and_suspended(dev)) {
dev->power.direct_complete = true; dev_pm_skip_next_resume_phases(dev);
return 0; return 0;
} }
......
...@@ -765,6 +765,7 @@ extern int pm_generic_poweroff_late(struct device *dev); ...@@ -765,6 +765,7 @@ extern int pm_generic_poweroff_late(struct device *dev);
extern int pm_generic_poweroff(struct device *dev); extern int pm_generic_poweroff(struct device *dev);
extern void pm_generic_complete(struct device *dev); extern void pm_generic_complete(struct device *dev);
extern void dev_pm_skip_next_resume_phases(struct device *dev);
extern bool dev_pm_smart_suspend_and_suspended(struct device *dev); extern bool dev_pm_smart_suspend_and_suspended(struct device *dev);
#else /* !CONFIG_PM_SLEEP */ #else /* !CONFIG_PM_SLEEP */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment