]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ACPI: processor: idle: Remove redundant static variable and rename cstate check function
authorHuisong Li <lihuisong@huawei.com>
Wed, 11 Mar 2026 06:50:38 +0000 (14:50 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 11 Mar 2026 18:26:28 +0000 (19:26 +0100)
The function acpi_processor_cstate_first_run_checks() is currently called
only once during initialization in acpi_processor_register_idle_driver().

Since its execution is already limited by the caller's lifecycle, the
internal static 'first_run' variable is redundant and can be safely
removed.

Additionally, the current function name is no longer descriptive of its
behavior, so rename the function to acpi_processor_update_max_cstate()
to better reflect its actual purpose.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Link: https://patch.msgid.link/20260311065038.4151558-4-lihuisong@huawei.com
[ rjw: Changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/processor_idle.c

index 625f80fe0b980c5389fee14c8033d04d2379260f..45b5d17443cfbdf22c1a4705c2b0bba6a5505db2 100644 (file)
@@ -819,19 +819,13 @@ static void acpi_processor_setup_cstates(struct acpi_processor *pr)
        drv->state_count = count;
 }
 
-static inline void acpi_processor_cstate_first_run_checks(void)
+static inline void acpi_processor_update_max_cstate(void)
 {
-       static int first_run;
-
-       if (first_run)
-               return;
        dmi_check_system(processor_power_dmi_table);
        max_cstate = acpi_processor_cstate_check(max_cstate);
        if (max_cstate < ACPI_C_STATES_MAX)
                pr_notice("processor limited to max C-state %d\n", max_cstate);
 
-       first_run++;
-
        if (nocst)
                return;
 
@@ -840,7 +834,7 @@ static inline void acpi_processor_cstate_first_run_checks(void)
 #else
 
 static inline int disabled_by_idle_boot_param(void) { return 0; }
-static inline void acpi_processor_cstate_first_run_checks(void) { }
+static inline void acpi_processor_update_max_cstate(void) { }
 static int acpi_processor_get_cstate_info(struct acpi_processor *pr)
 {
        return -ENODEV;
@@ -1359,7 +1353,7 @@ void acpi_processor_register_idle_driver(void)
        int ret = -ENODEV;
        int cpu;
 
-       acpi_processor_cstate_first_run_checks();
+       acpi_processor_update_max_cstate();
 
        /*
         * ACPI idle driver is used by all possible CPUs.