Skip to content

Commit 5bc3da3

Browse files
committed
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>
1 parent 51f2aaf commit 5bc3da3

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

drivers/thermal/intel/intel_soc_dts_iosf.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,12 @@ void intel_soc_dts_iosf_interrupt_handler(struct intel_soc_dts_sensors *sensors)
369369
}
370370
EXPORT_SYMBOL_GPL(intel_soc_dts_iosf_interrupt_handler);
371371

372+
static void dts_trips_reset(struct intel_soc_dts_sensors *sensors, int dts_index)
373+
{
374+
configure_trip(&sensors->soc_dts[dts_index], 0, 0, 0);
375+
configure_trip(&sensors->soc_dts[dts_index], 1, 0, 0);
376+
}
377+
372378
struct intel_soc_dts_sensors *intel_soc_dts_iosf_init(
373379
enum intel_soc_dts_interrupt_type intr_type, int read_only_trip_count)
374380
{
@@ -424,10 +430,8 @@ struct intel_soc_dts_sensors *intel_soc_dts_iosf_init(
424430
remove_dts_thermal_zone(&sensors->soc_dts[i]);
425431

426432
err_reset_trips:
427-
for (i = 0; i < SOC_MAX_DTS_SENSORS; i++) {
428-
configure_trip(&sensors->soc_dts[i], 0, 0, 0);
429-
configure_trip(&sensors->soc_dts[i], 1, 0, 0);
430-
}
433+
for (i = 0; i < SOC_MAX_DTS_SENSORS; i++)
434+
dts_trips_reset(sensors, i);
431435

432436
kfree(sensors);
433437
return ERR_PTR(ret);
@@ -440,8 +444,7 @@ void intel_soc_dts_iosf_exit(struct intel_soc_dts_sensors *sensors)
440444

441445
for (i = 0; i < SOC_MAX_DTS_SENSORS; ++i) {
442446
remove_dts_thermal_zone(&sensors->soc_dts[i]);
443-
configure_trip(&sensors->soc_dts[i], 0, 0, 0);
444-
configure_trip(&sensors->soc_dts[i], 1, 0, 0);
447+
dts_trips_reset(sensors, i);
445448
}
446449
kfree(sensors);
447450
}

0 commit comments

Comments
 (0)