thermal: core: Add flags to struct thermal_trip
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 22 Feb 2024 17:30:49 +0000 (18:30 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 27 Feb 2024 11:02:50 +0000 (12:02 +0100)
commit5340f7647294fa8ff8cf5a1bee326b2bd8340e27
treec6bdc635eeac5800c2558b5597ebba1947299e66
parentda1983355ccefcfb3f8eb410fff82e250fa87e39
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>
drivers/thermal/thermal_core.c
drivers/thermal/thermal_core.h
drivers/thermal/thermal_sysfs.c
include/linux/thermal.h