From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux ACPI <linux-acpi@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Linux PM <linux-pm@vger.kernel.org>,
David Box <david.e.box@linux.intel.com>
Subject: [PATCH v2 2/2] ACPI: power: Turn off unused power resources unconditionally
Date: Thu, 18 Mar 2021 19:28:28 +0100 [thread overview]
Message-ID: <20994880.EfDdHjke4D@kreacher> (raw)
In-Reply-To: <3108574.44csPzL39Z@kreacher>
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
According to the ACPI specification (section 7.2.2 in ACPI 6.4), the
OS may evaluate the _OFF method of a power resource that is "off"
already [1], and in particular that can be done in the case of unused
power resources.
Accordingly, modify acpi_turn_off_unused_power_resources() to
evaluate the _OFF method for each of the unused power resources
unconditionally which may help to work around BIOS issues where the
return value of _STA for a power resource does not reflect the
actual state of the power resource [2].
Link: https://uefi.org/specs/ACPI/6.4/07_Power_and_Performance_Mgmt/declaring-a-power-resource-object.html#off # [1]
Link: https://lore.kernel.org/lkml/20210314000439.3138941-1-luzmaximilian@gmail.com/ # [2]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
New patch in v2.
---
drivers/acpi/power.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
Index: linux-pm/drivers/acpi/power.c
===================================================================
--- linux-pm.orig/drivers/acpi/power.c
+++ linux-pm/drivers/acpi/power.c
@@ -1005,18 +1005,9 @@ void acpi_turn_off_unused_power_resource
mutex_lock(&power_resource_list_lock);
list_for_each_entry_reverse(resource, &acpi_power_resource_list, list_node) {
- int result, state;
-
mutex_lock(&resource->resource_lock);
- result = acpi_power_get_state(resource->device.handle, &state);
- if (result) {
- mutex_unlock(&resource->resource_lock);
- continue;
- }
-
- if (state == ACPI_POWER_RESOURCE_STATE_ON
- && !resource->ref_count) {
+ if (!resource->ref_count) {
dev_info(&resource->device.dev, "Turning OFF\n");
__acpi_power_off(resource);
}
prev parent reply other threads:[~2021-03-18 18:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-18 18:23 [PATCH v2 0/2] ACPI: scan: Turn off unused power resources during initialization Rafael J. Wysocki
2021-03-18 18:25 ` [PATCH v2 1/2] " Rafael J. Wysocki
2021-03-18 18:28 ` Rafael J. Wysocki [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20994880.EfDdHjke4D@kreacher \
--to=rjw@rjwysocki.net \
--cc=david.e.box@linux.intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).