Skip to content

Commit b09872a

Browse files
committed
ACPI: thermal: Fold acpi_thermal_get_info() into its caller
There is only one caller of acpi_thermal_get_info() and the code from it can be folded into its caller just fine, so do that. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Daniel Lezcano <[email protected]>
1 parent 4be3233 commit b09872a

File tree

1 file changed

+19
-33
lines changed

1 file changed

+19
-33
lines changed

drivers/acpi/thermal.c

Lines changed: 19 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -846,38 +846,6 @@ static void acpi_thermal_aml_dependency_fix(struct acpi_thermal *tz)
846846
acpi_evaluate_integer(handle, "_TMP", NULL, &value);
847847
}
848848

849-
static int acpi_thermal_get_info(struct acpi_thermal *tz)
850-
{
851-
int result;
852-
853-
if (!tz)
854-
return -EINVAL;
855-
856-
acpi_thermal_aml_dependency_fix(tz);
857-
858-
/* Get trip points [_CRT, _PSV, etc.] (required) */
859-
result = acpi_thermal_get_trip_points(tz);
860-
if (result)
861-
return result;
862-
863-
/* Get temperature [_TMP] (required) */
864-
result = acpi_thermal_get_temperature(tz);
865-
if (result)
866-
return result;
867-
868-
/* Set the cooling mode [_SCP] to active cooling (default) */
869-
acpi_execute_simple_method(tz->device->handle, "_SCP",
870-
ACPI_THERMAL_MODE_ACTIVE);
871-
872-
/* Get default polling frequency [_TZP] (optional) */
873-
if (tzp)
874-
tz->polling_frequency = tzp;
875-
else
876-
acpi_thermal_get_polling_frequency(tz);
877-
878-
return 0;
879-
}
880-
881849
/*
882850
* The exact offset between Kelvin and degree Celsius is 273.15. However ACPI
883851
* handles temperature values with a single decimal place. As a consequence,
@@ -940,10 +908,28 @@ static int acpi_thermal_add(struct acpi_device *device)
940908
strcpy(acpi_device_class(device), ACPI_THERMAL_CLASS);
941909
device->driver_data = tz;
942910

943-
result = acpi_thermal_get_info(tz);
911+
acpi_thermal_aml_dependency_fix(tz);
912+
913+
/* Get trip points [_CRT, _PSV, etc.] (required). */
914+
result = acpi_thermal_get_trip_points(tz);
944915
if (result)
945916
goto free_memory;
946917

918+
/* Get temperature [_TMP] (required). */
919+
result = acpi_thermal_get_temperature(tz);
920+
if (result)
921+
goto free_memory;
922+
923+
/* Set the cooling mode [_SCP] to active cooling. */
924+
acpi_execute_simple_method(tz->device->handle, "_SCP",
925+
ACPI_THERMAL_MODE_ACTIVE);
926+
927+
/* Determine the default polling frequency [_TZP]. */
928+
if (tzp)
929+
tz->polling_frequency = tzp;
930+
else
931+
acpi_thermal_get_polling_frequency(tz);
932+
947933
acpi_thermal_guess_offset(tz);
948934

949935
result = acpi_thermal_register_thermal_zone(tz);

0 commit comments

Comments
 (0)