All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: srinivas.pandruvada@linux.intel.com, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
	rui.zhang@intel.com, christophe.jaillet@wanadoo.fr
Subject: Re: [PATCH v5 1/3] thermal/acpi: Add ACPI trip point routines
Date: Fri, 20 Jan 2023 19:27:50 +0100	[thread overview]
Message-ID: <b007d54e-737f-b0cc-2fb3-45a06d5fa044@linaro.org> (raw)
In-Reply-To: <CAJZ5v0gdXJuNr9jUm6rPdPCuBjc8jwgcZQwtyxurd-jr50btLw@mail.gmail.com>

On 20/01/2023 19:15, Rafael J. Wysocki wrote:
> On Fri, Jan 20, 2023 at 7:08 PM Daniel Lezcano
> <daniel.lezcano@linaro.org> wrote:
>>
>>
>> Hi Rafael,
>>
>>
>> On 19/01/2023 14:15, Rafael J. Wysocki wrote:
>>
>> [ ... ]
>>
>>>> +static int thermal_acpi_get_temperature_object(struct acpi_device *adev,
>>>> +                                              char *object, int *temperature)
>>>
>>> So this would become thermal_acpi_get_temp_object(). or even
>>> thermal_acpi_get_temp() because it really returns the temperature
>>> value.
>>>
>>> I also don't particularly like returning values via pointers, which is
>>> entirely avoidable here, because the temperature value obtained from
>>> the ACPI control methods must be a positive number.
>>>
>>> So I would make it
>>>
>>> static int thermal_acpi_get_temp(struct acpi_device *adev, char *object_name)
>>> {
>>
>> We are converting decikelvin -> millicelsius. Even it is very unlikely,
>> the result could be less than zero (eg. -1°C). We won't be able to
>> differentiate -ENODATA with a negative value, no ?
>>
>> In the future, it is possible we will have to deal with cold trip points
>> in order to warm a board. May be we should don't care for now ?
> 
> My point is that the ACPI specification mandates that the return
> values be in deciK and so always non-negative.

I understand that but the code does:

static int thermal_acpi_get_temp(struct acpi_device *adev, char 
*object_name)
{
	...

	return deci_kelvin_to_millicelsius(temp);
}

All the callers do:

...

         ret = thermal_acpi_get_temp(adev, name);
         if (ret < 0)
		return ret;
	/* This could be an error
	 * or negative millicelsius temperature
	 */

	/* here we already have millicelsius */
         trip->temperature = ret;
...

So I guess we want to do:

...

         ret = thermal_acpi_get_temp(adev, name);
         if (ret < 0)
		return ret;

	/* we convert here instead in thermal_acpi_get_temp() */
         trip->temperature = deci_kelvin_to_millicelsius(ret);
...

Sounds good ?


-- 
<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-01-20 18:27 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-13 18:02 [PATCH v5 0/3] Thermal ACPI APIs for generic trip points Daniel Lezcano
2023-01-13 18:02 ` [PATCH v5 1/3] thermal/acpi: Add ACPI trip point routines Daniel Lezcano
2023-01-19 13:15   ` Rafael J. Wysocki
2023-01-20 18:08     ` Daniel Lezcano
2023-01-20 18:15       ` Rafael J. Wysocki
2023-01-20 18:27         ` Daniel Lezcano [this message]
2023-01-20 18:47           ` Rafael J. Wysocki
2023-01-13 18:02 ` [PATCH v5 2/3] thermal/drivers/intel: Use generic trip points for intel_pch Daniel Lezcano
2023-01-13 18:02 ` [PATCH v5 3/3] thermal/drivers/intel: Use generic trip points int340x Daniel Lezcano
2023-01-18  9:53 ` [PATCH v5 0/3] Thermal ACPI APIs for generic trip points Daniel Lezcano
2023-01-18 13:48   ` Zhang, Rui
2023-01-18 13:54     ` Daniel Lezcano
2023-01-18 19:01     ` srinivas pandruvada
2023-01-18 19:14       ` Daniel Lezcano
2023-01-18 19:16       ` srinivas pandruvada
2023-01-18 20:00         ` Daniel Lezcano
2023-01-18 20:53           ` srinivas pandruvada
2023-01-18 21:01             ` Daniel Lezcano
2023-01-18 21:16               ` srinivas pandruvada
2023-01-18 22:14                 ` Daniel Lezcano
2023-01-18 23:04                   ` srinivas pandruvada
2023-01-19 12:17                     ` Rafael J. Wysocki
2023-01-19 16:58                       ` srinivas pandruvada
2023-01-19 17:05                         ` Rafael J. Wysocki

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=b007d54e-737f-b0cc-2fb3-45a06d5fa044@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.