Re: [PATCH v2] ACPI: thermal: Continue registering thermal zones even if trip points fail validation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Mar 31, 2024 at 10:37 AM Stephen Horvath
<s.horvath@xxxxxxxxxxxxxx> wrote:
>
> Some laptops where the thermal control is handled by the EC may
> provide trip points that fail the kernels new validation, but still have
> working temperature sensors. An example of this is the Framework 13 AMD.
>
> This patch allows the thermal zone to still be registered without trip
> points if the trip points fail validation, allowing the temperature
> sensor to be viewed and used by the user.
>
> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218586
> Fixes: 9c8647224e9f ("ACPI: thermal: Use library functions to obtain trip point temperature values")
> Signed-off-by: Stephen Horvath <s.horvath@xxxxxxxxxxxxxx>
> ---
>  V1 -> V2: Referenced bug tracker in commit, and switched to using
>                 `thermal_tripless_zone_device_register` as per the
>                 suggestion of Rafael J. Wysocki.
>
>  drivers/acpi/thermal.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
> index 302dce0b2b50..10044c56b85e 100644
> --- a/drivers/acpi/thermal.c
> +++ b/drivers/acpi/thermal.c
> @@ -662,14 +662,16 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz,
>  {
>         int result;
>
> -       tz->thermal_zone = thermal_zone_device_register_with_trips("acpitz",
> -                                                                  trip_table,
> -                                                                  trip_count,
> -                                                                  tz,
> -                                                                  &acpi_thermal_zone_ops,
> -                                                                  NULL,
> -                                                                  passive_delay,
> -                                                                  tz->polling_frequency * 100);
> +       if (trip_count) {
> +               tz->thermal_zone = thermal_zone_device_register_with_trips(
> +                       "acpitz", trip_table, trip_count, tz,
> +                       &acpi_thermal_zone_ops, NULL, passive_delay,
> +                       tz->polling_frequency * 100);
> +       } else {
> +               tz->thermal_zone = thermal_tripless_zone_device_register(
> +                       "acpitz", tz, &acpi_thermal_zone_ops, NULL);
> +       }
> +
>         if (IS_ERR(tz->thermal_zone))
>                 return PTR_ERR(tz->thermal_zone);
>
> @@ -903,8 +905,6 @@ static int acpi_thermal_add(struct acpi_device *device)
>
>         if (trip == trip_table) {
>                 pr_warn(FW_BUG "No valid trip points!\n");
> -               result = -ENODEV;
> -               goto free_memory;
>         }
>
>         result = acpi_thermal_register_thermal_zone(tz, trip_table,
>
> base-commit: 4cece764965020c22cff7665b18a012006359095
> --

Applied as 6.9-rc material under a modified subject ("ACPI: thermal:
Register thermal zones without valid trip points"), with some
redundant braces removed and with some white space adjusted.

Please verify the result at
https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/commit/?h=bleeding-edge&id=8a4ff5452dd0cdcc35940460bb777d836bece11c





[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux