feat(fdt): add for_each_compatible_node macro

This macro enables users to go through dts nodes that have a particular
compatible string in its node attribute.

Signed-off-by: Laurent Carlier <laurent.carlier@arm.com>
Change-Id: Id80cbe6f6057076e0d53905cdc0f9a44e79960f8
This commit is contained in:
Laurent Carlier 2021-09-30 15:57:09 +01:00
parent ab5964aadc
commit ff766148b5
1 changed files with 5 additions and 0 deletions

View File

@ -48,4 +48,9 @@ static inline uint32_t fdt_blob_size(const void *dtb)
return fdt32_to_cpu(dtb_header[1]);
}
#define fdt_for_each_compatible_node(dtb, node, compatible_str) \
for (node = fdt_node_offset_by_compatible(dtb, -1, compatible_str); \
node >= 0; \
node = fdt_node_offset_by_compatible(dtb, node, compatible_str))
#endif /* FDT_WRAPPERS_H */