diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2021-05-24 18:25:23 +0300 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2021-05-31 14:59:01 +0300 |
commit | ca84f18798a457e9a92c52882813901e15a3b38b (patch) | |
tree | 438c13defab125b76678179601d61b5cc6e0c7f3 /drivers/acpi/scan.c | |
parent | 587024b8210d4eeeab457323141c92e134cd3dbf (diff) | |
download | linux-ca84f18798a457e9a92c52882813901e15a3b38b.tar.xz |
ACPI: power: Save the last known state of each power resource
Currently, there are two ways to check the state of an ACPI power
resource and they may not be consistent with each other. The first
one is to evaluate the power resource's _STA object and the other one
is to check its reference counter value. However, on some systems
the value returned by _STA may not be consistent with the value of
the power resource's reference counter (for example, on some systems
it returns the same value every time for certain power resources).
Moreover, evaluating _STA is unnecessary overhead for a power
resource for which it has been evaluated already or whose state is
otherwise known, because either the _ON or the _OFF method has been
executed for it.
For this reason, save the state of each power resource in its
struct acpi_power_resource object and use the saved value whenever
its state needs to be checked, except when its stats is unknown, in
which case the _STA method is evaluated for it and the value
returned by that method is saved as the last known state of
the power resource.
Moreover, drop the power resource _STA method evaluation from
acpi_add_power_resource(), so as to avoid doing that unnecessarily
for power resources that will never be used.
Tested-by: Dave Olsthoorn <dave@bewaar.me>
Tested-by: Shujun Wang <wsj20369@163.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/scan.c')
0 files changed, 0 insertions, 0 deletions