Re: [PATCH 7/7] mtd: spi-nor: hisi-sfc: Simplify with scoped for each OF child loop
From: Vladimir Zapolskiy
Date: Sat Jan 03 2026 - 18:58:12 EST
On 1/3/26 14:38, Krzysztof Kozlowski wrote:
On 02/01/2026 14:33, Pratyush Yadav wrote:
Hi Kyzystof,
Thanks for the cleanup.
On Fri, Jan 02 2026, Krzysztof Kozlowski wrote:
Use scoped for-each loop when iterating over device nodes to make code a
bit simpler.
Nit: the commit message is a bit too dry. I had to go and look what the
difference between the two variants was. I could make an educated guess
by looking at the patch, but still.
Really? That's old and widely used syntax, replaced so many times and
sorry, but really obvious.
The made conversion changes are not exactly the ones, which were asked to
be done.
Commit 34af4554fb0c ("of: Introduce for_each_*_child_of_node_scoped()
to automate of_node_put() handling") says it clearly:
Note that, in the vast majority of cases, the _available_ form should be
used and as code is converted to these scoped handers, we should confirm
that any cases that do not check for available have a good reason not
to.
So, likely this and many other similar changes miss information in their
commit messages, why for_each_available_child_of_node_scoped() form is
inapplicable, thus it still could be improved.
We should not explain core kernel API in commit msgs, except maybe first
months of usage.
If you end up doing a v2, a one-liner explanation of the difference
between the two loop variants would be nice to have.
--
Best wishes,
Vladimir