summaryrefslogtreecommitdiff
path: root/arch/mips
diff options
context:
space:
mode:
authorMarek BehĂșn <marek.behun@nic.cz>2022-01-20 01:04:42 +0100
committerStefan Roese <sr@denx.de>2022-01-20 11:35:29 +0100
commit3058e283b885d80fbaaaaed6f597a068188be948 (patch)
tree3acad866dc7b75435b3bf1972ab7323257b707cc /arch/mips
parent068415eadefbbc81f14d4ce61fcf7a7eb39650d4 (diff)
fdt_support: Add fdt_for_each_node_by_compatible() helper macro
Add macro fdt_for_each_node_by_compatible() to allow iterating over fdt nodes by compatible string. Convert various usages of off = fdt_node_offset_by_compatible(fdt, start, compat); while (off > 0) { code(); off = fdt_node_offset_by_compatible(fdt, off, compat); } and similar, to fdt_for_each_node_by_compatible(off, fdt, start, compat) code(); Signed-off-by: Marek BehĂșn <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/mach-octeon/octeon_fdt.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/arch/mips/mach-octeon/octeon_fdt.c b/arch/mips/mach-octeon/octeon_fdt.c
index 199f692516..5c5a14e87a 100644
--- a/arch/mips/mach-octeon/octeon_fdt.c
+++ b/arch/mips/mach-octeon/octeon_fdt.c
@@ -424,12 +424,8 @@ void __octeon_fixup_fdt_mac_addr(void)
}
/* Assign 78XX addresses in the order they appear in the device tree. */
- node = fdt_node_offset_by_compatible(working_fdt, -1, "cavium,octeon-7890-bgx-port");
- while (node != -FDT_ERR_NOTFOUND) {
+ fdt_for_each_node_by_compatible(node, working_fdt, -1, "cavium,octeon-7890-bgx-port")
octeon_set_one_fdt_mac(node, &mac);
- node = fdt_node_offset_by_compatible(working_fdt, node,
- "cavium,octeon-7890-bgx-port");
- }
}
#endif
@@ -450,11 +446,8 @@ void __octeon_fixup_fdt_uart(void)
/* Device trees already have good values for fast simulator
* output, real boards need the correct value.
*/
- node = fdt_node_offset_by_compatible(working_fdt, -1, "cavium,octeon-3860-uart");
- while (node != -FDT_ERR_NOTFOUND) {
+ fdt_for_each_node_by_compatible(node, working_fdt, -1, "cavium,octeon-3860-uart")
fdt_setprop_inplace_cell(working_fdt, node, "clock-frequency", clk);
- node = fdt_node_offset_by_compatible(working_fdt, node, "cavium,octeon-3860-uart");
- }
}
/**