Re: [PATCH v1 1/9] ACPI: thermal: Simplify initialization of critical and hot trips

Daniel Lezcano
2023-09-25T15:20:31Z

On 12/09/2023 20:35, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> Use the observation that the critical and hot trip points are never
> updated by the ACPI thermal driver, because the flags passed from
> acpi_thermal_notify() to acpi_thermal_trips_update() do not include
> ACPI_TRIPS_CRITICAL or ACPI_TRIPS_HOT, to move the initialization
> of those trip points directly into acpi_thermal_get_trip_points() and
> reduce the size of __acpi_thermal_trips_update().
>
> Also make the critical and hot trip points initialization code more
> straightforward and drop the flags that are not needed any more.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---

[ ... ]

> +static void acpi_thermal_get_critical_trip(struct acpi_thermal *tz)
> +{
> + unsigned long long tmp;
> + acpi_status status;
> +
> + if (crt > 0) {
> + tmp = celsius_to_deci_kelvin(crt);
> + goto set;
> + }
> + if (crt == -1) {
> + acpi_handle_debug(tz->device->handle, "Critical threshold disabled\n");
> + goto fail;
> + }
> +
> + status = acpi_evaluate_integer(tz->device->handle, "_CRT", NULL, &tmp);
> + if (ACPI_FAILURE(status)) {
> + acpi_handle_debug(tz->device->handle, "No critical threshold\n");
> + goto fail;
> + }
> + if (tmp <= 2732) {
> + /*
> + * Below zero (Celsius) values clearly aren't right for sure,
> + * so discard them as invalid.
> + */
> + pr_info(FW_BUG "Invalid critical threshold (%llu)\n", tmp);
> + goto fail;
> + }
> +
> +set:
> + tz->trips.critical.valid = true;
> + tz->trips.critical.temperature = tmp;
> + acpi_handle_debug(tz->device->handle, "Critical threshold [%lu]\n",
> + tz->trips.critical.temperature);
> + return;
> +
> +fail:

nit: 'notset' may be more adequate

> + tz->trips.critical.valid = false;
> + tz->trips.critical.temperature = THERMAL_TEMP_INVALID;
> +}

Other than that,

Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>

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