diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2024-02-22 20:30:49 +0300 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2024-02-27 14:02:50 +0300 |
commit | 5340f7647294fa8ff8cf5a1bee326b2bd8340e27 (patch) | |
tree | c6bdc635eeac5800c2558b5597ebba1947299e66 /drivers/thermal/thermal_core.c | |
parent | da1983355ccefcfb3f8eb410fff82e250fa87e39 (diff) | |
download | linux-5340f7647294fa8ff8cf5a1bee326b2bd8340e27.tar.xz |
thermal: core: Add flags to struct thermal_trip
In order to allow thermal zone creators to specify the writability of
trip point temperature and hysteresis on a per-trip basis, add a flags
field to struct thermal_trip and define flags to represent the desired
trip properties.
Also make thermal_zone_device_register_with_trips() set the
THERMAL_TRIP_FLAG_RW_TEMP flag for all trips covered by the writable
trips mask passed to it and modify the thermal sysfs code to look at
the trip flags instead of using the writable trips mask directly or
checking the presence of the .set_trip_hyst() zone callback.
Additionally, make trip_point_temp_store() and trip_point_hyst_store()
fail with an error code if the trip passed to one of them has
THERMAL_TRIP_FLAG_RW_TEMP or THERMAL_TRIP_FLAG_RW_HYST,
respectively, clear in its flags.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/thermal/thermal_core.c')
-rw-r--r-- | drivers/thermal/thermal_core.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 1eabc8ebe27d..2ab495220c6e 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1278,6 +1278,7 @@ thermal_zone_device_register_with_trips(const char *type, int passive_delay, int polling_delay) { struct thermal_zone_device *tz; + struct thermal_trip *trip; int id; int result; struct thermal_governor *governor; @@ -1356,13 +1357,19 @@ thermal_zone_device_register_with_trips(const char *type, tz->devdata = devdata; tz->num_trips = num_trips; memcpy(tz->trips, trips, num_trips * sizeof(*trips)); + for_each_trip(tz, trip) { + if (mask & 1) + trip->flags |= THERMAL_TRIP_FLAG_RW_TEMP; + + mask >>= 1; + } thermal_set_delay_jiffies(&tz->passive_delay_jiffies, passive_delay); thermal_set_delay_jiffies(&tz->polling_delay_jiffies, polling_delay); /* sys I/F */ /* Add nodes that are always present via .groups */ - result = thermal_zone_create_device_groups(tz, mask); + result = thermal_zone_create_device_groups(tz); if (result) goto remove_id; |