diff options
author | Maciej S. Szmigiero <mail@maciej.szmigiero.name> | 2025-08-03 21:18:11 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2025-08-25 16:25:54 +0200 |
commit | 3bc3dc166dd23404bb2091292cd4e17f87678ca6 (patch) | |
tree | 2942dd096eded2010b7ccffe87736c7924d0bf3b | |
parent | 1b237f190eb3d36f52dffe07a40b5eb210280e00 (diff) |
ACPI: PM: Add power resource init function
This way DMI based quirk matching and quirk flag initialization can be done
just once - in the newly introduced acpi_power_resources_init() function,
which is similar to existing acpi_*_init() functions.
Convert the single already existing DMI match-based quirk in this ACPI
power resource handler ("leave unused power resources on" quirk) to such
one-time initialization in acpi_power_resources_init() function instead of
re-running that DMI match each time acpi_turn_off_unused_power_resources()
gets called.
Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Link: https://patch.msgid.link/b173a6987f0b35597fd82400cb28f289786e03d0.1754243159.git.mail@maciej.szmigiero.name
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/acpi/internal.h | 1 | ||||
-rw-r--r-- | drivers/acpi/power.c | 10 | ||||
-rw-r--r-- | drivers/acpi/scan.c | 1 |
3 files changed, 11 insertions, 1 deletions
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index e2781864fdce..63354972ab0b 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h @@ -140,6 +140,7 @@ int __acpi_device_uevent_modalias(const struct acpi_device *adev, /* -------------------------------------------------------------------------- Power Resource -------------------------------------------------------------------------- */ +void acpi_power_resources_init(void); void acpi_power_resources_list_free(struct list_head *list); int acpi_extract_power_resources(union acpi_object *package, unsigned int start, struct list_head *list); diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index b7243d7563b1..cd9380b1f951 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c @@ -63,6 +63,8 @@ struct acpi_power_resource_entry { struct acpi_power_resource *resource; }; +static bool unused_power_resources_quirk; + static LIST_HEAD(acpi_power_resource_list); static DEFINE_MUTEX(power_resource_list_lock); @@ -1046,7 +1048,7 @@ void acpi_turn_off_unused_power_resources(void) { struct acpi_power_resource *resource; - if (dmi_check_system(dmi_leave_unused_power_resources_on)) + if (unused_power_resources_quirk) return; mutex_lock(&power_resource_list_lock); @@ -1065,3 +1067,9 @@ void acpi_turn_off_unused_power_resources(void) mutex_unlock(&power_resource_list_lock); } + +void __init acpi_power_resources_init(void) +{ + unused_power_resources_quirk = + dmi_check_system(dmi_leave_unused_power_resources_on); +} diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index fb1fe9f3b1a3..bb74e7834435 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -2702,6 +2702,7 @@ void __init acpi_scan_init(void) acpi_memory_hotplug_init(); acpi_watchdog_init(); acpi_pnp_init(); + acpi_power_resources_init(); acpi_int340x_thermal_init(); acpi_init_lpit(); |