summaryrefslogtreecommitdiff
path: root/arch/powerpc
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/powerpc
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/powerpc')
-rw-r--r--arch/powerpc/cpu/mpc85xx/liodn.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/arch/powerpc/cpu/mpc85xx/liodn.c b/arch/powerpc/cpu/mpc85xx/liodn.c
index e552378e78..a084002494 100644
--- a/arch/powerpc/cpu/mpc85xx/liodn.c
+++ b/arch/powerpc/cpu/mpc85xx/liodn.c
@@ -268,15 +268,10 @@ static void fdt_fixup_pci_liodn_offsets(void *fdt, const char *compat,
* Count the number of pci nodes.
* It's needed later when the interleaved liodn offsets are generated.
*/
- off = fdt_node_offset_by_compatible(fdt, -1, compat);
- while (off != -FDT_ERR_NOTFOUND) {
+ fdt_for_each_node_by_compatible(off, fdt, -1, compat)
pci_cnt++;
- off = fdt_node_offset_by_compatible(fdt, off, compat);
- }
- for (off = fdt_node_offset_by_compatible(fdt, -1, compat);
- off != -FDT_ERR_NOTFOUND;
- off = fdt_node_offset_by_compatible(fdt, off, compat)) {
+ fdt_for_each_node_by_compatible(off, fdt, -1, compat) {
base_liodn = fdt_getprop(fdt, off, "fsl,liodn", &rc);
if (!base_liodn) {
char path[64];