mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-04 04:02:26 +00:00
drivers/thermal/core: Optimize trip points check
The trip points are checked one by one with multiple condition branches where one condition is enough to disable the trip point. Merge all these conditions in a single 'OR' statement. Signed-off-by: Bernard Zhao <bernard@vivo.com> Suggested-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20201027013743.62392-1-bernard@vivo.com [dlezcano] Changed patch description
This commit is contained in:
parent
345a8af7ea
commit
37b2539e63
@ -1358,12 +1358,9 @@ thermal_zone_device_register(const char *type, int trips, int mask,
|
||||
goto release_device;
|
||||
|
||||
for (count = 0; count < trips; count++) {
|
||||
if (tz->ops->get_trip_type(tz, count, &trip_type))
|
||||
set_bit(count, &tz->trips_disabled);
|
||||
if (tz->ops->get_trip_temp(tz, count, &trip_temp))
|
||||
set_bit(count, &tz->trips_disabled);
|
||||
/* Check for bogus trip points */
|
||||
if (trip_temp == 0)
|
||||
if (tz->ops->get_trip_type(tz, count, &trip_type) ||
|
||||
tz->ops->get_trip_temp(tz, count, &trip_temp) ||
|
||||
!trip_temp)
|
||||
set_bit(count, &tz->trips_disabled);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user