Skip to content

Commit 3bc3dc1

Browse files
maciejsszmigierorafaeljw
authored andcommitted
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>
1 parent 1b237f1 commit 3bc3dc1

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

drivers/acpi/internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ int __acpi_device_uevent_modalias(const struct acpi_device *adev,
140140
/* --------------------------------------------------------------------------
141141
Power Resource
142142
-------------------------------------------------------------------------- */
143+
void acpi_power_resources_init(void);
143144
void acpi_power_resources_list_free(struct list_head *list);
144145
int acpi_extract_power_resources(union acpi_object *package, unsigned int start,
145146
struct list_head *list);

drivers/acpi/power.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ struct acpi_power_resource_entry {
6363
struct acpi_power_resource *resource;
6464
};
6565

66+
static bool unused_power_resources_quirk;
67+
6668
static LIST_HEAD(acpi_power_resource_list);
6769
static DEFINE_MUTEX(power_resource_list_lock);
6870

@@ -1046,7 +1048,7 @@ void acpi_turn_off_unused_power_resources(void)
10461048
{
10471049
struct acpi_power_resource *resource;
10481050

1049-
if (dmi_check_system(dmi_leave_unused_power_resources_on))
1051+
if (unused_power_resources_quirk)
10501052
return;
10511053

10521054
mutex_lock(&power_resource_list_lock);
@@ -1065,3 +1067,9 @@ void acpi_turn_off_unused_power_resources(void)
10651067

10661068
mutex_unlock(&power_resource_list_lock);
10671069
}
1070+
1071+
void __init acpi_power_resources_init(void)
1072+
{
1073+
unused_power_resources_quirk =
1074+
dmi_check_system(dmi_leave_unused_power_resources_on);
1075+
}

drivers/acpi/scan.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2702,6 +2702,7 @@ void __init acpi_scan_init(void)
27022702
acpi_memory_hotplug_init();
27032703
acpi_watchdog_init();
27042704
acpi_pnp_init();
2705+
acpi_power_resources_init();
27052706
acpi_int340x_thermal_init();
27062707
acpi_init_lpit();
27072708

0 commit comments

Comments
 (0)