All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] thermal: intel: intel_soc_dts_iosf: Switch to use find_first_zero_bit()
@ 2021-06-18 15:34 Andy Shevchenko
  2021-06-30  9:31 ` [thermal: thermal/next] thermal/drivers/intel/intel_soc_dts_iosf: " thermal-bot for Andy Shevchenko
  2021-07-04 18:02 ` thermal-bot for Andy Shevchenko
  0 siblings, 2 replies; 3+ messages in thread
From: Andy Shevchenko @ 2021-06-18 15:34 UTC (permalink / raw)
  To: Andy Shevchenko, linux-pm, linux-kernel
  Cc: Zhang Rui, Daniel Lezcano, Amit Kucheria

Switch to use find_first_zero_bit() instead of open-coded variant.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/thermal/intel/intel_soc_dts_iosf.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/thermal/intel/intel_soc_dts_iosf.c b/drivers/thermal/intel/intel_soc_dts_iosf.c
index 4f1a2f7c016c..342b0bb5a56d 100644
--- a/drivers/thermal/intel/intel_soc_dts_iosf.c
+++ b/drivers/thermal/intel/intel_soc_dts_iosf.c
@@ -350,13 +350,14 @@ int intel_soc_dts_iosf_add_read_only_critical_trip(
 	int i, j;
 
 	for (i = 0; i < SOC_MAX_DTS_SENSORS; ++i) {
-		for (j = 0; j < sensors->soc_dts[i].trip_count; ++j) {
-			if (!(sensors->soc_dts[i].trip_mask & BIT(j))) {
-				return update_trip_temp(&sensors->soc_dts[i], j,
-					sensors->tj_max - critical_offset,
-					THERMAL_TRIP_CRITICAL);
-			}
-		}
+		struct intel_soc_dts_sensor_entry *entry = &sensors->soc_dts[i];
+		int temp = sensors->tj_max - critical_offset;
+		unsigned long count = entry->trip_count;
+		unsigned long mask = entry->trip_mask;
+
+		j = find_first_zero_bit(&mask, count);
+		if (j < count)
+			return update_trip_temp(entry, j, temp, THERMAL_TRIP_CRITICAL);
 	}
 
 	return -EINVAL;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [thermal: thermal/next] thermal/drivers/intel/intel_soc_dts_iosf: Switch to use find_first_zero_bit()
  2021-06-18 15:34 [PATCH v1 1/1] thermal: intel: intel_soc_dts_iosf: Switch to use find_first_zero_bit() Andy Shevchenko
@ 2021-06-30  9:31 ` thermal-bot for Andy Shevchenko
  2021-07-04 18:02 ` thermal-bot for Andy Shevchenko
  1 sibling, 0 replies; 3+ messages in thread
From: thermal-bot for Andy Shevchenko @ 2021-06-30  9:31 UTC (permalink / raw)
  To: linux-pm; +Cc: Andy Shevchenko, Daniel Lezcano, rui.zhang, amitk

The following commit has been merged into the thermal/next branch of thermal:

Commit-ID:     58d353c888a04efaac04547702ff05d16c43f9b3
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//58d353c888a04efaac04547702ff05d16c43f9b3
Author:        Andy Shevchenko <andriy.shevchenko@linux.intel.com>
AuthorDate:    Fri, 18 Jun 2021 18:34:51 +03:00
Committer:     Daniel Lezcano <daniel.lezcano@linaro.org>
CommitterDate: Mon, 21 Jun 2021 15:50:54 +02:00

thermal/drivers/intel/intel_soc_dts_iosf: Switch to use find_first_zero_bit()

Switch to use find_first_zero_bit() instead of open-coded variant.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20210618153451.89246-1-andriy.shevchenko@linux.intel.com
---
 drivers/thermal/intel/intel_soc_dts_iosf.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/thermal/intel/intel_soc_dts_iosf.c b/drivers/thermal/intel/intel_soc_dts_iosf.c
index 4f1a2f7..342b0bb 100644
--- a/drivers/thermal/intel/intel_soc_dts_iosf.c
+++ b/drivers/thermal/intel/intel_soc_dts_iosf.c
@@ -350,13 +350,14 @@ int intel_soc_dts_iosf_add_read_only_critical_trip(
 	int i, j;
 
 	for (i = 0; i < SOC_MAX_DTS_SENSORS; ++i) {
-		for (j = 0; j < sensors->soc_dts[i].trip_count; ++j) {
-			if (!(sensors->soc_dts[i].trip_mask & BIT(j))) {
-				return update_trip_temp(&sensors->soc_dts[i], j,
-					sensors->tj_max - critical_offset,
-					THERMAL_TRIP_CRITICAL);
-			}
-		}
+		struct intel_soc_dts_sensor_entry *entry = &sensors->soc_dts[i];
+		int temp = sensors->tj_max - critical_offset;
+		unsigned long count = entry->trip_count;
+		unsigned long mask = entry->trip_mask;
+
+		j = find_first_zero_bit(&mask, count);
+		if (j < count)
+			return update_trip_temp(entry, j, temp, THERMAL_TRIP_CRITICAL);
 	}
 
 	return -EINVAL;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [thermal: thermal/next] thermal/drivers/intel/intel_soc_dts_iosf: Switch to use find_first_zero_bit()
  2021-06-18 15:34 [PATCH v1 1/1] thermal: intel: intel_soc_dts_iosf: Switch to use find_first_zero_bit() Andy Shevchenko
  2021-06-30  9:31 ` [thermal: thermal/next] thermal/drivers/intel/intel_soc_dts_iosf: " thermal-bot for Andy Shevchenko
@ 2021-07-04 18:02 ` thermal-bot for Andy Shevchenko
  1 sibling, 0 replies; 3+ messages in thread
From: thermal-bot for Andy Shevchenko @ 2021-07-04 18:02 UTC (permalink / raw)
  To: linux-pm; +Cc: Andy Shevchenko, Daniel Lezcano, rui.zhang, amitk

The following commit has been merged into the thermal/next branch of thermal:

Commit-ID:     da5e562fbc5676902d9007db4b05af9de7a890d5
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//da5e562fbc5676902d9007db4b05af9de7a890d5
Author:        Andy Shevchenko <andriy.shevchenko@linux.intel.com>
AuthorDate:    Fri, 18 Jun 2021 18:34:51 +03:00
Committer:     Daniel Lezcano <daniel.lezcano@linaro.org>
CommitterDate: Sun, 04 Jul 2021 18:28:04 +02:00

thermal/drivers/intel/intel_soc_dts_iosf: Switch to use find_first_zero_bit()

Switch to use find_first_zero_bit() instead of open-coded variant.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20210618153451.89246-1-andriy.shevchenko@linux.intel.com
---
 drivers/thermal/intel/intel_soc_dts_iosf.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/thermal/intel/intel_soc_dts_iosf.c b/drivers/thermal/intel/intel_soc_dts_iosf.c
index 4f1a2f7..342b0bb 100644
--- a/drivers/thermal/intel/intel_soc_dts_iosf.c
+++ b/drivers/thermal/intel/intel_soc_dts_iosf.c
@@ -350,13 +350,14 @@ int intel_soc_dts_iosf_add_read_only_critical_trip(
 	int i, j;
 
 	for (i = 0; i < SOC_MAX_DTS_SENSORS; ++i) {
-		for (j = 0; j < sensors->soc_dts[i].trip_count; ++j) {
-			if (!(sensors->soc_dts[i].trip_mask & BIT(j))) {
-				return update_trip_temp(&sensors->soc_dts[i], j,
-					sensors->tj_max - critical_offset,
-					THERMAL_TRIP_CRITICAL);
-			}
-		}
+		struct intel_soc_dts_sensor_entry *entry = &sensors->soc_dts[i];
+		int temp = sensors->tj_max - critical_offset;
+		unsigned long count = entry->trip_count;
+		unsigned long mask = entry->trip_mask;
+
+		j = find_first_zero_bit(&mask, count);
+		if (j < count)
+			return update_trip_temp(entry, j, temp, THERMAL_TRIP_CRITICAL);
 	}
 
 	return -EINVAL;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-04 18:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-18 15:34 [PATCH v1 1/1] thermal: intel: intel_soc_dts_iosf: Switch to use find_first_zero_bit() Andy Shevchenko
2021-06-30  9:31 ` [thermal: thermal/next] thermal/drivers/intel/intel_soc_dts_iosf: " thermal-bot for Andy Shevchenko
2021-07-04 18:02 ` thermal-bot for Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.