lkml.org 
[lkml]   [2022]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v5 05/30] thermal/core/governors: Use thermal_zone_get_trip() instead of ops functions
From
On 26/09/2022 21:34, Rafael J. Wysocki wrote:
> On Mon, Sep 26, 2022 at 4:06 PM Daniel Lezcano
> <daniel.lezcano@linaro.org> wrote:
>>
>> The governors are using the ops->get_trip_* functions, Replace these
>> calls with thermal_zone_get_trip().
>>
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
>> Reviewed-by: Zhang Rui <rui.zhang@intel.com>
>> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com> # IPA
>> ---
>> drivers/thermal/gov_bang_bang.c | 29 ++++++++-------
>> drivers/thermal/gov_fair_share.c | 18 ++++------
>> drivers/thermal/gov_power_allocator.c | 51 ++++++++++++---------------
>> drivers/thermal/gov_step_wise.c | 22 ++++++------
>> 4 files changed, 53 insertions(+), 67 deletions(-)
>>
>> diff --git a/drivers/thermal/gov_bang_bang.c b/drivers/thermal/gov_bang_bang.c
>> index a08bbe33be96..f5b85e5ea707 100644
>> --- a/drivers/thermal/gov_bang_bang.c
>> +++ b/drivers/thermal/gov_bang_bang.c
>> @@ -13,26 +13,25 @@
>>
>> #include "thermal_core.h"
>>
>> -static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip)
>> +static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip_id)
>> {
>> - int trip_temp, trip_hyst;
>> + struct thermal_trip trip;
>> struct thermal_instance *instance;
>> + int ret;
>>
>> - tz->ops->get_trip_temp(tz, trip, &trip_temp);
>> -
>> - if (!tz->ops->get_trip_hyst) {
>> - pr_warn_once("Undefined get_trip_hyst for thermal zone %s - "
>> - "running with default hysteresis zero\n", tz->type);
>> - trip_hyst = 0;
>> - } else
>> - tz->ops->get_trip_hyst(tz, trip, &trip_hyst);
>> + ret = __thermal_zone_get_trip(tz, trip_id, &trip);
>> + if (ret)
>> + pr_warn_once("Failed to retrieve trip point %d\n", trip_id);
>
> Does it even make sense to continue beyond this point if ret is nonzero?

No, I think we can bail out from here

> All of the contents of trip can be garbage then AFAICS.
>
>> +
>> + if (!trip.hysteresis)
>> + pr_warn_once("Zero hysteresis value for thermal zone %s\n", tz->type);
>
> Why do you want to warn about this? Haven't we declared already that
> zero hysteresis is valid and normal?

Apparently the bang-bang governor is expecting a hysteresis value as the
check is expecting:

>> - if (!tz->ops->get_trip_hyst) {
>> - pr_warn_once("Undefined get_trip_hyst for thermal
zone %s - "
>> - "running with default hysteresis
zero\n", tz->type);
>> - trip_hyst = 0;

It is just to keep a warning as before.

>>
>> dev_dbg(&tz->device, "Trip%d[temp=%d]:temp=%d:hyst=%d\n",
>> - trip, trip_temp, tz->temperature,
>> - trip_hyst);
>> + trip_id, trip.temperature, tz->temperature,
>> + trip.hysteresis);
>>
>> list_for_each_entry(instance, &tz->thermal_instances, tz_node) {
>> - if (instance->trip != trip)
>> + if (instance->trip != trip_id)
>> continue;
>>
>> /* in case fan is in initial state, switch the fan off */


--
<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

\
 
 \ /
  Last update: 2022-09-27 00:17    [W:0.063 / U:0.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site