Skip to content

Commit c8f46f4

Browse files
committed
ACPI: thermal: Drop critical_valid and hot_valid trip flags
The critical_valid and hot_valid flags in struct acpi_thermal_trips are only used during initialization and they are only false if the corresponding trip temperatures are equal to THERMAL_TEMP_INVALID, so drop them and use THERMAL_TEMP_INVALID checks instead of them where applicable. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Daniel Lezcano <[email protected]>
1 parent d5ea889 commit c8f46f4

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

drivers/acpi/thermal.c

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,6 @@ struct acpi_thermal_active {
100100
struct acpi_thermal_trips {
101101
struct acpi_thermal_passive passive;
102102
struct acpi_thermal_active active[ACPI_THERMAL_MAX_ACTIVE];
103-
bool critical_valid;
104-
bool hot_valid;
105103
};
106104

107105
struct acpi_thermal {
@@ -355,31 +353,26 @@ static long acpi_thermal_get_critical_trip(struct acpi_thermal *tz)
355353
}
356354
if (crt == -1) {
357355
acpi_handle_debug(tz->device->handle, "Critical threshold disabled\n");
358-
goto fail;
356+
return THERMAL_TEMP_INVALID;
359357
}
360358

361359
status = acpi_evaluate_integer(tz->device->handle, "_CRT", NULL, &tmp);
362360
if (ACPI_FAILURE(status)) {
363361
acpi_handle_debug(tz->device->handle, "No critical threshold\n");
364-
goto fail;
362+
return THERMAL_TEMP_INVALID;
365363
}
366364
if (tmp <= 2732) {
367365
/*
368366
* Below zero (Celsius) values clearly aren't right for sure,
369367
* so discard them as invalid.
370368
*/
371369
pr_info(FW_BUG "Invalid critical threshold (%llu)\n", tmp);
372-
goto fail;
370+
return THERMAL_TEMP_INVALID;
373371
}
374372

375373
set:
376-
tz->trips.critical_valid = true;
377374
acpi_handle_debug(tz->device->handle, "Critical threshold [%llu]\n", tmp);
378375
return tmp;
379-
380-
fail:
381-
tz->trips.critical_valid = false;
382-
return THERMAL_TEMP_INVALID;
383376
}
384377

385378
static long acpi_thermal_get_hot_trip(struct acpi_thermal *tz)
@@ -389,12 +382,10 @@ static long acpi_thermal_get_hot_trip(struct acpi_thermal *tz)
389382

390383
status = acpi_evaluate_integer(tz->device->handle, "_HOT", NULL, &tmp);
391384
if (ACPI_FAILURE(status)) {
392-
tz->trips.hot_valid = false;
393385
acpi_handle_debug(tz->device->handle, "No hot threshold\n");
394386
return THERMAL_TEMP_INVALID;
395387
}
396388

397-
tz->trips.hot_valid = true;
398389
acpi_handle_debug(tz->device->handle, "Hot threshold [%llu]\n", tmp);
399390
return tmp;
400391
}
@@ -792,7 +783,7 @@ static void acpi_thermal_aml_dependency_fix(struct acpi_thermal *tz)
792783
*/
793784
static void acpi_thermal_guess_offset(struct acpi_thermal *tz, long crit_temp)
794785
{
795-
if (tz->trips.critical_valid && crit_temp % 5 == 1)
786+
if (crit_temp != THERMAL_TEMP_INVALID && crit_temp % 5 == 1)
796787
tz->kelvin_offset = 273100;
797788
else
798789
tz->kelvin_offset = 273200;
@@ -853,11 +844,11 @@ static int acpi_thermal_add(struct acpi_device *device)
853844
trip_count = acpi_thermal_get_trip_points(tz);
854845

855846
crit_temp = acpi_thermal_get_critical_trip(tz);
856-
if (tz->trips.critical_valid)
847+
if (crit_temp != THERMAL_TEMP_INVALID)
857848
trip_count++;
858849

859850
hot_temp = acpi_thermal_get_hot_trip(tz);
860-
if (tz->trips.hot_valid)
851+
if (hot_temp != THERMAL_TEMP_INVALID)
861852
trip_count++;
862853

863854
if (!trip_count) {
@@ -891,13 +882,13 @@ static int acpi_thermal_add(struct acpi_device *device)
891882

892883
tz->trip_table = trip;
893884

894-
if (tz->trips.critical_valid) {
885+
if (crit_temp != THERMAL_TEMP_INVALID) {
895886
trip->type = THERMAL_TRIP_CRITICAL;
896887
trip->temperature = acpi_thermal_temp(tz, crit_temp);
897888
trip++;
898889
}
899890

900-
if (tz->trips.hot_valid) {
891+
if (hot_temp != THERMAL_TEMP_INVALID) {
901892
trip->type = THERMAL_TRIP_HOT;
902893
trip->temperature = acpi_thermal_temp(tz, hot_temp);
903894
trip++;

0 commit comments

Comments
 (0)