[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0iRe17sziFesvenjvjq+Onu2tdAsohb+VLA+exp5xPC-w@mail.gmail.com>
Date: Mon, 25 Sep 2023 19:12:52 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Daniel Lezcano <daniel.lezcano@...aro.org>
Cc: "Rafael J. Wysocki" <rjw@...ysocki.net>,
Linux ACPI <linux-acpi@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
Linux PM <linux-pm@...r.kernel.org>,
Zhang Rui <rui.zhang@...el.com>,
Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>
Subject: Re: [PATCH v1 1/9] ACPI: thermal: Simplify initialization of critical
and hot trips
On Mon, Sep 25, 2023 at 5:20 PM Daniel Lezcano
<daniel.lezcano@...aro.org> wrote:
>
> On 12/09/2023 20:35, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@...el.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@...el.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
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@...aro.org>
Thanks!
Powered by blists - more mailing lists