linux/drivers/thermal/tegra
Rafael J. Wysocki 0728c81087 thermal: trip: Pass trip pointer to .set_trip_temp() thermal zone callback
Out of several drivers implementing the .set_trip_temp() thermal zone
operation, three don't actually use the trip ID argument passed to it,
two call __thermal_zone_get_trip() to get a struct thermal_trip
corresponding to the given trip ID, and the other use the trip ID as an
index into their own data structures with the assumption that it will
always match the ordering of entries in the trips table passed to the
core during thermal zone registration, which is fragile and not really
guaranteed.

Even though the trip IDs used by the core are in fact their indices in the
trips table passed to it by the thermal zone creator, that is purely a
matter of convenience and should not be relied on for correctness.

For this reason, modify trip_point_temp_store() to pass a (const) trip
pointer to .set_trip_temp() and adjust the drivers implementing it
accordingly.

This helps to simplify the drivers invoking __thermal_zone_get_trip()
from their .set_trip_temp() callback functions because they will not
need to do it now and the other drivers can store their internal
trip indices in the priv field in struct thermal_trip and their
.set_trip_temp() callback functions can get those indices from there.

The intel_quark_dts thermal driver can instead use the trip type to
determine the requisite trip index.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/8392906.T7Z3S40VBb@rjwysocki.net
[ rjw: Add missing colon and 2 empty code lines ]
[ rjw: Add missing change in imx_thermal.c and adjust the changelog ]
[ rjw: Drop an unused local variable ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2024-07-12 15:14:01 +02:00
..
Kconfig thermal/drivers/tegra: Correct compile-testing of drivers 2021-08-14 12:24:06 +02:00
Makefile thermal/drivers/tegra: Add driver for Tegra30 thermal sensor 2021-08-14 12:23:39 +02:00
soctherm-fuse.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 282 2019-06-05 17:36:37 +02:00
soctherm.c thermal: trip: Pass trip pointer to .set_trip_temp() thermal zone callback 2024-07-12 15:14:01 +02:00
soctherm.h thermal: tegra: add set_trips functionality 2019-05-13 20:35:33 -07:00
tegra30-tsensor.c thermal: Explicitly include correct DT includes 2023-07-31 20:03:42 +02:00
tegra124-soctherm.c thermal: tegra: add set_trips functionality 2019-05-13 20:35:33 -07:00
tegra132-soctherm.c thermal: tegra: add set_trips functionality 2019-05-13 20:35:33 -07:00
tegra210-soctherm.c thermal: tegra: Make tegra210_tsensor_thermtrips static 2019-05-23 21:52:47 -07:00
tegra-bpmp-thermal.c thermal: tegra-bpmp: Convert to platform remove callback returning void 2023-10-02 14:24:13 +02:00