linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Linux ACPI <linux-acpi@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Linux PM <linux-pm@vger.kernel.org>,
	Zhang Rui <rui.zhang@intel.com>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Subject: Re: [PATCH v1 1/9] ACPI: thermal: Simplify initialization of critical and hot trips
Date: Mon, 25 Sep 2023 17:20:23 +0200	[thread overview]
Message-ID: <acb102d2-c44b-f9a6-671f-d157d1827468@linaro.org> (raw)
In-Reply-To: <4858652.31r3eYUQgx@kreacher>

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 |
<http://www.linaro.org/linaro-blog/> Blog


  reply	other threads:[~2023-09-25 15:20 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-12 18:33 [PATCH v1 0/9] ACPI: thermal: Removal of redundant data and cleanup Rafael J. Wysocki
2023-09-12 18:35 ` [PATCH v1 1/9] ACPI: thermal: Simplify initialization of critical and hot trips Rafael J. Wysocki
2023-09-25 15:20   ` Daniel Lezcano [this message]
2023-09-25 17:12     ` Rafael J. Wysocki
2023-09-12 18:36 ` [PATCH v1 2/9] ACPI: thermal: Fold acpi_thermal_get_info() into its caller Rafael J. Wysocki
2023-09-25 15:31   ` Daniel Lezcano
2023-09-12 18:37 ` [PATCH v1 3/9] ACPI: thermal: Determine the number of trip points earlier Rafael J. Wysocki
2023-09-25 15:59   ` Daniel Lezcano
2023-09-12 18:39 ` [PATCH v1 4/9] ACPI: thermal: Create and populate trip points table earlier Rafael J. Wysocki
2023-09-25 16:29   ` Daniel Lezcano
2023-09-12 18:41 ` [PATCH v1 5/9] ACPI: thermal: Simplify critical and hot trips representation Rafael J. Wysocki
2023-09-25 16:33   ` Daniel Lezcano
2023-09-12 18:43 ` [PATCH v1 6/9] ACPI: thermal: Untangle initialization and updates of the passive trip Rafael J. Wysocki
2023-09-26 11:30   ` Daniel Lezcano
2023-09-12 18:43 ` [PATCH v1 7/9] ACPI: thermal: Untangle initialization and updates of active trips Rafael J. Wysocki
2023-09-20 13:06   ` Rafael J. Wysocki
2023-09-26 13:04   ` Daniel Lezcano
2023-09-12 18:46 ` [PATCH v1 8/9] ACPI: thermal: Drop redundant trip point flags Rafael J. Wysocki
2023-09-26 13:46   ` Daniel Lezcano
2023-09-12 18:47 ` [PATCH v1 9/9] ACPI: thermal: Drop valid flag from struct acpi_thermal_trip Rafael J. Wysocki
2023-09-21  7:36   ` Daniel Lezcano
2023-09-26 13:47   ` Daniel Lezcano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=acb102d2-c44b-f9a6-671f-d157d1827468@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=rui.zhang@intel.com \
    --cc=srinivas.pandruvada@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).