public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Lukasz Luba <lukasz.luba@arm.com>
Cc: linux-pm@vger.kernel.org, quic_manafm@quicinc.com, rafael@kernel.org
Subject: Re: [PATCH v5 4/4] tools/thermal/thermal-engine: Take into account the thresholds API
Date: Tue, 22 Oct 2024 09:52:07 +0200	[thread overview]
Message-ID: <dcc9623d-6705-4c16-aa11-3956f7279562@linaro.org> (raw)
In-Reply-To: <deacf57b-08b3-4b1b-85b2-98be78da8339@arm.com>

On 21/10/2024 22:10, Lukasz Luba wrote:
> 
> 
> On 10/14/24 10:43, Daniel Lezcano wrote:
>> Enhance the thermal-engine skeleton with the thresholds added in the
>> kernel and use the API exported by the thermal library.
>>
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
>> ---
>>   tools/thermal/thermal-engine/thermal-engine.c | 105 +++++++++++++++---
>>   1 file changed, 92 insertions(+), 13 deletions(-)
>>
>> diff --git a/tools/thermal/thermal-engine/thermal-engine.c b/tools/ 
>> thermal/thermal-engine/thermal-engine.c
>> index 9b1476a2680f..0764dc754771 100644
>> --- a/tools/thermal/thermal-engine/thermal-engine.c
>> +++ b/tools/thermal/thermal-engine/thermal-engine.c
>> @@ -38,6 +38,14 @@ struct thermal_data {
>>       struct thermal_handler *th;
>>   };
>> +static int show_threshold(struct thermal_threshold *th, 
>> __maybe_unused void *arg)
>> +{
>> +    INFO("threshold temp=%d, direction=%d\n",
>> +         th->temperature, th->direction);
>> +
>> +    return 0;
>> +}
>> +
>>   static int show_trip(struct thermal_trip *tt, __maybe_unused void *arg)
>>   {
>>       INFO("trip id=%d, type=%d, temp=%d, hyst=%d\n",
>> @@ -70,6 +78,8 @@ static int show_tz(struct thermal_zone *tz, 
>> __maybe_unused void *arg)
>>       for_each_thermal_trip(tz->trip, show_trip, NULL);
>> +    for_each_thermal_threshold(tz->thresholds, show_threshold, NULL);
>> +
>>       show_temp(tz, arg);
>>       show_governor(tz, arg);
>> @@ -77,6 +87,30 @@ static int show_tz(struct thermal_zone *tz, 
>> __maybe_unused void *arg)
>>       return 0;
>>   }
>> +static int set_threshold(struct thermal_zone *tz, __maybe_unused void 
>> *arg)
>> +{
>> +    struct thermal_handler *th = arg;
>> +    int thresholds[] = { 43000, 65000, 49000, 55000, 57000 };
>> +    size_t i;
> 
> minor: I would just make it normal 'int'.

Why ? :)

The for loop compares i < sizeof(thresholds) / sizeof(thresholds[0])

sizeof() returns size_t

So we are comparing the same type.


>> +
>> +    INFO("Setting threshold for thermal zone '%s', id=%d\n", tz- 
>> >name, tz->id);
>> +

[ ... ]

> 
> LGTM,
> 
> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>


Thanks for the review



-- 
<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:[~2024-10-22  7:52 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-14  9:43 [PATCH v5 0/4] Add thermal user thresholds support Daniel Lezcano
2024-10-14  9:43 ` [PATCH v5 1/4] thermal/netlink: Add the commands and the events for the thresholds Daniel Lezcano
2024-10-21 10:58   ` Rafael J. Wysocki
2024-10-21 19:42   ` Lukasz Luba
2024-10-21 19:47     ` Rafael J. Wysocki
2024-10-21 19:51       ` Lukasz Luba
2024-10-21 22:02   ` Lukasz Luba
2024-10-22  7:09     ` Daniel Lezcano
2024-10-22  9:40       ` Lukasz Luba
2024-10-22 10:01         ` Rafael J. Wysocki
2024-10-22 10:20           ` Lukasz Luba
2024-10-14  9:43 ` [PATCH v5 2/4] tools/lib/thermal: Make more generic the command encoding function Daniel Lezcano
2024-10-21 19:49   ` Lukasz Luba
2024-10-22  7:12     ` Daniel Lezcano
2024-10-22  9:43       ` Lukasz Luba
2024-10-14  9:43 ` [PATCH v5 3/4] tools/lib/thermal: Add the threshold netlink ABI Daniel Lezcano
2024-10-21 20:47   ` Lukasz Luba
2024-10-22  7:49     ` Daniel Lezcano
2024-10-22  9:50       ` Lukasz Luba
2024-10-22 13:21         ` Daniel Lezcano
2024-10-14  9:43 ` [PATCH v5 4/4] tools/thermal/thermal-engine: Take into account the thresholds API Daniel Lezcano
2024-10-21 20:10   ` Lukasz Luba
2024-10-22  7:52     ` Daniel Lezcano [this message]
2024-10-21  8:28 ` [PATCH v5 0/4] Add thermal user thresholds support Daniel Lezcano
2024-10-21  8:43   ` Lukasz Luba
2024-10-21 11:02   ` 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=dcc9623d-6705-4c16-aa11-3956f7279562@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=quic_manafm@quicinc.com \
    --cc=rafael@kernel.org \
    /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