Thermal control fixes for 6.9-rc3

- Allow the power allocator thermal governor to bind to a thermal zone
    without cooling devices and/or without trip points (Nikita Travkin).
 
  - Make the ACPI thermal driver register a tripless thermal zone when
    it cannot find any usable trip points instead of returning an error
    from acpi_thermal_add() (Stephen Horvath).
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAmYQQtYSHHJqd0Byand5
 c29ja2kubmV0AAoJEILEb/54YlRxeWEP/jyiNme6QnHqaZdXle5vOxBwniuCCOZS
 GdaJAdyhi5P+3jmc77yu9PqFjflfhJexVl7iYa1L8DvabJDTt2LlYwvb5aihfOU0
 WoBNpuo+4QWCQDo7QDoNZIlP0nh1fEs9SBEGJIyIQcpBQP5s2EqsRBiGYjrx1p85
 wQrG2mwemEKedUg1aA3IjiuKpa8Mj5bYFV/Y1/DWDl8E/vAXMFVEY6VKNFtmBUB5
 +hhl2sYoMcnn1GcKIF2ksyVU1ohid0bz0/LELsGhIAib1E1e20vqDhK6rQfwY8xh
 rrgNDYUyK2cJzY8sA+xxWeC8oqxoGkwguvELpNRwESXYkvjV2B70SYqFPtnTwVjP
 0T/eQKxpkWPJhH6P89HfnglzOekU87xc3S4roDp00jdgl2VVIYrCBRHpcb+vNyRb
 e071zWiKMXJLcTu45McbStQleD932GB4RGJKs5Chs48/yiwZypTNdbLyedEmU6+U
 8PMn1vnUg7iLhKCKWgeUBLPsAqCUMRu6/dgVcM815BkWKYLifkvcmo6S2+/kjdyO
 0oDA2JFEPHcfOvrsr+UD+glT/dPyeJG17QFgiAXdG2X1ofZYZTf/CQW8yLFMRXGB
 xicOhfZPVsNf2wpHvE4UgYO0tGWoT2GpRpaB4LPMNtcS03kG6wKZ0hJG+YKk1WaL
 Yb/WwQ+WL9yx
 =7G/r
 -----END PGP SIGNATURE-----

Merge tag 'thermal-6.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull thermal control fixes from Rafael Wysocki:
 "These fix two power allocator thermal governor issues and an ACPI
  thermal driver regression that all were introduced during the 6.8
  development cycle.

  Specifics:

   - Allow the power allocator thermal governor to bind to a thermal
     zone without cooling devices and/or without trip points (Nikita
     Travkin)

   - Make the ACPI thermal driver register a tripless thermal zone when
     it cannot find any usable trip points instead of returning an error
     from acpi_thermal_add() (Stephen Horvath)"

* tag 'thermal-6.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  thermal: gov_power_allocator: Allow binding without trip points
  thermal: gov_power_allocator: Allow binding without cooling devices
  ACPI: thermal: Register thermal zones without valid trip points
This commit is contained in:
Linus Torvalds 2024-04-05 12:51:32 -07:00
commit b21defcb52
2 changed files with 15 additions and 21 deletions

View File

@ -662,14 +662,15 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz,
{
int result;
tz->thermal_zone = thermal_zone_device_register_with_trips("acpitz",
trip_table,
trip_count,
tz,
&acpi_thermal_zone_ops,
NULL,
passive_delay,
tz->polling_frequency * 100);
if (trip_count)
tz->thermal_zone = thermal_zone_device_register_with_trips(
"acpitz", trip_table, trip_count, tz,
&acpi_thermal_zone_ops, NULL, passive_delay,
tz->polling_frequency * 100);
else
tz->thermal_zone = thermal_tripless_zone_device_register(
"acpitz", tz, &acpi_thermal_zone_ops, NULL);
if (IS_ERR(tz->thermal_zone))
return PTR_ERR(tz->thermal_zone);
@ -901,11 +902,8 @@ static int acpi_thermal_add(struct acpi_device *device)
trip++;
}
if (trip == trip_table) {
if (trip == trip_table)
pr_warn(FW_BUG "No valid trip points!\n");
result = -ENODEV;
goto free_memory;
}
result = acpi_thermal_register_thermal_zone(tz, trip_table,
trip - trip_table,

View File

@ -606,7 +606,7 @@ static int allocate_actors_buffer(struct power_allocator_params *params,
/* There might be no cooling devices yet. */
if (!num_actors) {
ret = -EINVAL;
ret = 0;
goto clean_state;
}
@ -679,11 +679,6 @@ static int power_allocator_bind(struct thermal_zone_device *tz)
return -ENOMEM;
get_governor_trips(tz, params);
if (!params->trip_max) {
dev_warn(&tz->device, "power_allocator: missing trip_max\n");
kfree(params);
return -EINVAL;
}
ret = check_power_actors(tz, params);
if (ret < 0) {
@ -714,9 +709,10 @@ static int power_allocator_bind(struct thermal_zone_device *tz)
else
params->sustainable_power = tz->tzp->sustainable_power;
estimate_pid_constants(tz, tz->tzp->sustainable_power,
params->trip_switch_on,
params->trip_max->temperature);
if (params->trip_max)
estimate_pid_constants(tz, tz->tzp->sustainable_power,
params->trip_switch_on,
params->trip_max->temperature);
reset_pid_controller(params);