Skip to content

Commit bf07b4a

Browse files
committed
ACPI: thermal: Clean up acpi_thermal_register_thermal_zone()
Rename the trips variable in acpi_thermal_register_thermal_zone() to trip_count so its name better reflects the purpose, rearrange white space in the loop over active trips for clarity and reduce code duplication related to calling thermal_zone_device_register() by using an extra local variable to store the passive delay value. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent cba440f commit bf07b4a

1 file changed

Lines changed: 14 additions & 18 deletions

File tree

drivers/acpi/thermal.c

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -740,33 +740,29 @@ static void acpi_thermal_zone_sysfs_remove(struct acpi_thermal *tz)
740740

741741
static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
742742
{
743-
int trips = 0;
743+
int passive_delay = 0;
744+
int trip_count = 0;
744745
int result;
745746
int i;
746747

747748
if (tz->trips.critical.valid)
748-
trips++;
749+
trip_count++;
749750

750751
if (tz->trips.hot.valid)
751-
trips++;
752+
trip_count++;
752753

753-
if (tz->trips.passive.valid)
754-
trips++;
755-
756-
for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE && tz->trips.active[i].valid;
757-
i++, trips++);
754+
if (tz->trips.passive.valid) {
755+
trip_count++;
756+
passive_delay = tz->trips.passive.tsp * 100;
757+
}
758758

759-
if (tz->trips.passive.valid)
760-
tz->thermal_zone = thermal_zone_device_register("acpitz", trips, 0, tz,
761-
&acpi_thermal_zone_ops, NULL,
762-
tz->trips.passive.tsp * 100,
763-
tz->polling_frequency * 100);
764-
else
765-
tz->thermal_zone =
766-
thermal_zone_device_register("acpitz", trips, 0, tz,
767-
&acpi_thermal_zone_ops, NULL,
768-
0, tz->polling_frequency * 100);
759+
for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE && tz->trips.active[i].valid; i++)
760+
trip_count++;
769761

762+
tz->thermal_zone = thermal_zone_device_register("acpitz", trip_count, 0,
763+
tz, &acpi_thermal_zone_ops,
764+
NULL, passive_delay,
765+
tz->polling_frequency * 100);
770766
if (IS_ERR(tz->thermal_zone))
771767
return -ENODEV;
772768

0 commit comments

Comments
 (0)