aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2022-07-18 22:54:15 +0200
committerDaniel Lezcano <daniel.lezcano@linaro.org>2022-07-18 22:54:15 +0200
commit5290faeac4eef5414b32630865b5453f7b4a8524 (patch)
tree23e2205dd9b3e5e8b0ab60a71f14b9fd39164143
parent5a666b51aa5900961760acf63d8324993e1e8686 (diff)
downloadlinux-thermal/trip-crossed+debugfs.tar.gz
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
-rw-r--r--drivers/thermal/thermal_core.c2
-rw-r--r--drivers/thermal/thermal_debugfs.c10
2 files changed, 7 insertions, 5 deletions
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 614cbcecc2f23..3eea9c7f0d951 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -383,10 +383,12 @@ static void handle_thermal_trip_crossed(struct thermal_zone_device *tz, int inde
if (tz->last_temperature < trip_temp && tz->temperature >= trip_temp &&
index != tz->prev_index) {
thermal_notify_tz_trip_up(tz->id, trip, tz->temperature);
+ thermal_debugfs_handle_way_up(tz, trip);
tz->prev_index = index;
} else if (tz->last_temperature >= trip_low_temp && tz->temperature < trip_low_temp &&
index == tz->prev_index) {
thermal_notify_tz_trip_down(tz->id, trip, tz->temperature);
+ thermal_debugfs_handle_way_down(tz, trip);
tz->prev_index--;
}
}
diff --git a/drivers/thermal/thermal_debugfs.c b/drivers/thermal/thermal_debugfs.c
index aafdb36b2e228..c20ddfbbea6d5 100644
--- a/drivers/thermal/thermal_debugfs.c
+++ b/drivers/thermal/thermal_debugfs.c
@@ -379,13 +379,13 @@ static struct tz_events *thermal_debugfs_tz_event_alloc(struct thermal_zone_devi
if (!tze)
return NULL;
- tze->trip_stats = kzalloc(sizeof(struct trip_stats) * tz->trips, GFP_KERNEL);
+ tze->trip_stats = kzalloc(sizeof(struct trip_stats) * tz->num_trips, GFP_KERNEL);
if (!tze->trip_stats) {
kfree(tze);
return NULL;
}
- for (i = 0; i < tz->trips; i++) {
+ for (i = 0; i < tz->num_trips; i++) {
tze->trip_stats[i].min = INT_MAX;
tze->trip_stats[i].max = INT_MIN;
}
@@ -414,7 +414,7 @@ void thermal_debugfs_handle_way_up(struct thermal_zone_device *tz, int trip)
}
printk("%s: crossed the way up (%d m°C) %d->%d\n",
- tz->type, tz->temperature, tz->prev_trip, trip);
+ tz->type, tz->temperature, tz->prev_index, trip);
mutex_lock(&dfs->lock);
@@ -439,7 +439,7 @@ void thermal_debugfs_handle_way_down(struct thermal_zone_device *tz, int trip)
return;
printk("%s: crossed the way down (%d m°C) %d->%d\n",
- tz->type, tz->temperature, tz->prev_trip, trip);
+ tz->type, tz->temperature, tz->prev_index, trip);
mutex_lock(&dfs->lock);
@@ -461,7 +461,7 @@ void thermal_debugfs_update_temp(struct thermal_zone_device *tz)
{
struct thermal_debugfs *dfs = tz->debugfs;
struct tz_events *tze;
- int trip = tz->prev_trip;
+ int trip = tz->prev_index;
if (!dfs || trip < 0)
return;