Skip to content

Commit f4ae18f

Browse files
committed
thermal/debugfs: Create records for cdev states as they get used
Because thermal_debug_cdev_state_update() only creates a duration record for the old state of a cooling device, if its new state is used for the first time, there will be no record for it and cdev_dt_seq_show() will not print the duration information for it even though it contains code to compute the duration value in that case. Address this by making thermal_debug_cdev_state_update() create a duration record for the new state if there is none. Fixes: 755113d ("thermal/debugfs: Add thermal cooling device debugfs information") Reported-by: Lukasz Luba <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Lukasz Luba <[email protected]> Tested-by: Lukasz Luba <[email protected]>
1 parent 8c882f1 commit f4ae18f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/thermal/thermal_debugfs.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,14 @@ void thermal_debug_cdev_state_update(const struct thermal_cooling_device *cdev,
435435
}
436436

437437
cdev_dbg->current_state = new_state;
438+
439+
/*
440+
* Create a record for the new state if it is not there, so its
441+
* duration will be printed by cdev_dt_seq_show() as expected if it
442+
* runs before the next state transition.
443+
*/
444+
thermal_debugfs_cdev_record_get(thermal_dbg, cdev_dbg->durations, new_state);
445+
438446
transition = (old_state << 16) | new_state;
439447

440448
/*

0 commit comments

Comments
 (0)