public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux PM <linux-pm@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	Zhang Rui <rui.zhang@intel.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>
Subject: [PATCH v1 5/7] thermal: intel: intel_soc_dts_iosf: Add helper for resetting trip points
Date: Thu, 10 Aug 2023 21:14:49 +0200	[thread overview]
Message-ID: <3258210.aeNJFYEL58@kreacher> (raw)
In-Reply-To: <5713357.DvuYhMxLoT@kreacher>

From: Rafael J. Wysocki <rafael.j.wysocki@intel.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@intel.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);
 }




  parent reply	other threads:[~2023-08-10 19:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-10 19:08 [PATCH v1 0/7] thermal: intel: intel_soc_dts_iosf: Cleanups, fixes and usage of generic trips Rafael J. Wysocki
2023-08-10 19:09 ` [PATCH v1 1/7] thermal: intel: intel_soc_dts_iosf: Always assume notification support Rafael J. Wysocki
2023-08-10 19:11 ` [PATCH v1 2/7] thermal: intel: intel_soc_dts_iosf: Untangle update_trip_temp() Rafael J. Wysocki
2023-08-10 19:12 ` [PATCH v1 3/7] thermal: intel: intel_soc_dts_iosf: Pass sensors to update_trip_temp() Rafael J. Wysocki
2023-08-10 19:13 ` [PATCH v1 4/7] thermal: intel: intel_soc_dts_iosf: Change initialization ordering Rafael J. Wysocki
2023-08-10 19:14 ` Rafael J. Wysocki [this message]
2023-08-10 19:16 ` [PATCH v1 6/7] thermal: intel: intel_soc_dts_iosf: Rework critical trip setup Rafael J. Wysocki
2023-08-10 19:17 ` [PATCH v1 7/7] thermal: intel: intel_soc_dts_iosf: Use struct thermal_trip Rafael J. Wysocki
2023-08-11  0:00 ` [PATCH v1 0/7] thermal: intel: intel_soc_dts_iosf: Cleanups, fixes and usage of generic trips srinivas pandruvada
2023-08-11  7:59 ` Zhang, Rui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3258210.aeNJFYEL58@kreacher \
    --to=rjw@rjwysocki.net \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=srinivas.pandruvada@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox