[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f1842060-0613-db53-a8c6-d0704d500f98@huawei.com>
Date: Fri, 23 Aug 2024 10:20:56 +0800
From: Jinjie Ruan <ruanjinjie@...wei.com>
To: Krzysztof Kozlowski <krzk@...nel.org>, Jakub Kicinski <kuba@...nel.org>
CC: <andrew@...n.ch>, <f.fainelli@...il.com>, <olteanv@...il.com>,
<davem@...emloft.net>, <edumazet@...gle.com>, <pabeni@...hat.com>,
<netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH -next] net: dsa: Simplify with scoped for each OF child
loop
On 2024/8/22 22:39, Krzysztof Kozlowski wrote:
> On 22/08/2024 04:07, Jinjie Ruan wrote:
>>
>>
>> On 2024/8/22 8:18, Jakub Kicinski wrote:
>>> On Tue, 20 Aug 2024 14:58:04 +0800 Jinjie Ruan wrote:
>>>> Use scoped for_each_available_child_of_node_scoped() when iterating over
>>>> device nodes to make code a bit simpler.
>>>
>>> Could you add more info here that confirms this works with gotos?
>>> I don't recall the details but I thought sometimes the scoped
>>> constructs don't do well with gotos. I checked 5 random uses
>>> of this loop and 4 of them didn't have gotos.
>>
>> Hi, Jakub
>>
>> >From what I understand, for_each_available_child_of_node_scoped() is not
>> related to gotos, it only let the iterating child node self-declared and
>> automatic release, so the of_node_put(iterating_child_node) can be removed.
>>
>> For example, the following use case has goto and use this macro:
>>
>> Link:
>> https://lore.kernel.org/all/20240813-b4-cleanup-h-of-node-put-other-v1-6-cfb67323a95c@linaro.org/
>
> Jinjie,
> You started this after me, shortly after my series, taking the commit
> msgs and subjects, and even using my work as reference or explanation of
> your patches. Basically you just copy-paste. That's ok, thouogh, but you
> could at least Cc me to tell me that you are doing it to avoid
> duplication. That would be nice... And you could *try to* understand
> what you are doing, so you can answer to such concerns as Jakub raised.
> Otherwise how can we know that your code is correct?
Thank you very much, I'll Cc you for other patches.
>
> Jakub,
> Scoped uses in-place variable declarations, thus earlier jumps over it
> are not allowed. The code I was converting did not have such jumps, so
> was fine. Not sure if this is the case here, because Jinjie Ruan should
> have checked it and explained that it is safe.
>
> Best regards,
> Krzysztof
>
Powered by blists - more mailing lists