Skip to content

Commit a6258fd

Browse files
committed
thermal/debugfs: Make tze_seq_show() skip invalid trips and trips with no stats
Currently, tze_seq_show() output includes all of the trips in the zone except for critical ones, including invalid trips and trips with no stats which is confusing. Make it skip the trips for which there is not mitigation information. Signed-off-by: Rafael J. Wysocki <[email protected]> Acked-by: Daniel Lezcano <[email protected]>
1 parent 8dff6e8 commit a6258fd

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

drivers/thermal/thermal_debugfs.c

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,11 @@ static int tze_seq_show(struct seq_file *s, void *v)
754754

755755
for_each_trip_desc(tz, td) {
756756
const struct thermal_trip *trip = &td->trip;
757+
struct trip_stats *trip_stats;
758+
759+
/* Skip invalid trips. */
760+
if (trip->temperature == THERMAL_TEMP_INVALID)
761+
continue;
757762

758763
/*
759764
* There is no possible mitigation happening at the
@@ -763,24 +768,29 @@ static int tze_seq_show(struct seq_file *s, void *v)
763768
if (trip->type == THERMAL_TRIP_CRITICAL)
764769
continue;
765770

771+
trip_id = thermal_zone_trip_id(tz, trip);
772+
trip_stats = &tze->trip_stats[trip_id];
773+
774+
/* Skip trips without any stats. */
775+
if (trip_stats->min > trip_stats->max)
776+
continue;
777+
766778
if (trip->type == THERMAL_TRIP_PASSIVE)
767779
type = "passive";
768780
else if (trip->type == THERMAL_TRIP_ACTIVE)
769781
type = "active";
770782
else
771783
type = "hot";
772784

773-
trip_id = thermal_zone_trip_id(tz, trip);
774-
775785
seq_printf(s, "| %*d | %*s | %*d | %*d | %*lld | %*d | %*d | %*d |\n",
776786
4 , trip_id,
777787
8, type,
778788
9, trip->temperature,
779789
9, trip->hysteresis,
780-
10, ktime_to_ms(tze->trip_stats[trip_id].duration),
781-
9, tze->trip_stats[trip_id].avg,
782-
9, tze->trip_stats[trip_id].min,
783-
9, tze->trip_stats[trip_id].max);
790+
10, ktime_to_ms(trip_stats->duration),
791+
9, trip_stats->avg,
792+
9, trip_stats->min,
793+
9, trip_stats->max);
784794
}
785795

786796
return 0;

0 commit comments

Comments
 (0)