Skip to content

Commit 4526c58

Browse files
committed
thermal: gov_bang_bang: Clean up thermal_zone_trip_update()
Do the following cleanups in thermal_zone_trip_update(): * Drop the useless "zero hysteresis" message. * Eliminate the trip_index local variable that is redundant. * Drop 2 comments that are not useful. * Downgrade a diagnostic message from pr_warn() to pr_debug(). * Use consistent field formatting in diagnostic messages. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Lukasz Luba <[email protected]> Acked-by: Daniel Lezcano <[email protected]>
1 parent 530c932 commit 4526c58

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

drivers/thermal/gov_bang_bang.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,23 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz,
1717
const struct thermal_trip *trip,
1818
bool crossed_up)
1919
{
20-
int trip_index = thermal_zone_trip_id(tz, trip);
2120
struct thermal_instance *instance;
2221

23-
if (!trip->hysteresis)
24-
dev_info_once(&tz->device,
25-
"Zero hysteresis value for thermal zone %s\n", tz->type);
26-
2722
dev_dbg(&tz->device, "Trip%d[temp=%d]:temp=%d:hyst=%d\n",
28-
trip_index, trip->temperature, tz->temperature,
29-
trip->hysteresis);
23+
thermal_zone_trip_id(tz, trip), trip->temperature,
24+
tz->temperature, trip->hysteresis);
3025

3126
list_for_each_entry(instance, &tz->thermal_instances, tz_node) {
3227
if (instance->trip != trip)
3328
continue;
3429

35-
/* in case fan is in initial state, switch the fan off */
3630
if (instance->target == THERMAL_NO_TARGET)
3731
instance->target = 0;
3832

39-
/* in case fan is neither on nor off set the fan to active */
4033
if (instance->target != 0 && instance->target != 1) {
41-
pr_warn("Thermal instance %s controlled by bang-bang has unexpected state: %ld\n",
42-
instance->name, instance->target);
34+
pr_debug("Unexpected state %ld of thermal instance %s in bang-bang\n",
35+
instance->target, instance->name);
36+
4337
instance->target = 1;
4438
}
4539

@@ -52,8 +46,7 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz,
5246
else if (instance->target == 1 && !crossed_up)
5347
instance->target = 0;
5448

55-
dev_dbg(&instance->cdev->device, "target=%d\n",
56-
(int)instance->target);
49+
dev_dbg(&instance->cdev->device, "target=%ld\n", instance->target);
5750

5851
mutex_lock(&instance->cdev->lock);
5952
instance->cdev->updated = false; /* cdev needs update */

0 commit comments

Comments
 (0)