From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>,
Zhang Rui <rui.zhang@intel.com>,
Lukasz Luba <lukasz.luba@arm.com>,
Amit Kucheria <amitk@kernel.org>,
Thara Gopinath <thara.gopinath@gmail.com>,
Thierry Reding <thierry.reding@gmail.com>,
Jonathan Hunter <jonathanh@nvidia.com>,
Vasily Khoruzhick <anarsoul@gmail.com>,
Yangtao Li <tiny.windzz@gmail.com>, Chen-Yu Tsai <wens@csie.org>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Samuel Holland <samuel@sholland.org>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-msm@vger.kernel.org, linux-tegra@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev, Chen-Yu Tsai <wenst@chromium.org>
Subject: Re: [PATCH v2 4/7] thermal: of: Simplify thermal_of_for_each_cooling_maps() with scoped for each OF child loop
Date: Fri, 16 Aug 2024 14:21:54 +0200 [thread overview]
Message-ID: <3b33d0b0-ae9f-4afe-af2f-9596394bcc4f@linaro.org> (raw)
In-Reply-To: <CAJZ5v0j9WTzd5qg3bLLB6Y41xu1zoJMy7TV1xhFxEzW-x=b5=w@mail.gmail.com>
On 16/08/2024 13:30, Rafael J. Wysocki wrote:
> On Fri, Aug 16, 2024 at 9:40 AM Krzysztof Kozlowski
> <krzysztof.kozlowski@linaro.org> wrote:
>>
>> Use scoped for_each_child_of_node_scoped() when iterating over device
>> nodes to make code a bit simpler.
>>
>> Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>> ---
>> drivers/thermal/thermal_of.c | 8 +++-----
>> 1 file changed, 3 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
>> index 94cc077ab3a1..ce398fde48bb 100644
>> --- a/drivers/thermal/thermal_of.c
>> +++ b/drivers/thermal/thermal_of.c
>> @@ -373,7 +373,7 @@ static int thermal_of_for_each_cooling_maps(struct thermal_zone_device *tz,
>> int (*action)(struct device_node *, int, int,
>> struct thermal_zone_device *, struct thermal_cooling_device *))
>> {
>> - struct device_node *tz_np, *cm_np, *child;
>> + struct device_node *tz_np, *cm_np;
>> int ret = 0;
>>
>> tz_np = thermal_of_zone_get_by_name(tz);
>> @@ -386,12 +386,10 @@ static int thermal_of_for_each_cooling_maps(struct thermal_zone_device *tz,
>> if (!cm_np)
>> goto out;
>>
>> - for_each_child_of_node(cm_np, child) {
>> + for_each_child_of_node_scoped(cm_np, child) {
>> ret = thermal_of_for_each_cooling_device(tz_np, child, tz, cdev, action);
>> - if (ret) {
>> - of_node_put(child);
>> + if (ret)
>> break;
>> - }
>> }
>>
>> of_node_put(cm_np);
>>
>> --
>
> This clashes with
>
> https://lore.kernel.org/linux-pm/1758256.QkHrqEjB74@rjwysocki.net/
>
> which I would prefer to go in first if you don't mind.
My other patchset which fixes bugs here, could go in before:
https://lore.kernel.org/all/20240814195823.437597-1-krzysztof.kozlowski@linaro.org/
so it will be backported. Other than that, I am fine with rebasing my
changes. There is no point in refactoring the code if it is being
removed/reshuffled :)
Best regards,
Krzysztof
next prev parent reply other threads:[~2024-08-16 12:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-16 7:40 [PATCH v2 0/7] thermal: scope/cleanup.h improvements Krzysztof Kozlowski
2024-08-16 7:40 ` [PATCH v2 1/7] thermal: of: Use scoped device node handling to simplify of_find_trip_id() Krzysztof Kozlowski
2024-08-16 7:40 ` [PATCH v2 2/7] thermal: of: Use scoped device node handling to simplify thermal_of_trips_init() Krzysztof Kozlowski
2024-08-16 7:40 ` [PATCH v2 3/7] thermal: of: Use scoped device node handling to simplify of_thermal_zone_find() Krzysztof Kozlowski
2024-08-16 7:40 ` [PATCH v2 4/7] thermal: of: Simplify thermal_of_for_each_cooling_maps() with scoped for each OF child loop Krzysztof Kozlowski
2024-08-16 11:30 ` Rafael J. Wysocki
2024-08-16 12:21 ` Krzysztof Kozlowski [this message]
2024-08-16 16:02 ` Rafael J. Wysocki
2024-08-16 7:40 ` [PATCH v2 5/7] thermal: qcom-spmi-adc-tm5: Simplify " Krzysztof Kozlowski
2024-08-16 7:40 ` [PATCH v2 6/7] thermal: tegra: " Krzysztof Kozlowski
2024-08-16 7:40 ` [PATCH v2 7/7] thermal: sun8i: Use scoped device node handling to simplify error paths Krzysztof Kozlowski
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=3b33d0b0-ae9f-4afe-af2f-9596394bcc4f@linaro.org \
--to=krzysztof.kozlowski@linaro.org \
--cc=amitk@kernel.org \
--cc=anarsoul@gmail.com \
--cc=daniel.lezcano@linaro.org \
--cc=jernej.skrabec@gmail.com \
--cc=jonathanh@nvidia.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=linux-tegra@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
--cc=samuel@sholland.org \
--cc=thara.gopinath@gmail.com \
--cc=thierry.reding@gmail.com \
--cc=tiny.windzz@gmail.com \
--cc=wens@csie.org \
--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