]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
ACPI: PM: Avoid evaluating _PS3 on transitions from D3hot to D3cold
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 25 Jun 2019 12:04:45 +0000 (14:04 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 27 Jun 2019 10:29:59 +0000 (12:29 +0200)
If the power state of a device with ACPI PM is changed from D3hot to
D3cold, it merely is a matter of dropping references to additional
power resources (specifically, those in the list returned by _PR3),
and the _PS3 method should not be invoked for the device then (as
it has already been evaluated during the previous transition to
D3hot).

Fixes: 20dacb71ad28 (ACPI / PM: Rework device power management to follow ACPI 6)
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
drivers/acpi/device_pm.c

index b859d75eaf9f64a91a2e6ae38554ba9be91b47c4..3269a4e8b902a16461748f3cc331eda592351a94 100644 (file)
@@ -210,9 +210,15 @@ int acpi_device_set_power(struct acpi_device *device, int state)
                        return -ENODEV;
                }
 
-               result = acpi_dev_pm_explicit_set(device, state);
-               if (result)
-                       goto end;
+               /*
+                * If the device goes from D3hot to D3cold, _PS3 has been
+                * evaluated for it already, so skip it in that case.
+                */
+               if (device->power.state < ACPI_STATE_D3_HOT) {
+                       result = acpi_dev_pm_explicit_set(device, state);
+                       if (result)
+                               goto end;
+               }
 
                if (device->power.flags.power_resources)
                        result = acpi_power_transition(device, target_state);