Re: [PATCH v2 3/7] ACPI: processor: idle: Relocate and verify acpi_processor_ffh_lpi_probe

From: lihuisong (C)
Date: Tue Nov 04 2025 - 04:46:50 EST



在 2025/11/4 1:56, Rafael J. Wysocki 写道:
On Mon, Nov 3, 2025 at 9:42 AM Huisong Li <lihuisong@xxxxxxxxxx> wrote:
The platform used LPI need check if the LPI support and the entry
method is valid by the acpi_processor_ffh_lpi_probe(). But the return
of acpi_processor_ffh_lpi_probe() in acpi_processor_setup_cpuidle_dev()
isn't verified by any caller.

What's more, acpi_processor_get_power_info() is a more logical place for
verifying the validity of FFH LPI than acpi_processor_setup_cpuidle_dev().
So move acpi_processor_ffh_lpi_probe() from the latter to the former and
verify its return.

Fixes: a36a7fecfe60 ("ACPI / processor_idle: Add support for Low Power Idle(LPI) states")
If you want to add this Fixes: tag, please add some information on
what systems it breaks on and what the symptoms are to the changelog.
Sorry, I didn't specifically construct it.
This patch is just an optimization patch. All right, I will drop this Fixes tag.
Thanks for your reminder.

Signed-off-by: Huisong Li <lihuisong@xxxxxxxxxx>
---
drivers/acpi/processor_idle.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 5213a545fa78..c73df5933691 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -1266,7 +1266,7 @@ static int acpi_processor_setup_cpuidle_dev(struct acpi_processor *pr,

dev->cpu = pr->id;
if (pr->flags.has_lpi)
- return acpi_processor_ffh_lpi_probe(pr->id);
+ return 0;

return acpi_processor_setup_cpuidle_cx(pr, dev);
}
@@ -1277,7 +1277,13 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr)

ret = acpi_processor_get_lpi_info(pr);
if (ret)
- ret = acpi_processor_get_cstate_info(pr);
+ return acpi_processor_get_cstate_info(pr);
+
+ if (pr->flags.has_lpi) {
+ ret = acpi_processor_ffh_lpi_probe(pr->id);
+ if (ret)
+ pr_err("Processor FFH LPI state is invalid.\n");
+ }

return ret;
}
--