aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/device_pm.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-12-15 20:05:48 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-12-15 20:05:48 -0500
commitc51a024e3913e9dbaf4dfcb9aaba825668a89ace (patch)
tree9772af495ced0bde0d3c58b6e6fb5b395b3afae9 /drivers/acpi/device_pm.c
parent3487972d7fa6c5143951436ada5933dcf0ec659d (diff)
parent34fb8f0ba9ceea88e116688f9f53e3802c38aafb (diff)
Merge back PM core material for v4.16.
Diffstat (limited to 'drivers/acpi/device_pm.c')
-rw-r--r--drivers/acpi/device_pm.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
index a4c8ad98560d..c4d0a1c912f0 100644
--- a/drivers/acpi/device_pm.c
+++ b/drivers/acpi/device_pm.c
@@ -990,7 +990,7 @@ void acpi_subsys_complete(struct device *dev)
990 * the sleep state it is going out of and it has never been resumed till 990 * the sleep state it is going out of and it has never been resumed till
991 * now, resume it in case the firmware powered it up. 991 * now, resume it in case the firmware powered it up.
992 */ 992 */
993 if (dev->power.direct_complete && pm_resume_via_firmware()) 993 if (pm_runtime_suspended(dev) && pm_resume_via_firmware())
994 pm_request_resume(dev); 994 pm_request_resume(dev);
995} 995}
996EXPORT_SYMBOL_GPL(acpi_subsys_complete); 996EXPORT_SYMBOL_GPL(acpi_subsys_complete);
@@ -1039,10 +1039,28 @@ EXPORT_SYMBOL_GPL(acpi_subsys_suspend_late);
1039 */ 1039 */
1040int acpi_subsys_suspend_noirq(struct device *dev) 1040int acpi_subsys_suspend_noirq(struct device *dev)
1041{ 1041{
1042 if (dev_pm_smart_suspend_and_suspended(dev)) 1042 int ret;
1043
1044 if (dev_pm_smart_suspend_and_suspended(dev)) {
1045 dev->power.may_skip_resume = true;
1043 return 0; 1046 return 0;
1047 }
1048
1049 ret = pm_generic_suspend_noirq(dev);
1050 if (ret)
1051 return ret;
1052
1053 /*
1054 * If the target system sleep state is suspend-to-idle, it is sufficient
1055 * to check whether or not the device's wakeup settings are good for
1056 * runtime PM. Otherwise, the pm_resume_via_firmware() check will cause
1057 * acpi_subsys_complete() to take care of fixing up the device's state
1058 * anyway, if need be.
1059 */
1060 dev->power.may_skip_resume = device_may_wakeup(dev) ||
1061 !device_can_wakeup(dev);
1044 1062
1045 return pm_generic_suspend_noirq(dev); 1063 return 0;
1046} 1064}
1047EXPORT_SYMBOL_GPL(acpi_subsys_suspend_noirq); 1065EXPORT_SYMBOL_GPL(acpi_subsys_suspend_noirq);
1048 1066
@@ -1052,6 +1070,9 @@ EXPORT_SYMBOL_GPL(acpi_subsys_suspend_noirq);
1052 */ 1070 */
1053int acpi_subsys_resume_noirq(struct device *dev) 1071int acpi_subsys_resume_noirq(struct device *dev)
1054{ 1072{
1073 if (dev_pm_may_skip_resume(dev))
1074 return 0;
1075
1055 /* 1076 /*
1056 * Devices with DPM_FLAG_SMART_SUSPEND may be left in runtime suspend 1077 * Devices with DPM_FLAG_SMART_SUSPEND may be left in runtime suspend
1057 * during system suspend, so update their runtime PM status to "active" 1078 * during system suspend, so update their runtime PM status to "active"