mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 18:10:52 +07:00
ACPI / PM: Prevent acpi_power_get_inferred_state() from making changes
acpi_power_get_inferred_state() should not update device->power.state behind the back of its caller, so make it return the state via a pointer instead. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
parent
3c0eee3fe6
commit
32a00d274e
@ -222,7 +222,8 @@ int acpi_bus_get_power(acpi_handle handle, int *state)
|
||||
* indirectly (via power resources).
|
||||
*/
|
||||
if (device->power.flags.power_resources) {
|
||||
result = acpi_power_get_inferred_state(device);
|
||||
result = acpi_power_get_inferred_state(device,
|
||||
&device->power.state);
|
||||
if (result)
|
||||
return result;
|
||||
} else if (device->power.flags.explicit_get) {
|
||||
|
@ -41,7 +41,7 @@ static inline int acpi_debugfs_init(void) { return 0; }
|
||||
int acpi_power_init(void);
|
||||
int acpi_device_sleep_wake(struct acpi_device *dev,
|
||||
int enable, int sleep_state, int dev_state);
|
||||
int acpi_power_get_inferred_state(struct acpi_device *device);
|
||||
int acpi_power_get_inferred_state(struct acpi_device *device, int *state);
|
||||
int acpi_power_transition(struct acpi_device *device, int state);
|
||||
extern int acpi_power_nocheck;
|
||||
|
||||
|
@ -423,19 +423,16 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev)
|
||||
Device Power Management
|
||||
-------------------------------------------------------------------------- */
|
||||
|
||||
int acpi_power_get_inferred_state(struct acpi_device *device)
|
||||
int acpi_power_get_inferred_state(struct acpi_device *device, int *state)
|
||||
{
|
||||
int result = 0;
|
||||
struct acpi_handle_list *list = NULL;
|
||||
int list_state = 0;
|
||||
int i = 0;
|
||||
|
||||
|
||||
if (!device)
|
||||
if (!device || !state)
|
||||
return -EINVAL;
|
||||
|
||||
device->power.state = ACPI_STATE_UNKNOWN;
|
||||
|
||||
/*
|
||||
* We know a device's inferred power state when all the resources
|
||||
* required for a given D-state are 'on'.
|
||||
@ -450,13 +447,12 @@ int acpi_power_get_inferred_state(struct acpi_device *device)
|
||||
return result;
|
||||
|
||||
if (list_state == ACPI_POWER_RESOURCE_STATE_ON) {
|
||||
device->power.state = i;
|
||||
*state = i;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
device->power.state = ACPI_STATE_D3;
|
||||
|
||||
*state = ACPI_STATE_D3;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user