Re: [PATCH v6 02/10] property: Add functions to iterate named child

From
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date
2025-03-10 14:51:40
Also in
linux-acpi, linux-devicetree, linux-iio, lkml
Reply to
Matti Vaittinen, 2025-03-10
On Mon, Mar 10, 2025 at 02:55:53PM +0200, Matti Vaittinen wrote:
There are a few use-cases where child nodes with a specific name need to
be parsed. Code like:

fwnode_for_each_child_node()
	if (fwnode_name_eq())
		...

can be found from a various drivers/subsystems. Adding a macro for this
can simplify things a bit.

In a few cases the data from the found nodes is later added to an array,
which is allocated based on the number of found nodes. One example of
such use is the IIO subsystem's ADC channel nodes, where the relevant
nodes are named as channel[@N].

Add a helpers for iterating and counting device's sub-nodes with certain
name instead, of open-coding this in every user.
Please note, the checkpatch.pl was not happy about the for_each...()
macros. I tried to make them to follow the existing convention. I am
open to suggestions how to improve.
You also may update .clang-format.

-- 
With Best Regards,
Andy Shevchenko

Thread (11 messages) 11 messages, 4 authors, last reply 2025-03-15
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help