[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3f83b7a7-b674-486f-889a-033f550f3654@arm.com>
Date: Wed, 20 Dec 2023 16:22:22 +0000
From: Lukasz Luba <lukasz.luba@....com>
To: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: linux-kernel@...r.kernel.org, daniel.lezcano@...aro.org,
linux-pm@...r.kernel.org, rui.zhang@...el.com
Subject: Re: [PATCH v2 4/8] thermal: gov_power_allocator: Simplify checks for
valid power actor
On 12/20/23 14:40, Rafael J. Wysocki wrote:
> On Tue, Dec 12, 2023 at 2:48 PM Lukasz Luba <lukasz.luba@....com> wrote:
>>
>> There is a need to check if the cooling device in the thermal zone
>> supports IPA callback and is set for control trip point.
>> Refactor the code which validates the power actor capabilities and
>> make it more consistent in all places.
>
> This really is about reducing code duplication which is worth
> mentioning, so I would say
>
> "Add a helper to check if a given cooling device in a thermal zone
> supports the IPA callback and is bound to the control trip point and
> use it wherever that check is needed to reduce code duplication."
>
Thanks, I'll use it.
>>
>> No intentional functional impact.
>>
>> Signed-off-by: Lukasz Luba <lukasz.luba@....com>
>> ---
>> drivers/thermal/gov_power_allocator.c | 41 +++++++++++----------------
>> 1 file changed, 17 insertions(+), 24 deletions(-)
>>
>> diff --git a/drivers/thermal/gov_power_allocator.c b/drivers/thermal/gov_power_allocator.c
>> index 3328c3ec71f2..1a605fd9c8c6 100644
>> --- a/drivers/thermal/gov_power_allocator.c
>> +++ b/drivers/thermal/gov_power_allocator.c
>> @@ -85,6 +85,13 @@ struct power_allocator_params {
>> u32 *weighted_req_power;
>> };
>>
>> +static bool power_actor_is_valid(struct power_allocator_params *params,
>> + struct thermal_instance *instance)
>> +{
>> + return ((instance->trip == params->trip_max) &&
>
> The inner parens are redundant.
OK
>
>> + cdev_is_power_actor(instance->cdev));
>> +}
>
> The part below LGTM.
Powered by blists - more mailing lists