2023-09-12 18:54:48

by Rafael J. Wysocki

[permalink] [raw]
Subject: [PATCH v1 2/9] ACPI: thermal: Fold acpi_thermal_get_info() into its caller

From: Rafael J. Wysocki <[email protected]>

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]>
---
drivers/acpi/thermal.c | 52 +++++++++++++++++--------------------------------
1 file changed, 19 insertions(+), 33 deletions(-)

Index: linux-pm/drivers/acpi/thermal.c
===================================================================
--- linux-pm.orig/drivers/acpi/thermal.c
+++ linux-pm/drivers/acpi/thermal.c
@@ -846,38 +846,6 @@ static void acpi_thermal_aml_dependency_
acpi_evaluate_integer(handle, "_TMP", NULL, &value);
}

-static int acpi_thermal_get_info(struct acpi_thermal *tz)
-{
- int result;
-
- if (!tz)
- return -EINVAL;
-
- acpi_thermal_aml_dependency_fix(tz);
-
- /* Get trip points [_CRT, _PSV, etc.] (required) */
- result = acpi_thermal_get_trip_points(tz);
- if (result)
- return result;
-
- /* Get temperature [_TMP] (required) */
- result = acpi_thermal_get_temperature(tz);
- if (result)
- return result;
-
- /* Set the cooling mode [_SCP] to active cooling (default) */
- acpi_execute_simple_method(tz->device->handle, "_SCP",
- ACPI_THERMAL_MODE_ACTIVE);
-
- /* Get default polling frequency [_TZP] (optional) */
- if (tzp)
- tz->polling_frequency = tzp;
- else
- acpi_thermal_get_polling_frequency(tz);
-
- return 0;
-}
-
/*
* The exact offset between Kelvin and degree Celsius is 273.15. However ACPI
* handles temperature values with a single decimal place. As a consequence,
@@ -940,10 +908,28 @@ static int acpi_thermal_add(struct acpi_
strcpy(acpi_device_class(device), ACPI_THERMAL_CLASS);
device->driver_data = tz;

- result = acpi_thermal_get_info(tz);
+ acpi_thermal_aml_dependency_fix(tz);
+
+ /* Get trip points [_CRT, _PSV, etc.] (required). */
+ result = acpi_thermal_get_trip_points(tz);
if (result)
goto free_memory;

+ /* Get temperature [_TMP] (required). */
+ result = acpi_thermal_get_temperature(tz);
+ if (result)
+ goto free_memory;
+
+ /* Set the cooling mode [_SCP] to active cooling. */
+ acpi_execute_simple_method(tz->device->handle, "_SCP",
+ ACPI_THERMAL_MODE_ACTIVE);
+
+ /* Determine the default polling frequency [_TZP]. */
+ if (tzp)
+ tz->polling_frequency = tzp;
+ else
+ acpi_thermal_get_polling_frequency(tz);
+
acpi_thermal_guess_offset(tz);

result = acpi_thermal_register_thermal_zone(tz);




2023-09-26 00:14:30

by Daniel Lezcano

[permalink] [raw]
Subject: Re: [PATCH v1 2/9] ACPI: thermal: Fold acpi_thermal_get_info() into its caller

On 12/09/2023 20:36, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <[email protected]>
>
> 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]>

--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog