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
This commit is contained in:
Andy Shevchenko 2021-06-18 18:34:51 +03:00 committed by Daniel Lezcano
parent 481bd29729
commit da5e562fbc
1 changed files with 8 additions and 7 deletions

View File

@ -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;