summaryrefslogtreecommitdiff
path: root/drivers/thermal
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2023-08-10 22:14:49 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2023-08-11 19:44:45 +0300
commit5bc3da35d7ad35e61d2b902f0fdc9b530bed3d89 (patch)
tree7bdbe2d191f845bc827a2a40eb2fe5db4648ed63 /drivers/thermal
parent51f2aaf0dfb1a21281e2d47c94b1a5b245b033fa (diff)
downloadlinux-5bc3da35d7ad35e61d2b902f0fdc9b530bed3d89.tar.xz
thermal: intel: intel_soc_dts_iosf: Add helper for resetting trip points
Because trip points are reset for each sensor in two places in the same way, add a helper function for that to reduce code duplication a bit. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/intel/intel_soc_dts_iosf.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/thermal/intel/intel_soc_dts_iosf.c b/drivers/thermal/intel/intel_soc_dts_iosf.c
index 5ca2e565f9a3..d1d2c77bbce7 100644
--- a/drivers/thermal/intel/intel_soc_dts_iosf.c
+++ b/drivers/thermal/intel/intel_soc_dts_iosf.c
@@ -369,6 +369,12 @@ void intel_soc_dts_iosf_interrupt_handler(struct intel_soc_dts_sensors *sensors)
}
EXPORT_SYMBOL_GPL(intel_soc_dts_iosf_interrupt_handler);
+static void dts_trips_reset(struct intel_soc_dts_sensors *sensors, int dts_index)
+{
+ configure_trip(&sensors->soc_dts[dts_index], 0, 0, 0);
+ configure_trip(&sensors->soc_dts[dts_index], 1, 0, 0);
+}
+
struct intel_soc_dts_sensors *intel_soc_dts_iosf_init(
enum intel_soc_dts_interrupt_type intr_type, int read_only_trip_count)
{
@@ -424,10 +430,8 @@ err_remove_zone:
remove_dts_thermal_zone(&sensors->soc_dts[i]);
err_reset_trips:
- for (i = 0; i < SOC_MAX_DTS_SENSORS; i++) {
- configure_trip(&sensors->soc_dts[i], 0, 0, 0);
- configure_trip(&sensors->soc_dts[i], 1, 0, 0);
- }
+ for (i = 0; i < SOC_MAX_DTS_SENSORS; i++)
+ dts_trips_reset(sensors, i);
kfree(sensors);
return ERR_PTR(ret);
@@ -440,8 +444,7 @@ void intel_soc_dts_iosf_exit(struct intel_soc_dts_sensors *sensors)
for (i = 0; i < SOC_MAX_DTS_SENSORS; ++i) {
remove_dts_thermal_zone(&sensors->soc_dts[i]);
- configure_trip(&sensors->soc_dts[i], 0, 0, 0);
- configure_trip(&sensors->soc_dts[i], 1, 0, 0);
+ dts_trips_reset(sensors, i);
}
kfree(sensors);
}