lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3258210.aeNJFYEL58@kreacher>
Date:   Thu, 10 Aug 2023 21:14:49 +0200
From:   "Rafael J. Wysocki" <rjw@...ysocki.net>
To:     Linux PM <linux-pm@...r.kernel.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
        Zhang Rui <rui.zhang@...el.com>,
        Daniel Lezcano <daniel.lezcano@...aro.org>
Subject: [PATCH v1 5/7] thermal: intel: intel_soc_dts_iosf: Add helper for resetting trip points

From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>

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@...el.com>
---
 drivers/thermal/intel/intel_soc_dts_iosf.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

Index: linux-pm/drivers/thermal/intel/intel_soc_dts_iosf.c
===================================================================
--- linux-pm.orig/drivers/thermal/intel/intel_soc_dts_iosf.c
+++ linux-pm/drivers/thermal/intel/intel_soc_dts_iosf.c
@@ -369,6 +369,12 @@ void intel_soc_dts_iosf_interrupt_handle
 }
 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 inte
 
 	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);
 }



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ