Skip to content

Commit da5e562

Browse files
andy-shevdlezcano
authored andcommitted
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
1 parent 481bd29 commit da5e562

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

drivers/thermal/intel/intel_soc_dts_iosf.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -350,13 +350,14 @@ int intel_soc_dts_iosf_add_read_only_critical_trip(
350350
int i, j;
351351

352352
for (i = 0; i < SOC_MAX_DTS_SENSORS; ++i) {
353-
for (j = 0; j < sensors->soc_dts[i].trip_count; ++j) {
354-
if (!(sensors->soc_dts[i].trip_mask & BIT(j))) {
355-
return update_trip_temp(&sensors->soc_dts[i], j,
356-
sensors->tj_max - critical_offset,
357-
THERMAL_TRIP_CRITICAL);
358-
}
359-
}
353+
struct intel_soc_dts_sensor_entry *entry = &sensors->soc_dts[i];
354+
int temp = sensors->tj_max - critical_offset;
355+
unsigned long count = entry->trip_count;
356+
unsigned long mask = entry->trip_mask;
357+
358+
j = find_first_zero_bit(&mask, count);
359+
if (j < count)
360+
return update_trip_temp(entry, j, temp, THERMAL_TRIP_CRITICAL);
360361
}
361362

362363
return -EINVAL;

0 commit comments

Comments
 (0)