thermal/debugfs: Pass cooling device state to thermal_debug_cdev_add()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 25 Apr 2024 12:24:20 +0000 (14:24 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 26 Apr 2024 13:01:56 +0000 (15:01 +0200)
commit31a0fa0019b022024cc082ae292951a596b06f8c
tree1e141ee56be473baeb02c9ae0d1146ae5f835e68
parentf4ae18fcb652c6cccc834ded525ac37f91d5cdb1
thermal/debugfs: Pass cooling device state to thermal_debug_cdev_add()

If cdev_dt_seq_show() runs before the first state transition of a cooling
device, it will not print any state residency information for it, even
though it might be reasonably expected to print residency information for
the initial state of the cooling device.

For this reason, rearrange the code to get the initial state of a cooling
device at the registration time and pass it to thermal_debug_cdev_add(),
so that the latter can create a duration record for that state which will
allow cdev_dt_seq_show() to print its residency information.

Fixes: 755113d76786 ("thermal/debugfs: Add thermal cooling device debugfs information")
Reported-by: Lukasz Luba <lukasz.luba@arm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Tested-by: Lukasz Luba <lukasz.luba@arm.com>
drivers/thermal/thermal_core.c
drivers/thermal/thermal_debugfs.c
drivers/thermal/thermal_debugfs.h