lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0jm5h9qeZdnLDp9qUMT-31FOWMBERMzhFzgFsmt9QX78g@mail.gmail.com>
Date:   Wed, 18 Oct 2023 13:48:27 +0200
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Sumit Gupta <sumitg@...dia.com>
Cc:     rafael@...nel.org, rui.zhang@...el.com, lenb@...nel.org,
        linux-acpi@...r.kernel.org, linux-tegra@...r.kernel.org,
        linux-kernel@...r.kernel.org, treding@...dia.com,
        jonathanh@...dia.com, bbasu@...dia.com, sanjayc@...dia.com,
        ksitaraman@...dia.com, srikars@...dia.com, jbrasen@...dia.com
Subject: Re: [Patch v5 1/2] ACPI: thermal: Add Thermal fast Sampling Period
 (_TFP) support

On Sat, Oct 14, 2023 at 12:54 PM Sumit Gupta <sumitg@...dia.com> wrote:
>
> From: Jeff Brasen <jbrasen@...dia.com>
>
> Add support of "Thermal fast Sampling Period (_TFP)" for Passive cooling.
> As per [1], _TFP overrides the "Thermal Sampling Period (_TSP)" if both
> are present in a Thermal zone.
>
> [1] ACPI Specification 6.4 - section 11.4.17. _TFP (Thermal fast Sampling
>     Period)"
>
> Signed-off-by: Jeff Brasen <jbrasen@...dia.com>
> Signed-off-by: Sumit Gupta <sumitg@...dia.com>
> ---
>  drivers/acpi/thermal.c | 17 +++++++++++------
>  1 file changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
> index d98ff69303b3..a91e3d566858 100644
> --- a/drivers/acpi/thermal.c
> +++ b/drivers/acpi/thermal.c
> @@ -90,7 +90,7 @@ struct acpi_thermal_passive {
>         struct acpi_thermal_trip trip;
>         unsigned long tc1;
>         unsigned long tc2;
> -       unsigned long tsp;
> +       unsigned long passive_delay;

This is a passive trip structure anyway, so the "passive_" prefix is
redundant here.  "delay" alone would be fine.

>  };
>
>  struct acpi_thermal_active {
> @@ -404,11 +404,16 @@ static bool passive_trip_params_init(struct acpi_thermal *tz)
>
>         tz->trips.passive.tc2 = tmp;
>
> -       status = acpi_evaluate_integer(tz->device->handle, "_TSP", NULL, &tmp);
> -       if (ACPI_FAILURE(status))
> -               return false;
> +       status = acpi_evaluate_integer(tz->device->handle, "_TFP", NULL, &tmp);
> +       if (ACPI_FAILURE(status)) {
> +               status = acpi_evaluate_integer(tz->device->handle, "_TSP", NULL, &tmp);
> +               if (ACPI_FAILURE(status))
> +                       return false;
>
> -       tz->trips.passive.tsp = tmp;
> +               tz->trips.passive.passive_delay = tmp * 100;
> +       } else {
> +               tz->trips.passive.passive_delay = tmp;
> +       }

I would prefer the if () statement above to be structured the other
way around, that is

 status = ...
 if (ACPI_SUCCESS(status)) {
        tz->trips.passive.delay = tmp;
        return true;
}

status = ...
if (ACPI_FAILURE(status))
         return false;

etc.

>
>         return true;
>  }
> @@ -904,7 +909,7 @@ static int acpi_thermal_add(struct acpi_device *device)
>
>         acpi_trip = &tz->trips.passive.trip;
>         if (acpi_thermal_trip_valid(acpi_trip)) {
> -               passive_delay = tz->trips.passive.tsp * 100;
> +               passive_delay = tz->trips.passive.passive_delay;
>
>                 trip->type = THERMAL_TRIP_PASSIVE;
>                 trip->temperature = acpi_thermal_temp(tz, acpi_trip->temp_dk);
> --
> 2.17.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ