[PATCH v1 1/2] thermal: testing: zone: Use debugfs_create_file()
From: Rafael J. Wysocki
Date: Wed Jun 17 2026 - 12:27:54 EST
From: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
Use debugfs_create_file() for creating debugfs files related to thermal
zone templates so that their file operations are properly synchronized
with thermal zone template removal.
Fixes: f6a034f2df42 ("thermal: Introduce a debugfs-based testing facility")
Link: https://sashiko.dev/#/patchset/20260605185212.2491144-1-sam.moelius%40trailofbits.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
---
drivers/thermal/testing/zone.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
--- a/drivers/thermal/testing/zone.c
+++ b/drivers/thermal/testing/zone.c
@@ -171,11 +171,11 @@ static void tt_add_tz_work_fn(struct wor
return;
}
- debugfs_create_file_unsafe("temp", 0600, tt_zone->d_tt_zone, tt_zone,
- &tt_zone_tz_temp_attr);
+ debugfs_create_file("temp", 0600, tt_zone->d_tt_zone, tt_zone,
+ &tt_zone_tz_temp_attr);
- debugfs_create_file_unsafe("init_temp", 0600, tt_zone->d_tt_zone,
- &tt_zone->temp, &tt_int_attr);
+ debugfs_create_file("init_temp", 0600, tt_zone->d_tt_zone,
+ &tt_zone->temp, &tt_int_attr);
guard(mutex)(&tt_thermal_zones_lock);
@@ -315,12 +315,12 @@ static void tt_zone_add_trip_work_fn(str
kfree(tt_work);
snprintf(d_name, TT_MAX_FILE_NAME_LENGTH, "trip_%d_temp", tt_trip->id);
- debugfs_create_file_unsafe(d_name, 0600, tt_zone->d_tt_zone,
- &tt_trip->trip.temperature, &tt_int_attr);
+ debugfs_create_file(d_name, 0600, tt_zone->d_tt_zone,
+ &tt_trip->trip.temperature, &tt_int_attr);
snprintf(d_name, TT_MAX_FILE_NAME_LENGTH, "trip_%d_hyst", tt_trip->id);
- debugfs_create_file_unsafe(d_name, 0600, tt_zone->d_tt_zone,
- &tt_trip->trip.hysteresis, &tt_unsigned_int_attr);
+ debugfs_create_file(d_name, 0600, tt_zone->d_tt_zone,
+ &tt_trip->trip.hysteresis, &tt_unsigned_int_attr);
tt_put_tt_zone(tt_zone);
}