struct acpi_thermal_trip {
unsigned long temperature;
- bool valid;
};
struct acpi_thermal_passive {
tz->kelvin_offset);
}
-static void update_acpi_thermal_trip_temp(struct acpi_thermal_trip *acpi_trip,
- int temp)
+static bool acpi_thermal_trip_valid(struct acpi_thermal_trip *acpi_trip)
{
- acpi_trip->valid = temp != THERMAL_TEMP_INVALID;
- acpi_trip->temperature = temp;
+ return acpi_trip->temperature != THERMAL_TEMP_INVALID;
}
static long get_passive_temp(struct acpi_thermal *tz)
{
struct acpi_thermal_trip *acpi_trip = &tz->trips.passive.trip;
- if (!acpi_trip->valid || psv > 0)
+ if (!acpi_thermal_trip_valid(acpi_trip) || psv > 0)
return;
- update_acpi_thermal_trip_temp(acpi_trip, get_passive_temp(tz));
- if (!acpi_trip->valid)
+ acpi_trip->temperature = get_passive_temp(tz);
+ if (!acpi_thermal_trip_valid(acpi_trip))
ACPI_THERMAL_TRIPS_EXCEPTION(tz, "state");
}
{
struct acpi_thermal_trip *acpi_trip = &tz->trips.passive.trip;
- if (!acpi_trip->valid)
+ if (!acpi_thermal_trip_valid(acpi_trip))
return;
if (update_passive_devices(tz, true))
return;
- update_acpi_thermal_trip_temp(acpi_trip, THERMAL_TEMP_INVALID);
+ acpi_trip->temperature = THERMAL_TEMP_INVALID;
ACPI_THERMAL_TRIPS_EXCEPTION(tz, "state");
}
{
struct acpi_thermal_trip *acpi_trip = &tz->trips.active[index].trip;
- if (!acpi_trip->valid)
+ if (!acpi_thermal_trip_valid(acpi_trip))
return;
- update_acpi_thermal_trip_temp(acpi_trip, get_active_temp(tz, index));
- if (!acpi_trip->valid)
+ acpi_trip->temperature = get_active_temp(tz, index);
+ if (!acpi_thermal_trip_valid(acpi_trip))
ACPI_THERMAL_TRIPS_EXCEPTION(tz, "state");
}
{
struct acpi_thermal_trip *acpi_trip = &tz->trips.active[index].trip;
- if (!acpi_trip->valid)
+ if (!acpi_thermal_trip_valid(acpi_trip))
return;
if (update_active_devices(tz, index, true))
return;
- update_acpi_thermal_trip_temp(acpi_trip, THERMAL_TEMP_INVALID);
+ acpi_trip->temperature = THERMAL_TEMP_INVALID;
ACPI_THERMAL_TRIPS_EXCEPTION(tz, "state");
}
if (!acpi_trip)
return 0;
- if (acpi_trip->valid)
+ if (acpi_thermal_trip_valid(acpi_trip))
trip->temperature = acpi_thermal_temp(tz, acpi_trip->temperature);
else
trip->temperature = THERMAL_TEMP_INVALID;
if (!update_passive_devices(tz, false))
goto fail;
- update_acpi_thermal_trip_temp(&tz->trips.passive.trip, temp);
+ tz->trips.passive.trip.temperature = temp;
return true;
fail:
- update_acpi_thermal_trip_temp(&tz->trips.passive.trip, THERMAL_TEMP_INVALID);
+ tz->trips.passive.trip.temperature = THERMAL_TEMP_INVALID;
return false;
}
if (!update_active_devices(tz, index, false))
goto fail;
- update_acpi_thermal_trip_temp(&tz->trips.active[index].trip, temp);
+ tz->trips.active[index].trip.temperature = temp;
return true;
fail:
- update_acpi_thermal_trip_temp(&tz->trips.active[index].trip, THERMAL_TEMP_INVALID);
+ tz->trips.active[index].trip.temperature = THERMAL_TEMP_INVALID;
return false;
}
return -EINVAL;
acpi_trip = trip->priv;
- if (!acpi_trip || !acpi_trip->valid)
+ if (!acpi_trip || !acpi_thermal_trip_valid(acpi_trip))
return -EINVAL;
switch (trip->type) {
if (tz->trips.hot_valid)
trip++;
- if (tz->trips.passive.trip.valid) {
+ if (acpi_thermal_trip_valid(&tz->trips.passive.trip)) {
trip++;
for (i = 0; i < tz->trips.passive.devices.count; i++) {
handle = tz->trips.passive.devices.handles[i];
}
for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) {
- if (!tz->trips.active[i].trip.valid)
+ if (!acpi_thermal_trip_valid(&tz->trips.active[i].trip))
break;
trip++;
}
acpi_trip = &tz->trips.passive.trip;
- if (acpi_trip->valid) {
+ if (acpi_thermal_trip_valid(acpi_trip)) {
passive_delay = tz->trips.passive.tsp * 100;
trip->type = THERMAL_TRIP_PASSIVE;
for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) {
acpi_trip = &tz->trips.active[i].trip;
- if (!acpi_trip->valid)
+ if (!acpi_thermal_trip_valid(acpi_trip))
break;
trip->type = THERMAL_TRIP_ACTIVE;
return -EINVAL;
for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) {
- if (!tz->trips.active[i].trip.valid)
+ if (!acpi_thermal_trip_valid(&tz->trips.active[i].trip))
break;
for (j = 0; j < tz->trips.active[i].devices.count; j++) {