Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ACPI: thermal: Rework system suspend and resume handling

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@intel.com>
Acked-by: lihuisong@huawei.com
Link: https://patch.msgid.link/3024049.e9J7NaK4W3@rafael.j.wysocki

+13 -24
+13 -24
drivers/acpi/thermal.c
··· 911 911 } 912 912 913 913 #ifdef CONFIG_PM_SLEEP 914 - static int acpi_thermal_suspend(struct device *dev) 914 + static int acpi_thermal_prepare(struct device *dev) 915 915 { 916 916 /* Make sure the previously queued thermal check work has been done */ 917 917 flush_workqueue(acpi_thermal_pm_queue); 918 918 return 0; 919 919 } 920 920 921 - static int acpi_thermal_resume(struct device *dev) 921 + static void acpi_thermal_complete(struct device *dev) 922 922 { 923 - struct acpi_thermal *tz = dev_get_drvdata(dev); 924 - int i, j; 925 - 926 - for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) { 927 - struct acpi_thermal_trip *acpi_trip = &tz->trips.active[i].trip; 928 - 929 - if (!acpi_thermal_trip_valid(acpi_trip)) 930 - break; 931 - 932 - for (j = 0; j < acpi_trip->devices.count; j++) 933 - acpi_bus_update_power(acpi_trip->devices.handles[j], NULL); 934 - } 935 - 936 - acpi_queue_thermal_check(tz); 937 - 938 - return AE_OK; 923 + acpi_queue_thermal_check(dev_get_drvdata(dev)); 939 924 } 940 - #else 941 - #define acpi_thermal_suspend NULL 942 - #define acpi_thermal_resume NULL 943 - #endif 944 - static SIMPLE_DEV_PM_OPS(acpi_thermal_pm, acpi_thermal_suspend, acpi_thermal_resume); 925 + 926 + static const struct dev_pm_ops acpi_thermal_pm_ops = { 927 + .prepare = acpi_thermal_prepare, 928 + .complete = acpi_thermal_complete, 929 + }; 930 + #define ACPI_THERMAL_PM &acpi_thermal_pm_ops 931 + #else /* !CONFIG_PM_SLEEP */ 932 + #define ACPI_THERMAL_PM NULL 933 + #endif /* CONFIG_PM_SLEEP */ 945 934 946 935 static const struct acpi_device_id thermal_device_ids[] = { 947 936 {ACPI_THERMAL_HID, 0}, ··· 944 955 .driver = { 945 956 .name = "acpi-thermal", 946 957 .acpi_match_table = thermal_device_ids, 947 - .pm = &acpi_thermal_pm, 958 + .pm = ACPI_THERMAL_PM, 948 959 }, 949 960 }; 950 961