Patch "ACPI: PM: Turn off unused wakeup power resources" has been added to the 5.14-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ACPI: PM: Turn off unused wakeup power resources

to the 5.14-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     acpi-pm-turn-off-unused-wakeup-power-resources.patch
and it can be found in the queue-5.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 43a27eed6dbb8972a63b444dc8d318ff5749810c
Author: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
Date:   Fri Oct 15 19:01:28 2021 +0200

    ACPI: PM: Turn off unused wakeup power resources
    
    [ Upstream commit 7a63296d6f579a02b2675b4b0fe5b1cd3235e8d3 ]
    
    If an ACPI power resource is found to be "on" during the
    initialization of the list of wakeup power resources of a device,
    it is reference counted and its wakeup_enabled flag is set, which is
    problematic if the deivce in question is the only user of the given
    power resource, it is never runtime-suspended and it is not allowed
    to wake up the system from sleep, because in that case the given
    power resource will stay "on" until the system reboots and energy
    will be wasted.
    
    It is better to simply turn off wakeup power resources that are "on"
    during the initialization unless their reference counters are not
    zero, because that may be the only opportunity to prevent them from
    staying in the "on" state all the time.
    
    Fixes: b5d667eb392e ("ACPI / PM: Take unusual configurations of power resources into account")
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index eba7785047cad..dfe760bd7157f 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -606,20 +606,19 @@ int acpi_power_wakeup_list_init(struct list_head *list, int *system_level_p)
 
 	list_for_each_entry(entry, list, node) {
 		struct acpi_power_resource *resource = entry->resource;
-		int result;
 		u8 state;
 
 		mutex_lock(&resource->resource_lock);
 
-		result = acpi_power_get_state(resource, &state);
-		if (result) {
-			mutex_unlock(&resource->resource_lock);
-			return result;
-		}
-		if (state == ACPI_POWER_RESOURCE_STATE_ON) {
-			resource->ref_count++;
-			resource->wakeup_enabled = true;
-		}
+		/*
+		 * Make sure that the power resource state and its reference
+		 * counter value are consistent with each other.
+		 */
+		if (!resource->ref_count &&
+		    !acpi_power_get_state(resource, &state) &&
+		    state == ACPI_POWER_RESOURCE_STATE_ON)
+			__acpi_power_off(resource);
+
 		if (system_level > resource->system_level)
 			system_level = resource->system_level;
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux