summaryrefslogtreecommitdiff
path: root/drivers/thermal/thermal_debugfs.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-04-17 18:51:29 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-04-24 21:43:11 +0300
commita6258fde8de34b2bfd7e1d4e55df261426e49071 (patch)
tree9876838453ebbf4c08397051d75657e47bdc2aaf /drivers/thermal/thermal_debugfs.c
parent8dff6e8438351c627289fd06893c36f3bd9666e5 (diff)
downloadlinux-a6258fde8de34b2bfd7e1d4e55df261426e49071.tar.xz
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 <rafael.j.wysocki@intel.com> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Diffstat (limited to 'drivers/thermal/thermal_debugfs.c')
-rw-r--r--drivers/thermal/thermal_debugfs.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/thermal/thermal_debugfs.c b/drivers/thermal/thermal_debugfs.c
index 357cd5f2de64..d9f33df2ad2d 100644
--- a/drivers/thermal/thermal_debugfs.c
+++ b/drivers/thermal/thermal_debugfs.c
@@ -754,6 +754,11 @@ static int tze_seq_show(struct seq_file *s, void *v)
for_each_trip_desc(tz, td) {
const struct thermal_trip *trip = &td->trip;
+ struct trip_stats *trip_stats;
+
+ /* Skip invalid trips. */
+ if (trip->temperature == THERMAL_TEMP_INVALID)
+ continue;
/*
* There is no possible mitigation happening at the
@@ -763,6 +768,13 @@ static int tze_seq_show(struct seq_file *s, void *v)
if (trip->type == THERMAL_TRIP_CRITICAL)
continue;
+ trip_id = thermal_zone_trip_id(tz, trip);
+ trip_stats = &tze->trip_stats[trip_id];
+
+ /* Skip trips without any stats. */
+ if (trip_stats->min > trip_stats->max)
+ continue;
+
if (trip->type == THERMAL_TRIP_PASSIVE)
type = "passive";
else if (trip->type == THERMAL_TRIP_ACTIVE)
@@ -770,17 +782,15 @@ static int tze_seq_show(struct seq_file *s, void *v)
else
type = "hot";
- trip_id = thermal_zone_trip_id(tz, trip);
-
seq_printf(s, "| %*d | %*s | %*d | %*d | %*lld | %*d | %*d | %*d |\n",
4 , trip_id,
8, type,
9, trip->temperature,
9, trip->hysteresis,
- 10, ktime_to_ms(tze->trip_stats[trip_id].duration),
- 9, tze->trip_stats[trip_id].avg,
- 9, tze->trip_stats[trip_id].min,
- 9, tze->trip_stats[trip_id].max);
+ 10, ktime_to_ms(trip_stats->duration),
+ 9, trip_stats->avg,
+ 9, trip_stats->min,
+ 9, trip_stats->max);
}
return 0;