[RFC/RFT][PATCH 3/3] ACPI / PM: Fix initial reference counting of power resources

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

 



From: Rafael J. Wysocki <rjw@xxxxxxx>

ACPI power resources are only reference counted during device power
state changes.  The initial device power states have no effect on
the reference counting of power resources.  This leads to the problem
that some power resources may be turned off too early when devices
are powered off during system suspend or via runtime PM.  Moreover,
the state of power resource reference counters after powering a
device on may be different than it had been before the device was
powered off.

To fix this issue, update power resource reference counting directly
during initialization by calling acpi_power_transition() for every
device using power resources.

Signed-off-by: Rafael J. Wysocki <rjw@xxxxxxx>
---
 drivers/acpi/scan.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Index: linux-2.6/drivers/acpi/scan.c
===================================================================
--- linux-2.6.orig/drivers/acpi/scan.c
+++ linux-2.6/drivers/acpi/scan.c
@@ -880,8 +880,10 @@ static int acpi_bus_get_power_flags(stru
 
 	/* TBD: System wake support and resource requirements. */
 
-	device->power.state = ACPI_STATE_UNKNOWN;
-	acpi_bus_get_power(device->handle, &(device->power.state));
+	acpi_bus_get_power(device->handle, &device->power.state);
+	/* Update power resources reference counting. */
+	if (device->power.flags.power_resources)
+		acpi_power_transition(device, device->power.state);
 
 	return 0;
 }

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux