diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2023-08-07 20:11:07 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2023-08-17 11:25:22 +0200 |
commit | 96b8b4365db44af0a94b91a805cd5beed45d24fa (patch) | |
tree | 42bb2cf723090865a909389481df429d6216928f /drivers/thermal/thermal_trip.c | |
parent | ACPI: thermal: Introduce struct acpi_thermal_trip (diff) | |
download | linux-96b8b4365db44af0a94b91a805cd5beed45d24fa.tar.xz linux-96b8b4365db44af0a94b91a805cd5beed45d24fa.zip |
thermal: core: Rework and rename __for_each_thermal_trip()
Rework the currently unused __for_each_thermal_trip() to pass original
pointers to struct thermal_trip objects to the callback, so it can be
used for updating trip data (e.g. temperatures), rename it to
for_each_thermal_trip() and make it available to modular drivers.
Suggested-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/thermal/thermal_trip.c')
-rw-r--r-- | drivers/thermal/thermal_trip.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/thermal/thermal_trip.c b/drivers/thermal/thermal_trip.c index 907f3a4d7bc8..53115cfdfd42 100644 --- a/drivers/thermal/thermal_trip.c +++ b/drivers/thermal/thermal_trip.c @@ -9,28 +9,26 @@ */ #include "thermal_core.h" -int __for_each_thermal_trip(struct thermal_zone_device *tz, - int (*cb)(struct thermal_trip *, void *), - void *data) +int for_each_thermal_trip(struct thermal_zone_device *tz, + int (*cb)(struct thermal_trip *, void *), + void *data) { int i, ret; - struct thermal_trip trip; lockdep_assert_held(&tz->lock); - for (i = 0; i < tz->num_trips; i++) { - - ret = __thermal_zone_get_trip(tz, i, &trip); - if (ret) - return ret; + if (!tz->trips) + return -ENODATA; - ret = cb(&trip, data); + for (i = 0; i < tz->num_trips; i++) { + ret = cb(&tz->trips[i], data); if (ret) return ret; } return 0; } +EXPORT_SYMBOL_GPL(for_each_thermal_trip); int thermal_zone_get_num_trips(struct thermal_zone_device *tz) { |