Skip to content

Commit 8a4ff54

Browse files
Steve-Techrafaeljw
authored andcommitted
ACPI: thermal: Register thermal zones without valid trip points
Some laptops where the thermal control is handled by the EC may provide trip points that fail the kernels new validation, but still have working temperature sensors. An example of this is the Framework 13 AMD. This patch allows the thermal zone to still be registered without trip points if the trip points fail validation, allowing the temperature sensor to be viewed and used by the user. Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218586 Fixes: 9c86472 ("ACPI: thermal: Use library functions to obtain trip point temperature values") Signed-off-by: Stephen Horvath <[email protected]> [ rjw: Subject edits, remove redundant braces ] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 39cd87c commit 8a4ff54

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

drivers/acpi/thermal.c

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -662,14 +662,15 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz,
662662
{
663663
int result;
664664

665-
tz->thermal_zone = thermal_zone_device_register_with_trips("acpitz",
666-
trip_table,
667-
trip_count,
668-
tz,
669-
&acpi_thermal_zone_ops,
670-
NULL,
671-
passive_delay,
672-
tz->polling_frequency * 100);
665+
if (trip_count)
666+
tz->thermal_zone = thermal_zone_device_register_with_trips(
667+
"acpitz", trip_table, trip_count, tz,
668+
&acpi_thermal_zone_ops, NULL, passive_delay,
669+
tz->polling_frequency * 100);
670+
else
671+
tz->thermal_zone = thermal_tripless_zone_device_register(
672+
"acpitz", tz, &acpi_thermal_zone_ops, NULL);
673+
673674
if (IS_ERR(tz->thermal_zone))
674675
return PTR_ERR(tz->thermal_zone);
675676

@@ -901,11 +902,8 @@ static int acpi_thermal_add(struct acpi_device *device)
901902
trip++;
902903
}
903904

904-
if (trip == trip_table) {
905+
if (trip == trip_table)
905906
pr_warn(FW_BUG "No valid trip points!\n");
906-
result = -ENODEV;
907-
goto free_memory;
908-
}
909907

910908
result = acpi_thermal_register_thermal_zone(tz, trip_table,
911909
trip - trip_table,

0 commit comments

Comments
 (0)