]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
thermal: sysfs: Add sanity checks for trip temperature and hysteresis
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 26 Aug 2024 16:21:59 +0000 (18:21 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 5 Sep 2024 10:32:09 +0000 (12:32 +0200)
commit874b6476fa888e79e41daf7653384c8d70927b90
tree5c136eccbbedfbdbbad75fe9150bf416ef55e1f5
parente9654659fe3c5387f9eafa861d6cc2ad19dd3c5c
thermal: sysfs: Add sanity checks for trip temperature and hysteresis

Add sanity checks for new trip temperature and hysteresis values to
trip_point_temp_store() and trip_point_hyst_store() to prevent trip
point threshold from falling below THERMAL_TEMP_INVALID.

However, still allow user space to pass THERMAL_TEMP_INVALID as the
new trip temperature value to invalidate the trip if necessary.

Also allow the hysteresis to be updated when the temperature is invalid
to allow user space to avoid having to adjust hysteresis after a valid
temperature has been set, but in that case just change the value and do
nothing else.

Fixes: be0a3600aa1e ("thermal: sysfs: Rework the handling of trip point updates")
Cc: 6.8+ <stable@vger.kernel.org> # 6.8+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Link: https://patch.msgid.link/12528772.O9o76ZdvQC@rjwysocki.net
drivers/thermal/thermal_sysfs.c