ACPI: processor: idle: Rework flatten_lpi_states()

Rewrite flatten_lpi_states() to make it easier to follow:

 * Rename its flat_state_cnt, curr_level and prev_level parameters to
   state_count, curr, and prev, respectively, so their names match the
   names of analogous variables in acpi_processor_get_lpi_info().

 * Eliminate a redundant local variable state_count.

 * Move definitions of local variables to the code blocks in which
   they are used.

 * Reduce the indentation level in the inner loop.

 * Use more meaningful names for local variables.

 * Move two statements that belong in acpi_processor_get_lpi_info()
   from flatten_lpi_states() to that function.

 * Use acpi_handle_info() for printing a message when the count of
   flattened states gets too large and drop the message requesting
   ACPI_PROCESSOR_MAX_POWER to be adjusted which is pointless.

 * Add a comment explaining what happens in that function.

No intentional functional impact beyond the message printed when
the count of flattened states is too large.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Sudeep Holla <sudeep.holla@kernel.org>
Acked-by: Huisong Li <lihuisong@huawei.com>
Link: https://patch.msgid.link/2064627.usQuhbGJ8B@rafael.j.wysocki
This commit is contained in:
Rafael J. Wysocki 2026-07-09 14:39:06 +02:00
commit 592343c4d2