[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <be2d54f7-77f1-4412-b650-4266f3b8882d@huawei.com>
Date: Thu, 18 Dec 2025 14:48:35 +0800
From: "lihuisong (C)" <lihuisong@...wei.com>
To: "Rafael J. Wysocki" <rafael@...nel.org>, Linux ACPI
<linux-acpi@...r.kernel.org>
CC: LKML <linux-kernel@...r.kernel.org>, Linux PM <linux-pm@...r.kernel.org>,
Armin Wolf <w_armin@....de>, Hans de Goede <hansg@...nel.org>,
<lihuisong@...wei.com>
Subject: Re: [PATCH v1 4/4] ACPI: thermal: Rework system suspend and resume
handling
在 2025/12/10 22:44, Rafael J. Wysocki 写道:
> From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
>
> In the process of handling system resume, acpi_thermal_resume() attempts
> to power up active cooling devices to guarantee that they will be
> operational when the ACPI thermal check queued by it runs. However,
> the only kind of cooling devices that can be bound to ACPI thermal zones
> is fans and they are already powered up by the ACPI fan driver resume,
> which additionally takes "ACPI 4" fans that don't need to be powered
> up into account.
>
> For this reason, remove the part of acpi_thermal_resume() related to
> fans and in order to ensure that it will run after powering up all fans,
> rename it to acpi_thermal_complete() and point the .complete() driver
> callback to it. Analogously, rename acpi_thermal_suspend() to
> acpi_thermal_prepare() and point the .prepare() driver callback to it.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> ---
> drivers/acpi/thermal.c | 37 +++++++++++++------------------------
> 1 file changed, 13 insertions(+), 24 deletions(-)
>
> --- a/drivers/acpi/thermal.c
> +++ b/drivers/acpi/thermal.c
> @@ -911,37 +911,26 @@ static void acpi_thermal_remove(struct p
> }
>
> #ifdef CONFIG_PM_SLEEP
> -static int acpi_thermal_suspend(struct device *dev)
> +static int acpi_thermal_prepare(struct device *dev)
> {
> /* Make sure the previously queued thermal check work has been done */
> flush_workqueue(acpi_thermal_pm_queue);
> return 0;
> }
>
> -static int acpi_thermal_resume(struct device *dev)
> +static void acpi_thermal_complete(struct device *dev)
> {
> - struct acpi_thermal *tz = dev_get_drvdata(dev);
> - int i, j;
> -
> - for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) {
> - struct acpi_thermal_trip *acpi_trip = &tz->trips.active[i].trip;
> -
> - if (!acpi_thermal_trip_valid(acpi_trip))
> - break;
> -
> - for (j = 0; j < acpi_trip->devices.count; j++)
> - acpi_bus_update_power(acpi_trip->devices.handles[j], NULL);
> - }
> -
> - acpi_queue_thermal_check(tz);
> -
> - return AE_OK;
> + acpi_queue_thermal_check(dev_get_drvdata(dev));
> }
> -#else
> -#define acpi_thermal_suspend NULL
> -#define acpi_thermal_resume NULL
> -#endif
> -static SIMPLE_DEV_PM_OPS(acpi_thermal_pm, acpi_thermal_suspend, acpi_thermal_resume);
> +
> +static const struct dev_pm_ops acpi_thermal_pm_ops = {
> + .prepare = acpi_thermal_prepare,
> + .complete = acpi_thermal_complete,
> +};
> +#define ACPI_THERMAL_PM &acpi_thermal_pm_ops
> +#else /* !CONFIG_PM_SLEEP */
> +#define ACPI_THERMAL_PM NULL
> +#endif /* CONFIG_PM_SLEEP */
>
> static const struct acpi_device_id thermal_device_ids[] = {
> {ACPI_THERMAL_HID, 0},
> @@ -955,7 +944,7 @@ static struct platform_driver acpi_therm
> .driver = {
> .name = "acpi-thermal",
> .acpi_match_table = thermal_device_ids,
> - .pm = &acpi_thermal_pm,
> + .pm = ACPI_THERMAL_PM,
> },
> };
>
This rework is good to me. It is more reasonable.
Acked-by: lihuisong@...wei.com
>
>
>
>
Powered by blists - more mailing lists