mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lukasz Luba <lukasz.luba@arm.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>,
	Yu-Che Cheng <giver@chromium.org>,
	Zhang Rui <rui.zhang@intel.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Chen-Yu Tsai <wenst@chromium.org>
Subject: Re: [PATCH] thermal: of: Fix logic in thermal_of_should_bind
Date: Mon, 24 Feb 2025 10:59:11 +0000	[thread overview]
Message-ID: <c3ea0f88-3ee2-44b4-9970-17c9de59d50b@arm.com> (raw)
In-Reply-To: <CAJZ5v0gJGxWA=7zHYU5h=ueqQcXNt94wOAg7sqrphOUb++mAyw@mail.gmail.com>

Hi Rafael,

On 2/20/25 20:22, Rafael J. Wysocki wrote:
> On Wed, Feb 19, 2025 at 10:40 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
>>
>> On Wed, Feb 19, 2025 at 8:06 AM Yu-Che Cheng <giver@chromium.org> wrote:
>>>
>>> The current thermal_of_should_bind will stop iterating cooling-maps on
>>> the first matched trip point, leading to subsequent cooling devices
>>> binding to the same trip point failing to find the cooling spec.
>>>
>>> The iteration should continue enumerating subsequent cooling-maps if the
>>> target cooling device is not found.
>>>
>>> Fix the logic to break only when a matched cooling device is found.
>>
>> OK, but ->
>>
>>> Fixes: 94c6110b0b13 ("thermal/of: Use the .should_bind() thermal zone callback")
>>> Signed-off-by: Yu-Che Cheng <giver@chromium.org>
>>> ---
>>>   drivers/thermal/thermal_of.c | 3 ++-
>>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
>>> index 5ab4ce4daaeb..69c530e38574 100644
>>> --- a/drivers/thermal/thermal_of.c
>>> +++ b/drivers/thermal/thermal_of.c
>>> @@ -312,7 +312,8 @@ static bool thermal_of_should_bind(struct thermal_zone_device *tz,
>>>                                  break;
>>
>> -> I'd prefer to do a jump from here, that is
>>
>> -                                 break;
>> +                                goto put_cm_np;
>>>                  }
>>>
>>> -               break;
>>
>> and remove the break statement above altogether.
>>
>>> +               if (result)
>>> +                       break;
>>>          }
>>>
>>
>> And of course the label needs to be added too:
>>
>> +put_cm_np:
>>>          of_node_put(cm_np);
>>>
>>> ---
> 
> Or even, to avoid adding a new label, move the loop from
> thermal_of_should_bind() into a new function that will be called by it
> do carry out the cooling-maps lookup, like in the attached patch.
> 
> Can you check if it works for you, please?


I have experimented with your proposed patch with my DT setup.
It looks OK to me and much more clean.

If you have any super-edge-case scenario DT config to try, please let me
know. I will try to create such on my end...

If you would like to go forward with your patch, feel free to add:

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

Regards,
Lukasz


      parent reply	other threads:[~2025-02-24 10:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-19  7:06 Yu-Che Cheng
2025-02-19 21:40 ` Rafael J. Wysocki
2025-02-20 20:22   ` Rafael J. Wysocki
2025-02-21 23:24     ` Yu-Che Cheng
2025-02-24 10:59     ` Lukasz Luba [this message]

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=c3ea0f88-3ee2-44b4-9970-17c9de59d50b@arm.com \
    --to=lukasz.luba@arm.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=giver@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=wenst@chromium.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

all inboxes | Powered by JetHome®