Skip to content

Commit a1224f3

Browse files
committed
ACPI: PM: Check states of power resources during initialization
To avoid situations in which the actual states of certain ACPI power resources are not known just because they have never been referenced by any device configuration objects, check the initial states of all power resources as soon as they are found in the ACPI namespace (and fall back to turning them on if the state check fails). Signed-off-by: Rafael J. Wysocki <[email protected]> Tested-by: Andreas K. Huettel <[email protected]>
1 parent bc28368 commit a1224f3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/acpi/power.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,7 @@ struct acpi_device *acpi_add_power_resource(acpi_handle handle)
943943
union acpi_object acpi_object;
944944
struct acpi_buffer buffer = { sizeof(acpi_object), &acpi_object };
945945
acpi_status status;
946+
u8 state_dummy;
946947
int result;
947948

948949
acpi_bus_get_device(handle, &device);
@@ -971,6 +972,10 @@ struct acpi_device *acpi_add_power_resource(acpi_handle handle)
971972
resource->order = acpi_object.power_resource.resource_order;
972973
resource->state = ACPI_POWER_RESOURCE_STATE_UNKNOWN;
973974

975+
/* Get the initial state or just flip it on if that fails. */
976+
if (acpi_power_get_state(resource, &state_dummy))
977+
__acpi_power_on(resource);
978+
974979
pr_info("%s [%s]\n", acpi_device_name(device), acpi_device_bid(device));
975980

976981
device->flags.match_driver = true;

0 commit comments

Comments
 (0)