Commit c8f46f43 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

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: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
parent d5ea8892
...@@ -100,8 +100,6 @@ struct acpi_thermal_active { ...@@ -100,8 +100,6 @@ struct acpi_thermal_active {
struct acpi_thermal_trips { struct acpi_thermal_trips {
struct acpi_thermal_passive passive; struct acpi_thermal_passive passive;
struct acpi_thermal_active active[ACPI_THERMAL_MAX_ACTIVE]; struct acpi_thermal_active active[ACPI_THERMAL_MAX_ACTIVE];
bool critical_valid;
bool hot_valid;
}; };
struct acpi_thermal { struct acpi_thermal {
...@@ -355,13 +353,13 @@ static long acpi_thermal_get_critical_trip(struct acpi_thermal *tz) ...@@ -355,13 +353,13 @@ static long acpi_thermal_get_critical_trip(struct acpi_thermal *tz)
} }
if (crt == -1) { if (crt == -1) {
acpi_handle_debug(tz->device->handle, "Critical threshold disabled\n"); acpi_handle_debug(tz->device->handle, "Critical threshold disabled\n");
goto fail; return THERMAL_TEMP_INVALID;
} }
status = acpi_evaluate_integer(tz->device->handle, "_CRT", NULL, &tmp); status = acpi_evaluate_integer(tz->device->handle, "_CRT", NULL, &tmp);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
acpi_handle_debug(tz->device->handle, "No critical threshold\n"); acpi_handle_debug(tz->device->handle, "No critical threshold\n");
goto fail; return THERMAL_TEMP_INVALID;
} }
if (tmp <= 2732) { if (tmp <= 2732) {
/* /*
...@@ -369,17 +367,12 @@ static long acpi_thermal_get_critical_trip(struct acpi_thermal *tz) ...@@ -369,17 +367,12 @@ static long acpi_thermal_get_critical_trip(struct acpi_thermal *tz)
* so discard them as invalid. * so discard them as invalid.
*/ */
pr_info(FW_BUG "Invalid critical threshold (%llu)\n", tmp); pr_info(FW_BUG "Invalid critical threshold (%llu)\n", tmp);
goto fail; return THERMAL_TEMP_INVALID;
} }
set: set:
tz->trips.critical_valid = true;
acpi_handle_debug(tz->device->handle, "Critical threshold [%llu]\n", tmp); acpi_handle_debug(tz->device->handle, "Critical threshold [%llu]\n", tmp);
return tmp; return tmp;
fail:
tz->trips.critical_valid = false;
return THERMAL_TEMP_INVALID;
} }
static long acpi_thermal_get_hot_trip(struct acpi_thermal *tz) 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) ...@@ -389,12 +382,10 @@ static long acpi_thermal_get_hot_trip(struct acpi_thermal *tz)
status = acpi_evaluate_integer(tz->device->handle, "_HOT", NULL, &tmp); status = acpi_evaluate_integer(tz->device->handle, "_HOT", NULL, &tmp);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
tz->trips.hot_valid = false;
acpi_handle_debug(tz->device->handle, "No hot threshold\n"); acpi_handle_debug(tz->device->handle, "No hot threshold\n");
return THERMAL_TEMP_INVALID; return THERMAL_TEMP_INVALID;
} }
tz->trips.hot_valid = true;
acpi_handle_debug(tz->device->handle, "Hot threshold [%llu]\n", tmp); acpi_handle_debug(tz->device->handle, "Hot threshold [%llu]\n", tmp);
return tmp; return tmp;
} }
...@@ -792,7 +783,7 @@ static void acpi_thermal_aml_dependency_fix(struct acpi_thermal *tz) ...@@ -792,7 +783,7 @@ static void acpi_thermal_aml_dependency_fix(struct acpi_thermal *tz)
*/ */
static void acpi_thermal_guess_offset(struct acpi_thermal *tz, long crit_temp) static void acpi_thermal_guess_offset(struct acpi_thermal *tz, long crit_temp)
{ {
if (tz->trips.critical_valid && crit_temp % 5 == 1) if (crit_temp != THERMAL_TEMP_INVALID && crit_temp % 5 == 1)
tz->kelvin_offset = 273100; tz->kelvin_offset = 273100;
else else
tz->kelvin_offset = 273200; tz->kelvin_offset = 273200;
...@@ -853,11 +844,11 @@ static int acpi_thermal_add(struct acpi_device *device) ...@@ -853,11 +844,11 @@ static int acpi_thermal_add(struct acpi_device *device)
trip_count = acpi_thermal_get_trip_points(tz); trip_count = acpi_thermal_get_trip_points(tz);
crit_temp = acpi_thermal_get_critical_trip(tz); crit_temp = acpi_thermal_get_critical_trip(tz);
if (tz->trips.critical_valid) if (crit_temp != THERMAL_TEMP_INVALID)
trip_count++; trip_count++;
hot_temp = acpi_thermal_get_hot_trip(tz); hot_temp = acpi_thermal_get_hot_trip(tz);
if (tz->trips.hot_valid) if (hot_temp != THERMAL_TEMP_INVALID)
trip_count++; trip_count++;
if (!trip_count) { if (!trip_count) {
...@@ -891,13 +882,13 @@ static int acpi_thermal_add(struct acpi_device *device) ...@@ -891,13 +882,13 @@ static int acpi_thermal_add(struct acpi_device *device)
tz->trip_table = trip; tz->trip_table = trip;
if (tz->trips.critical_valid) { if (crit_temp != THERMAL_TEMP_INVALID) {
trip->type = THERMAL_TRIP_CRITICAL; trip->type = THERMAL_TRIP_CRITICAL;
trip->temperature = acpi_thermal_temp(tz, crit_temp); trip->temperature = acpi_thermal_temp(tz, crit_temp);
trip++; trip++;
} }
if (tz->trips.hot_valid) { if (hot_temp != THERMAL_TEMP_INVALID) {
trip->type = THERMAL_TRIP_HOT; trip->type = THERMAL_TRIP_HOT;
trip->temperature = acpi_thermal_temp(tz, hot_temp); trip->temperature = acpi_thermal_temp(tz, hot_temp);
trip++; trip++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment