ACPI: thermal: Drop valid flag from struct acpi_thermal_trip
Notice that the valid flag in struct acpi_thermal_trip is in fact redundant, because the temperature field of invalid trips is always equal to THERMAL_TEMP_INVALID, so drop it from there and adjust the code accordingly. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
This commit is contained in:
parent
4175a24f01
commit
058f5e407d
@ -81,7 +81,6 @@ static struct workqueue_struct *acpi_thermal_pm_queue;
|
|||||||
|
|
||||||
struct acpi_thermal_trip {
|
struct acpi_thermal_trip {
|
||||||
unsigned long temperature;
|
unsigned long temperature;
|
||||||
bool valid;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct acpi_thermal_passive {
|
struct acpi_thermal_passive {
|
||||||
@ -175,11 +174,9 @@ static int acpi_thermal_temp(struct acpi_thermal *tz, int temp_deci_k)
|
|||||||
tz->kelvin_offset);
|
tz->kelvin_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void update_acpi_thermal_trip_temp(struct acpi_thermal_trip *acpi_trip,
|
static bool acpi_thermal_trip_valid(struct acpi_thermal_trip *acpi_trip)
|
||||||
int temp)
|
|
||||||
{
|
{
|
||||||
acpi_trip->valid = temp != THERMAL_TEMP_INVALID;
|
return acpi_trip->temperature != THERMAL_TEMP_INVALID;
|
||||||
acpi_trip->temperature = temp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static long get_passive_temp(struct acpi_thermal *tz)
|
static long get_passive_temp(struct acpi_thermal *tz)
|
||||||
@ -198,11 +195,11 @@ static void acpi_thermal_update_passive_trip(struct acpi_thermal *tz)
|
|||||||
{
|
{
|
||||||
struct acpi_thermal_trip *acpi_trip = &tz->trips.passive.trip;
|
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;
|
return;
|
||||||
|
|
||||||
update_acpi_thermal_trip_temp(acpi_trip, get_passive_temp(tz));
|
acpi_trip->temperature = get_passive_temp(tz);
|
||||||
if (!acpi_trip->valid)
|
if (!acpi_thermal_trip_valid(acpi_trip))
|
||||||
ACPI_THERMAL_TRIPS_EXCEPTION(tz, "state");
|
ACPI_THERMAL_TRIPS_EXCEPTION(tz, "state");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,13 +228,13 @@ static void acpi_thermal_update_passive_devices(struct acpi_thermal *tz)
|
|||||||
{
|
{
|
||||||
struct acpi_thermal_trip *acpi_trip = &tz->trips.passive.trip;
|
struct acpi_thermal_trip *acpi_trip = &tz->trips.passive.trip;
|
||||||
|
|
||||||
if (!acpi_trip->valid)
|
if (!acpi_thermal_trip_valid(acpi_trip))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (update_passive_devices(tz, true))
|
if (update_passive_devices(tz, true))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
update_acpi_thermal_trip_temp(acpi_trip, THERMAL_TEMP_INVALID);
|
acpi_trip->temperature = THERMAL_TEMP_INVALID;
|
||||||
ACPI_THERMAL_TRIPS_EXCEPTION(tz, "state");
|
ACPI_THERMAL_TRIPS_EXCEPTION(tz, "state");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,11 +265,11 @@ static void acpi_thermal_update_active_trip(struct acpi_thermal *tz, int index)
|
|||||||
{
|
{
|
||||||
struct acpi_thermal_trip *acpi_trip = &tz->trips.active[index].trip;
|
struct acpi_thermal_trip *acpi_trip = &tz->trips.active[index].trip;
|
||||||
|
|
||||||
if (!acpi_trip->valid)
|
if (!acpi_thermal_trip_valid(acpi_trip))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
update_acpi_thermal_trip_temp(acpi_trip, get_active_temp(tz, index));
|
acpi_trip->temperature = get_active_temp(tz, index);
|
||||||
if (!acpi_trip->valid)
|
if (!acpi_thermal_trip_valid(acpi_trip))
|
||||||
ACPI_THERMAL_TRIPS_EXCEPTION(tz, "state");
|
ACPI_THERMAL_TRIPS_EXCEPTION(tz, "state");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,13 +300,13 @@ static void acpi_thermal_update_active_devices(struct acpi_thermal *tz, int inde
|
|||||||
{
|
{
|
||||||
struct acpi_thermal_trip *acpi_trip = &tz->trips.active[index].trip;
|
struct acpi_thermal_trip *acpi_trip = &tz->trips.active[index].trip;
|
||||||
|
|
||||||
if (!acpi_trip->valid)
|
if (!acpi_thermal_trip_valid(acpi_trip))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (update_active_devices(tz, index, true))
|
if (update_active_devices(tz, index, true))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
update_acpi_thermal_trip_temp(acpi_trip, THERMAL_TEMP_INVALID);
|
acpi_trip->temperature = THERMAL_TEMP_INVALID;
|
||||||
ACPI_THERMAL_TRIPS_EXCEPTION(tz, "state");
|
ACPI_THERMAL_TRIPS_EXCEPTION(tz, "state");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,7 +318,7 @@ static int acpi_thermal_adjust_trip(struct thermal_trip *trip, void *data)
|
|||||||
if (!acpi_trip)
|
if (!acpi_trip)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (acpi_trip->valid)
|
if (acpi_thermal_trip_valid(acpi_trip))
|
||||||
trip->temperature = acpi_thermal_temp(tz, acpi_trip->temperature);
|
trip->temperature = acpi_thermal_temp(tz, acpi_trip->temperature);
|
||||||
else
|
else
|
||||||
trip->temperature = THERMAL_TEMP_INVALID;
|
trip->temperature = THERMAL_TEMP_INVALID;
|
||||||
@ -465,11 +462,11 @@ static bool acpi_thermal_init_passive_trip(struct acpi_thermal *tz)
|
|||||||
if (!update_passive_devices(tz, false))
|
if (!update_passive_devices(tz, false))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
update_acpi_thermal_trip_temp(&tz->trips.passive.trip, temp);
|
tz->trips.passive.trip.temperature = temp;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
update_acpi_thermal_trip_temp(&tz->trips.passive.trip, THERMAL_TEMP_INVALID);
|
tz->trips.passive.trip.temperature = THERMAL_TEMP_INVALID;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -487,11 +484,11 @@ static bool acpi_thermal_init_active_trip(struct acpi_thermal *tz, int index)
|
|||||||
if (!update_active_devices(tz, index, false))
|
if (!update_active_devices(tz, index, false))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
update_acpi_thermal_trip_temp(&tz->trips.active[index].trip, temp);
|
tz->trips.active[index].trip.temperature = temp;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
fail:
|
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 false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -545,7 +542,7 @@ static int thermal_get_trend(struct thermal_zone_device *thermal,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
acpi_trip = trip->priv;
|
acpi_trip = trip->priv;
|
||||||
if (!acpi_trip || !acpi_trip->valid)
|
if (!acpi_trip || !acpi_thermal_trip_valid(acpi_trip))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
switch (trip->type) {
|
switch (trip->type) {
|
||||||
@ -618,7 +615,7 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
|
|||||||
if (tz->trips.hot_valid)
|
if (tz->trips.hot_valid)
|
||||||
trip++;
|
trip++;
|
||||||
|
|
||||||
if (tz->trips.passive.trip.valid) {
|
if (acpi_thermal_trip_valid(&tz->trips.passive.trip)) {
|
||||||
trip++;
|
trip++;
|
||||||
for (i = 0; i < tz->trips.passive.devices.count; i++) {
|
for (i = 0; i < tz->trips.passive.devices.count; i++) {
|
||||||
handle = tz->trips.passive.devices.handles[i];
|
handle = tz->trips.passive.devices.handles[i];
|
||||||
@ -643,7 +640,7 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; 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;
|
break;
|
||||||
|
|
||||||
trip++;
|
trip++;
|
||||||
@ -949,7 +946,7 @@ static int acpi_thermal_add(struct acpi_device *device)
|
|||||||
}
|
}
|
||||||
|
|
||||||
acpi_trip = &tz->trips.passive.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;
|
passive_delay = tz->trips.passive.tsp * 100;
|
||||||
|
|
||||||
trip->type = THERMAL_TRIP_PASSIVE;
|
trip->type = THERMAL_TRIP_PASSIVE;
|
||||||
@ -961,7 +958,7 @@ static int acpi_thermal_add(struct acpi_device *device)
|
|||||||
for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) {
|
for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) {
|
||||||
acpi_trip = &tz->trips.active[i].trip;
|
acpi_trip = &tz->trips.active[i].trip;
|
||||||
|
|
||||||
if (!acpi_trip->valid)
|
if (!acpi_thermal_trip_valid(acpi_trip))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
trip->type = THERMAL_TRIP_ACTIVE;
|
trip->type = THERMAL_TRIP_ACTIVE;
|
||||||
@ -1038,7 +1035,7 @@ static int acpi_thermal_resume(struct device *dev)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; 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;
|
break;
|
||||||
|
|
||||||
for (j = 0; j < tz->trips.active[i].devices.count; j++) {
|
for (j = 0; j < tz->trips.active[i].devices.count; j++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user