]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
thermal/debugfs: Adjust check for trips without statistics in tze_seq_show()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 28 May 2024 14:57:13 +0000 (16:57 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 11 Jun 2024 19:04:21 +0000 (21:04 +0200)
Initialize the trip_temp field in struct trip_stats to
THERMAL_TEMP_INVALID and adjust the check for trips without
statistics in tze_seq_show() to look at that field instead of
comparing min and max.

This will mostly be useful to simplify subsequent changes.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
drivers/thermal/thermal_debugfs.c

index ee9fc627ec81445e08f03827be862b0abc9b2f4e..5f9e5e9d403cde1bcafe2e6d1c59f8bae745dbed 100644 (file)
@@ -563,6 +563,7 @@ static struct tz_episode *thermal_debugfs_tz_event_alloc(struct thermal_zone_dev
        tze->duration = KTIME_MIN;
 
        for (i = 0; i < tz->num_trips; i++) {
+               tze->trip_stats[i].trip_temp = THERMAL_TEMP_INVALID;
                tze->trip_stats[i].min = INT_MAX;
                tze->trip_stats[i].max = INT_MIN;
        }
@@ -818,7 +819,7 @@ static int tze_seq_show(struct seq_file *s, void *v)
                trip_stats = &tze->trip_stats[trip_id];
 
                /* Skip trips without any stats. */
-               if (trip_stats->min > trip_stats->max)
+               if (trip_stats->trip_temp == THERMAL_TEMP_INVALID)
                        continue;
 
                if (trip->type == THERMAL_TRIP_PASSIVE)