]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ACPI: PM: Add power resource init function
authorMaciej S. Szmigiero <mail@maciej.szmigiero.name>
Sun, 3 Aug 2025 19:18:11 +0000 (21:18 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 25 Aug 2025 14:25:54 +0000 (16:25 +0200)
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>
drivers/acpi/internal.h
drivers/acpi/power.c
drivers/acpi/scan.c

index e2781864fdcebd54cc3a16ae33f3a7ec36fd5754..63354972ab0b8af6b4ac5f7492bfef4e0dc129b0 100644 (file)
@@ -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);
index b7243d7563b1bb22e52a246a6e766f4005c779f4..cd9380b1f9516bb1a3ff0fa3f9bffa115b0edd67 100644 (file)
@@ -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);
+}
index fb1fe9f3b1a366196b814a35900921637ebc4656..bb74e78344358997e855d4d545206af227f0a263 100644 (file)
@@ -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();