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

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

 



On Mon, Sep 25, 2023 at 5:20 PM Daniel Lezcano
<daniel.lezcano@xxxxxxxxxx> wrote:
>
> On 12/09/2023 20:35, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
> >
> > 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@xxxxxxxxx>
> > ---
>
> [ ... ]
>
> > +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

Well, this is a bit moot, because the label goes away in one of the
later patches anyway.

> > +     tz->trips.critical.valid = false;
> > +     tz->trips.critical.temperature = THERMAL_TEMP_INVALID;
> > +}
>
> Other than that,
>
> Reviewed-by: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>

Thanks!





[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